Commit Graph

7223 Commits

Author SHA1 Message Date
Manish Pandey 658086747d Merge changes from topic "fdt_wrappers_rework" into integration
* changes:
  arm: fconf: Fix GICv3 dynamic configuration
  plat/stm32: Implement fdt_read_uint32_default() as a wrapper
  fdt/wrappers: Replace fdtw_read_cells() implementation
  plat/stm32: Use generic fdt_read_uint32_array() implementation
  fdt/wrappers: Generalise fdtw_read_array()
2020-05-04 16:03:54 +00:00
Andre Przywara 364ad245a2 arm: fconf: Fix GICv3 dynamic configuration
At the moment the fconf_populate_gicv3_config() implementation is
somewhat incomplete: First it actually fails to store the retrieved
information (the local addr[] array is going nowhere), but also it makes
quite some assumptions about the device tree passed to it: it needs to
use two address-cells and two size-cells, and also requires all five
register regions to be specified, where actually only the first two
are mandatory according to the binding (and needed by our code).

Fix this by introducing a proper generic function to retrieve "reg"
property information from a DT node:
We retrieve the #address-cells and #size-cells properties from the
parent node, then use those to extract the right values from the "reg"
property. The function takes an index to select one region of a reg
property.

This is loosely based on the STM32 implementation using "reg-names",
which we will subsume in a follow-up patch.

Change-Id: Ia59bfdf80aea4e36876c7b6ed4d153e303f482e8
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-30 10:09:18 +01:00
Andre Przywara be858cffa9 plat/stm32: Implement fdt_read_uint32_default() as a wrapper
The STM32 platform code uses its own set of FDT helper functions,
although some of them are fairly generic.

Remove the implementation of fdt_read_uint32_default() and implement it
on top of the newly introduced fdt_read_uint32() function, then convert
all users over.

This also fixes two callers, which were slightly abusing the "default"
semantic.

Change-Id: I570533362b4846e58dd797a92347de3e0e5abb75
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-29 10:19:17 +01:00
Andre Przywara ff4e6c35c9 fdt/wrappers: Replace fdtw_read_cells() implementation
Our fdtw_read_cells() implementation goes to great lengths to
sanity-check every parameter and result, but leaves a big hole open:
The size of the storage the value pointer points at needs to match the
number of cells given. This can't be easily checked at compile time,
since we lose the size information by using a void pointer.
Regardless the current usage of this function is somewhat wrong anyways,
since we use it on single-element, fixed-length properties only, for
which the DT binding specifies the size.
Typically we use those functions dealing with a number of cells in DT
context to deal with *dynamically* sized properties, which depend on
other properties (#size-cells, #clock-cells, ...), to specify the number
of cells needed.

Another problem with the current implementation is the use of
ambiguously sized types (uintptr_t, size_t) together with a certain
expectation about their size. In general there is no relation between
the length of a DT property and the bitness of the code that parses the
DTB: AArch64 code could encounter 32-bit addresses (where the physical
address space is limited to 4GB [1]), while AArch32 code could read
64-bit sized properties (/memory nodes on LPAE systems, [2]).

To make this more clear, fix the potential issues and also align more
with other DT users (Linux and U-Boot), introduce functions to explicitly
read uint32 and uint64 properties. As the other DT consumers, we do this
based on the generic "read array" function.
Convert all users to use either of those two new functions, and make
sure we never use a pointer to anything other than uint32_t or uint64_t
variables directly.

This reveals (and fixes) a bug in plat_spmd_manifest.c, where we write
4 bytes into a uint16_t variable (passed via a void pointer).

Also we change the implementation of the function to better align with
other libfdt users, by using the right types (fdt32_t) and common
variable names (*prop, prop_names).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi#n874
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ecx-2000.dts

Change-Id: I718de960515117ac7a3331a1b177d2ec224a3890
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-29 10:19:17 +01:00
Andre Przywara 52a616b48c plat/stm32: Use generic fdt_read_uint32_array() implementation
The device tree parsing code for the STM32 platform is using its own FDT
helper functions, some of them being rather generic.
In particular the existing fdt_read_uint32_array() implementation is now
almost identical to the new generic code in fdt_wrappers.c, so we can
remove the ST specific version and adjust the existing callers.

Compared to the original ST implementation the new version takes a
pointer to the DTB as the first argument, and also swaps the order of
the number of cells and the pointer.

Change-Id: Id06b0f1ba4db1ad1f733be40e82c34f46638551a
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-28 15:56:31 +01:00
Andre Przywara 6e3a89f449 fdt/wrappers: Generalise fdtw_read_array()
Currently our fdtw_read_array() implementation requires the length of
the property to exactly match the requested size, which makes it less
flexible for parsing generic device trees.
Also the name is slightly misleading, since we treat the cells of the
array as 32 bit unsigned integers, performing the endianess conversion.

To fix those issues and align the code more with other DT users (Linux
kernel or U-Boot), rename the function to "fdt_read_uint32_array", and
relax the length check to only check if the property covers at least the
number of cells we request.
This also changes the variable names to be more in-line with other DT
users, and switches to the proper data types.

This makes this function more useful in later patches.

Change-Id: Id86f4f588ffcb5106d4476763ecdfe35a735fa6c
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-28 15:56:31 +01:00
Sandrine Bailleux 455a6f3b14 Merge changes from topic "linker-script" into integration
* changes:
  linker_script: move .data section to bl_common.ld.h
  linker_script: move stacks section to bl_common.ld.h
  bl1: remove '.' from stacks section in linker script
2020-04-27 08:45:34 +00:00
Masahiro Yamada caa3e7e0a4 linker_script: move .data section to bl_common.ld.h
Move the data section to the common header.

I slightly tweaked some scripts as follows:

[1] bl1.ld.S has ALIGN(16). I added DATA_ALIGN macro, which is 1
    by default, but overridden by bl1.ld.S. Currently, ALIGN(16)
    of the .data section is redundant because commit 4128659076
    ("Fix boot failures on some builds linked with ld.lld.") padded
    out the previous section to work around the issue of LLD version
    <= 10.0. This will be fixed in the future release of LLVM, so
    I am keeping the proper way to align LMA.

[2] bl1.ld.S and bl2_el3.ld.S define __DATA_RAM_{START,END}__ instead
    of __DATA_{START,END}__. I put them out of the .data section.

[3] SORT_BY_ALIGNMENT() is missing tsp.ld.S, sp_min.ld.S, and
    mediatek/mt6795/bl31.ld.S. This commit adds SORT_BY_ALIGNMENT()
    for all images, so the symbol order in those three will change,
    but I do not think it is a big deal.

Change-Id: I215bb23c319f045cd88e6f4e8ee2518c67f03692
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-25 20:09:08 +09:00
Masahiro Yamada a926a9f60a linker_script: move stacks section to bl_common.ld.h
The stacks section is the same for all BL linker scripts.

Move it to the common header file.

Change-Id: Ibd253488667ab4f69702d56ff9e9929376704f6c
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-24 19:19:06 +09:00
Masahiro Yamada b9f7b57d3a bl1: remove '.' from stacks section in linker script
Only BL1 specifies '.' in the address field of the stacks section.

Commit 4f59d8359f ("Make BL1 RO and RW base addresses configurable")
added '.' on purpose but the commit message does not help to understand
why.

This commit gets rid of it in order to factor out the stacks section
into include/common/bl_common.ld.h

I compared the build result for PLAT=qemu.

'aarch64-linux-gnu-nm -n build/qemu/release/bl1/bl1.elf' will change
as follows:

@@ -336,8 +336,8 @@
 000000000e04e0e0 d max_log_level
 000000000e04e0e4 D console_state
 000000000e04e0e5 D __DATA_RAM_END__
-000000000e04e0e5 B __STACKS_START__
 000000000e04e100 b platform_normal_stacks
+000000000e04e100 B __STACKS_START__
 000000000e04f100 b bl1_cpu_context
 000000000e04f100 B __BSS_START__
 000000000e04f100 B __STACKS_END__

After this change, __STACKS_START__ will match to platform_normal_stacks,
and I think it makes more sense.

'aarch64-linux-gnu-objdump -h build/qemu/release/bl1/bl1.elf' will change
as follows:

@@ -9,11 +9,11 @@
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   2 .data         000000e5  000000000e04e000  0000000000004a60  0001e000  2**4
                   CONTENTS, ALLOC, LOAD, DATA
-  3 stacks        0000101b  000000000e04e0e5  000000000e04e0e5  0001e0e5  2**6
+  3 stacks        00001000  000000000e04e100  0000000000004b45  0001e100  2**6
                   ALLOC
-  4 .bss          000007e0  000000000e04f100  000000000e04f100  0001e0e5  2**5
+  4 .bss          000007e0  000000000e04f100  0000000000004b50  0001f100  2**5
                   ALLOC
-  5 xlat_table    00006000  000000000e050000  000000000e050000  0001e0e5  2**12
+  5 xlat_table    00006000  000000000e050000  0000000000004b45  00020000  2**12
                   ALLOC
   6 coherent_ram  00000000  000000000e056000  000000000e056000  0001f000  2**12
                   CONTENTS

Sandrine pointed me to a useful document [1] to understand why LMAs of
stacks, .bss, and xlat_table section have changed.

Before this patch, they fell into this scenario:
 "If the section has a specific VMA address, then this is used as the
  LMA address as well."

With this commit, the following applies:
 "Otherwise if a memory region can be found that is compatible with the
  current section, and this region contains at least one section, then
  the LMA is set so the difference between the VMA and LMA is the same
  as the difference between the VMA and LMA of the last section in the
  located region."

Anyway, those three sections are not loaded, so the LMA changes will not
be a problem. The size of bl1.bin is still the same.

QEMU still boots successfully with this change.

A good thing is, this fixes the error for the latest LLD. If I use the
mainline LLVM, I see the following error. The alignment check will probably
be included in the LLVM 11 release, so it is better to fix it now.

$ PLAT=qemu CC=clang CROSS_COMPILE=aarch64-linux-gnu-
  [ snip ]
ld.lld: error: address (0xe04e0e5) of section stacks is not a multiple of alignment (64)
make: *** [Makefile:1050: build/qemu/release/bl1/bl1.elf] Error 1

[1]: https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html#Output-Section-LMA

Change-Id: I3d2f3cc2858be8b3ce2eab3812a76d1e0b5f3a32
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-04-24 19:18:01 +09:00
Sandrine Bailleux 1f915222ae Merge "Provide a hint to power controller for DSU cluster power down" into integration 2020-04-24 09:08:33 +00:00
Manish Pandey f4701a776d Merge "board/rddanielxlr: add support for rd-daniel config-xlr platform" into integration 2020-04-23 20:35:48 +00:00
Manish Pandey 9c1a6f4e71 Merge "spm: Normalize the style of spm core manifest" into integration 2020-04-23 11:33:55 +00:00
Louis Mayencourt d7b5f02617 spm: Normalize the style of spm core manifest
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Change-Id: Ib39e53eb53521b8651fb30b7bf0058f7669569d5
2020-04-23 10:55:04 +01:00
Aditya Angadi 5a726a5dcc board/rddanielxlr: add support for rd-daniel config-xlr platform
RD-Daniel Config-XLR platform has four identical chips connected via a
high speed coherent CCIX link. Each chip has four Neoverse cores
connected via coherent CMN interconnect.

Change-Id: I37d1b91f2b6ba08f61c64d0288bc16a429836c08
Signed-off-by: Aditya Angadi <aditya.angadi@arm.com>
2020-04-23 10:03:47 +05:30
Sandrine Bailleux 62b56a72d2 Merge "fdts: a5ds: Fix for the system timer issue." into integration 2020-04-22 06:35:15 +00:00
Sandrine Bailleux fe4fa94e1e Merge "doc: Treat Sphinx warnings as errors" into integration 2020-04-21 09:38:01 +00:00
Sandrine Bailleux 8b815a4e03 doc: Treat Sphinx warnings as errors
'make doc' will now fail if Sphinx outputs any warning messages during
documentation generation.

Change-Id: I3e466af58ccf29b14a7e61037539b79ab6fc6037
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-04-21 09:37:47 +00:00
Mark Dykes 8ff55a9e14 Merge "Incrementing the minor version to reflect upcoming v2.3 release" into integration 2020-04-20 15:56:43 +00:00
Madhukar Pappireddy eca80334a5 Incrementing the minor version to reflect upcoming v2.3 release
Change-Id: I27f7d92988fc16f68041c2ddaa8dd3a60362ddd1
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2020-04-20 00:01:09 -05:00
lakshmi Kailasanathan e3c152d115 fdts: a5ds: Fix for the system timer issue.
A5DS FPGA system timer clock frequency is 7.5Mhz.
The dt is file updated inline with the hardware
clock frequency.

Change-Id: I3f6c2e0d4a7b293175a42cf398a8730448504af9
Signed-off-by: lakshmi Kailasanathan <lakshmi.Kailasanathan@arm.com>
2020-04-17 21:12:15 +01:00
Mark Dykes 6428938ff4 Merge "juno/sgm: Align SCP_BL2 to page boundary" into integration 2020-04-17 15:25:21 +00:00
Mark Dykes e822372afb Merge "doc: Fixup some SMCCC links" into integration 2020-04-17 15:23:47 +00:00
Chris Kay 868a7d1eb4 juno/sgm: Align SCP_BL2 to page boundary
This commit fixes an assertion that was triggering in certain contexts:

    ERROR: mmap_add_region_check() failed. error -22
    ASSERT: lib/xlat_tables_v2/xlat_tables_core.c:790

Change-Id: Ia55b3fb4f496c8cd791ea6093d122edae0a7e92a
Signed-off-by: Chris Kay <chris.kay@arm.com>
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-04-17 14:48:15 +02:00
Sandrine Bailleux 71ac931f33 doc: Fixup some SMCCC links
This is a fixup for patch 3ba55a3c5f
("docs: Update SMCCC doc, other changes for release"), where some
links names got changed but their references didn't.

Change-Id: I980d04dde338f3539a2ec1ae2e807440587b1cf5
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-04-17 14:06:54 +02:00
Sandrine Bailleux 6e18633260 Merge "doc: Set fconf as experimental feature" into integration 2020-04-17 08:35:33 +00:00
Mark Dykes 89a16e8fc2 Merge "docs: Update SMCCC doc, other changes for release" into integration 2020-04-16 21:04:44 +00:00
Mark Dykes f9b546f652 Merge "docs: Updating Change log for v2.3 Release" into integration 2020-04-16 21:04:17 +00:00
Louis Mayencourt c2c150e7c5 doc: Set fconf as experimental feature
Following the messages on the mailing list regarding the possible issue around
reading DTB's information, we decided to flag the fconf feature as experimental.
A uniform approach should be used to handle properties miss and DTB validation.

Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Change-Id: Ib3c86e81fb2e89452c593f68d825d3d8f505e1fb
2020-04-16 17:33:22 +01:00
laurenw-arm 4204e074cd docs: Updating Change log for v2.3 Release
Updating the change log for the v2.3 release and the upcoming change log
template for v2.4 release.

Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: Ice875d3c93227069738a429d4b945512af8470e9
2020-04-16 10:23:21 -05:00
laurenw-arm 3ba55a3c5f docs: Update SMCCC doc, other changes for release
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: Ie842d6a9919776de151a4e9304f870aede07c47a
2020-04-16 10:03:39 -05:00
Sandrine Bailleux 7a6840411a Merge "docs: Fixes and updates for the v2.3 release" into integration 2020-04-16 07:42:55 +00:00
joanna.farley c55f4cfb8d Merge "docs: Updating Release information for v2.4" into integration 2020-04-16 07:12:39 +00:00
laurenw-arm 495553d572 docs: Fixes and updates for the v2.3 release
A small set of misc changes to ensure correctness before the v2.3
release.

Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: I5b4e35b3b46616df0453cecff61f5a414951cd62
2020-04-15 17:50:43 -05:00
laurenw-arm 3056819b2b docs: Updating Release information for v2.4
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: I5a7ae778999295f3453b7ab0bfc26351e545fb8f
2020-04-15 15:20:36 -05:00
Madhukar Pappireddy 9cf7f355ce Provide a hint to power controller for DSU cluster power down
By writing 0 to CLUSTERPWRDN DSU register bit 0, we send an
advisory to the power controller that cluster power is not required
when all cores are powered down.

The AArch32 CLUSTERPWRDN register is architecturally mapped to the
AArch64 CLUSTERPWRDN_EL1 register

Change-Id: Ie6e67c1c7d811fa25c51e2e405ca7f59bd20c81b
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2020-04-15 10:10:24 -05:00
Manish Pandey cc52800db4 Merge "plat/arm/sgi: update mmap and xlat count" into integration 2020-04-15 11:25:08 +00:00
Sandrine Bailleux 98a1988878 Merge "Fix Broadcom Stingray platform documentation" into integration 2020-04-15 10:29:27 +00:00
Sandrine Bailleux 77516a7331 Fix Broadcom Stingray platform documentation
- Include the platform documentation in the table of contents.

 - Add a title for the document. Without this, the platform
   documentation was listed under a 'Description' title on page
   https://trustedfirmware-a.readthedocs.io/en/latest/plat/index.html

 - Change TF-A git repository URL to point to tf.org (rather than the
   deprecated read-only mirror on Github).

 - Fix the restructuredText syntax for the FIP command line. It was
   not displayed at all on the rendered version.

Change-Id: I7a0f062bcf8e0dfc65e8f8bdd6775c497a47e619
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2020-04-15 11:20:40 +02:00
Aditya Angadi def3b54b74 plat/arm/sgi: update mmap and xlat count
A single chip platform requires five mmap entries and a corresponding
number of translation tables. For every additional chip in the system,
three additional mmap entries are required to map the shared SRAM and
the IO regions. A corresponding number of additional translation
tables are required as well.

Change-Id: I1332a1305f2af62181387cf36954f6fb0e6f11ed
Signed-off-by: Aditya Angadi <aditya.angadi@arm.com>
2020-04-14 15:35:27 +05:30
Sandrine Bailleux a7e62f1d9e Merge "stingray: fix coverity reported issues on brcm platform" into integration 2020-04-14 07:54:26 +00:00
Sheetal Tigadoli 2176716671 stingray: fix coverity reported issues on brcm platform
fix coverity reported issues
1. uninitialized var,
2. check for negative val on unsigned variable

Signed-off-by: Sheetal Tigadoli <sheetal.tigadoli@broadcom.com>
Change-Id: I28b7517135ba6c1ba0df04f0c73189cf84ba89e6
2020-04-13 18:43:29 +05:30
Sandrine Bailleux 1a63443c08 Merge "arm_fpga: Remove bogus timer initialisation" into integration 2020-04-09 15:03:20 +00:00
Andre Przywara a82ea1dbbf arm_fpga: Remove bogus timer initialisation
The arm_fpga platform code contains an dubious line to initialise some
timer. On closer inspection this turn out to be bogus, as this was only
needed on some special (older) FPGA board, and is actually not needed on
the current model. Also the base address was wrong anyways.

Remove the code entirely.

Change-Id: I02e71aea645051b5addb42d972d7a79f04b81106
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-04-09 13:53:50 +01:00
joanna.farley 50d8cf26dc Merge "TF-A GICv3 driver: Change API for GICR_IPRIORITYR accessors" into integration 2020-04-07 22:48:39 +00:00
Alexei Fedorov e2a4027b1b TF-A GICv3 driver: Change API for GICR_IPRIORITYR accessors
To support compatibility with previous GICv3 driver version
this patch:
- restores original API for gicr_read_ipriority() and
gicr_wrtite_ipriority() functions;
- adds accessor functions for GICR_XXX0,1 registers, e.g.
GICR_IGROUPR0, GICR_ICFGR0, GICR_ICFGR1, etc.

Change-Id: I796a312a61665ff384e3d9de2f4b3c60f700b43b
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-04-07 18:40:44 +01:00
Alexei Fedorov 0b18f8b2e7 Merge "plat/arm/rddaniel: enabled GICv4 extension" into integration 2020-04-07 17:31:53 +00:00
Alexei Fedorov e7e1cf51cd Merge "gic multichip: add support for clayton" into integration 2020-04-07 17:30:40 +00:00
Vijayenthiran Subramaniam eb0f3149d2 plat/arm/rddaniel: enabled GICv4 extension
RD-Daniel uses GIC-Clayton as its interrupt controller which is an
implementation of GICv4.1 architecture. Hence for RD-Daniel, enable
GICv4 extension support.

Change-Id: I45ae8c82376f8fe8fc0666306822ae2db74e71b8
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
2020-04-07 18:43:44 +05:30
Vijayenthiran Subramaniam b24ece54e0 gic multichip: add support for clayton
GIC-Clayton supports multichip operation mode which allows it to connect
upto 16 other GIC-Clayton instances. GIC-Clayton's multichip programming
and operation remains same as GIC-600 with a minor change in the
SPI_BLOCKS and SPI_BLOCK_MIN shifts to accommodate additional SPI
ranges. So identify if the GIC v4 extension is enabled by the platform
makefile and appropriately select the SPI_BLOCKS and SPI_BLOCK_MIN
shifts.

Change-Id: I95fd80ef16af6c7ca09e2335539187b133052d41
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
2020-04-07 18:41:13 +05:30