Commit Graph

6249 Commits

Author SHA1 Message Date
Jan Dabros bb9549babc aarch64: Fix stack pointer maintenance on EA handling path
EA handlers for exceptions taken from lower ELs at the end invokes
el3_exit function. However there was a bug with sp maintenance which
resulted in el3_exit setting runtime stack to context. This in turn
caused memory corruption on consecutive EL3 entries.

Signed-off-by: Jan Dabros <jsd@semihalf.com>
Change-Id: I0424245c27c369c864506f4baa719968890ce659
2019-12-18 08:47:10 +01:00
Soby Mathew 0d35873c8f Merge changes from topic "allwinner_pmic" into integration
* changes:
  allwinner: h6: power: Switch to using the AXP driver
  drivers: allwinner: axp: Add AXP805 support
2019-12-17 16:51:39 +00:00
Soby Mathew 4e0d14f218 Merge "arm: gicv3: Fix compiler dependent behavior" into integration 2019-12-17 16:43:39 +00:00
Soby Mathew 287a81dfad Merge "plat/rockchip: enable power domains of rk3399 before reset" into integration 2019-12-17 16:41:30 +00:00
Soby Mathew 37ebe8e5ee Merge "plat/rockchip: cliam a macro to enable hdcp feature for DP" into integration 2019-12-17 15:12:43 +00:00
Sandrine Bailleux 044b22a053 Merge changes from topic "rockchip-secure-ddr" into integration
* changes:
  rockchip: make miniloader ddr_parameter handling optional
  rockchip: px30: cleanup securing of ddr regions
  rockchip: px30: move secure init to separate file
  rockchip: really use base+size for secure ddr regions
  rockchip: bring TZRAM_SIZE values in line
2019-12-17 09:34:40 +00:00
Sandrine Bailleux 2f3abc19d3 Merge changes from topic "allwinner_pmic" into integration
* changes:
  allwinner: Convert AXP803 regulator setup code into a driver
  allwinner: a64: power: Use fdt_for_each_subnode
  allwinner: a64: power: Remove obsolete register check
  allwinner: a64: power: Remove duplicate DT check
  allwinner: Build PMIC bus drivers only in BL31
  allwinner: a64: power: Make sunxi_turn_off_soc static
  allwinner: Merge duplicate code in sunxi_power_down
  allwinner: Clean up PMIC-related error handling
  allwinner: Synchronize PMIC enumerations
  allwinner: Enable clock before resetting I2C/RSB
2019-12-17 09:32:26 +00:00
Heiko Stuebner df5a968317 rockchip: make miniloader ddr_parameter handling optional
Transfering the regions of ddr memory to additionally protect is very much
specific to some rockchip internal first stage bootloader and doesn't get
used in either mainline uboot or even Rockchip's published vendor uboot
sources.

This results in a big error
    ERROR:   over or zero region, nr=0, max=10
getting emitted on every boot for most users and such a message coming
from early firmware might actually confuse developers working with the
system.

As this mechanism seems to be only be used by Rockchip's internal miniloader
hide it behind a build conditional, so it doesn't confuse people too much.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: I52c02decc60fd431ea78c7486cad5bac82bdbfbe
2019-12-17 10:18:50 +01:00
Heiko Stuebner f55ef85ebf rockchip: px30: cleanup securing of ddr regions
So far the px30-related ddr security was loading data for regions to secure
from a pre-specified memory location and also setting region0 to secure
the first megabyte of memory in hard-coded setting (top=0, end=0, meaning
1MB).

To make things more explicit and easier to read add a function doing
the settings for specified memory areas, like other socs have and also
add an assert to make sure any descriptor read from memory does not
overlap the TZRAM security in region0 and TEE security in region1.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: I78441875112bf66a62fde5f1789f4e52a78ef95f
2019-12-17 10:18:50 +01:00
Heiko Stuebner d2483afac9 rockchip: px30: move secure init to separate file
Similar to others like rk3399 and rk3288 move the secure init to a
separate file to unclutter the soc init a bit.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: Iebb38e24f1c7fe5353f139c896fb8ca769bf9691
2019-12-17 10:18:50 +01:00
Olivier Deprez 52ff3b4c79 Merge "doc: Fix indentation in build options documentation" into integration 2019-12-17 09:02:50 +00:00
Sandrine Bailleux 535fa663bf doc: Fix indentation in build options documentation
Sphinx was showing the following warning message:

docs/getting_started/build-options.rst:200: WARNING: Bullet list ends
without a blank line; unexpected unindent.

Change-Id: Iad5d49c1e0d25dd623ad15bce1af31babf860c03
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2019-12-17 09:39:00 +01:00
Sandrine Bailleux 985c8a3644 Merge "Update list of main maintainers" into integration 2019-12-17 08:31:06 +00:00
Heiko Stuebner 7f0b2e78e0 rockchip: really use base+size for secure ddr regions
The calls to secure ddr regions on rk3288 and rk3399 use parameters of
base and size - as it custom for specifying memory regions, but the
functions themself expect start and endpoints of the area.

This only works by chance for the TZRAM, as it starts a 0x0 and therefore
its end location is the same as its size.

To not fall into a trap later on adapt the functions to really take
base+size parameters.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: Idb9fab38aa081f3335a4eca971e7b7f6757fbbab
2019-12-17 01:29:07 +01:00
Heiko Stuebner c6ee020ea2 rockchip: bring TZRAM_SIZE values in line
The agreed upon division of early boot locations is 0x40000 for bl31
to leave enough room for u-boot-spl and 0x100000 for bl33 (u-boot).

rk3288 and rk3399 already correctly secure the ddr up to the 1MB boundary
so pull the other platforms along to also give the Rockchip TF-A enough
room to comfortably live in.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: Ie9e0c927d3074a418b6fd23b599d2ed7c15c8c6f
2019-12-17 01:29:07 +01:00
György Szing b1acebf4fb Merge "libc: Fix SIZE_MAX on AArch32" into integration 2019-12-16 15:44:57 +00:00
Bence Szépkúti ae4a90f2ae libc: Fix SIZE_MAX on AArch32
SIZE_MAX was mistakenly redefined from UINT32_MAX to UINT64_MAX
on AArch32 when the arch-specific headers were merged.

This value is not currently used by upstream TF-A source code,
so no functionality should be affected.

Change-Id: I2acf7f8736423697c7377e8ed4b08843ced26e66
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2019-12-16 15:24:50 +01:00
Sandrine Bailleux 7835049cff Merge "rockchip: Prevent macro expansion in paths" into integration 2019-12-16 13:52:36 +00:00
Soby Mathew 186acdd979 Merge "cryptocell: add cryptocell 712 RSA 3K support" into integration 2019-12-16 12:17:34 +00:00
Sandrine Bailleux 01534e8563 Update list of main maintainers
Change-Id: Ia4faf873f8946992737f76870ac92bc5cb3f4020
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2019-12-16 11:49:38 +01:00
Sandrine Bailleux 255b380afa Merge "Remove -Wpadded warning" into integration 2019-12-16 09:22:56 +00:00
Justin Chadwell 11a96e0ea0 Remove -Wpadded warning
-Wpadded warns whenever the C compiler automatically includes any
padding in a structure. Because TF-A has a large number of structures,
this occurs fairly frequently and is incredibly verbose, and as such is
unlikely to ever be fixed.

The utility of this warning is also extremely limited - knowing that a
structure includes padding does not point to the existence of an error,
and is probably quite unlikely to indicate actually buggy behaviour.
Therefore, it's probably best to keep this warning off at all times.

Change-Id: I0797cb75f06b4fea0d2fdc16fd5ad978a31d76ec
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
2019-12-16 09:05:42 +00:00
Sandrine Bailleux ef771a4d0d Merge "Remove -Wmissing-declarations warning from WARNING1 level" into integration 2019-12-16 09:05:25 +00:00
Samuel Holland fb23b104c0 allwinner: h6: power: Switch to using the AXP driver
Chip ID checking and poweroff work just like they did before.
Regulators are now enabled just like on A64/H5.

This changes the signatures of the low-level register read/write
functions to match the interface expected by the common driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I14d63d171a094fa1375904928270fa3e21761646
2019-12-13 19:22:34 -06:00
Samuel Holland 0bc752c9ad allwinner: Convert AXP803 regulator setup code into a driver
Previously, the A64/H5 and H6 platforms' PMIC setup code was entirely
independent. However, some H6 boards also need early regulator setup.

Most of the register interface and all of the device tree traversal code
can be reused between the AXP803 and AXP805. The main difference is the
hardware bus interface, so that part is left to the platforms. The
remainder is moved into a driver.

I factored out the bits that were obviously specific to the AXP803;
additional changes for compatibility with other PMICs can be made as
needed.

The only functional change is that rsb_init() now checks the PMIC's chip
ID register against the expected value. This was already being done in
the H6 version of the code.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Icdcf9edd6565f78cccc503922405129ac27e08a2
2019-12-13 19:22:34 -06:00
Samuel Holland f6d9c4cafa drivers: allwinner: axp: Add AXP805 support
This adds the new regulator list, as well as changes to make the switch
(equivalent to DC1SW on the AXP803) work on both PMICs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I9a1eac8ddfc54b27096c10a8eebdd51aaf9b8311
2019-12-13 19:22:34 -06:00
Samuel Holland 79b8546507 allwinner: a64: power: Use fdt_for_each_subnode
This simplifies the code a bit. Verified to produce the same binary.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ie1ec1ce2ea39c46525840906826c90a8a7eff287
2019-12-13 19:20:36 -06:00
Samuel Holland 494c823361 allwinner: a64: power: Remove obsolete register check
As of a561e41bf1 ("allwinner: power: add enable switches for DCDC1/5")
there are no longer regulators without an enable register provided.
Since it seems reasonable that this will continue to be the case, drop
the check.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Icd7ec26fc6450d053e6e6d855fc16229b1d65a39
2019-12-13 19:20:36 -06:00
Samuel Holland 3bea03e7b4 allwinner: a64: power: Remove duplicate DT check
should_enable_regulator() is already checked in the regulators subnode
loop before setup_regulator() is called, so there's no need to check it
again here.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Idb8b8a6e435246f4fb226bc84813449d80a0a977
2019-12-13 19:20:36 -06:00
Samuel Holland 18fbfefbbb allwinner: Build PMIC bus drivers only in BL31
These are used by the PMIC setup code, which runs during BL31
initialization, and the PSCI shutdown code, also a part of BL31.
They can't be needed before BL31, or it wouldn't be possible to boot.
Allwinner platforms don't generally build anything but BL31 anyway, but
this change improves clarity and consistency with allwinner-common.mk.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I24f1d9ca8b4256e44badf5218d04d8690082babf
2019-12-13 19:20:36 -06:00
Samuel Holland df77a95451 allwinner: a64: power: Make sunxi_turn_off_soc static
The function is only used in this file, and it doesn't make sense for it
to be used anywhere else.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Iab18f082911edcdbc37ceeaff8c512be68e0cb0f
2019-12-13 19:20:36 -06:00
Samuel Holland 818e67324b allwinner: Merge duplicate code in sunxi_power_down
The action of last resort isn't going to change between SoCs. This moves
that code back to the PSCI implementation, where it more obviously
matches the code in sunxi_system_reset().

The two error messages say essentially the same thing anyway.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I62ac35fdb5ed78a016e9b18281416f1dcea38a4a
2019-12-13 19:20:36 -06:00
Samuel Holland 4538c4983b allwinner: Clean up PMIC-related error handling
- Check the return value from sunxi_init_platform_r_twi().
- Print the PMIC banner before doing anything that might fail.
- Remove double prefixes in error messages.
- Consistently omit the trailing period.
- No need to print the unknown SoC's ID, since we already did that
  earlier in bl31_platform_setup().
- On the other hand, do print the ID of the unknown PMIC.
- Try to keep the messages concise, as the large string size in these
  files was causing the firmware to spill into the next page.
- Downgrade the banner from NOTICE to INFO. It's purely informational,
  and people should be using debug builds on untested hardware anyway.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ib909408a5fdaebe05470fbce48d245dd0bf040eb
2019-12-13 19:20:36 -06:00
Samuel Holland c0e109f2fe allwinner: Synchronize PMIC enumerations
Ensure that the default (zero) value represents the case where we take
no action. Previously, if a PLAT=sun50i_a64 build was booted on an
unknown SoC ID, it would be treated as an H5 at shutdown.

This removes some duplicate code and fixes error propagation on H6.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I4e51d8a43a56eccb0d8088593cb9908e52e782bc
2019-12-13 19:20:36 -06:00
Samuel Holland eb75518d98 allwinner: Enable clock before resetting I2C/RSB
The clock must be running for the module to be reset.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ic8fafc946f3a1a697174b91288e357ffa033ab9a
2019-12-13 19:20:36 -06:00
Joshua Watt 39a97dce61 rockchip: Prevent macro expansion in paths
Instead of stringizing the paths to binary files, add them as string
defines on the command line (e.g. -DFOO=\"BAR\" instead of -DFOO=BAR).
This prevents macros from being expanded inside the string value itself.
For example, -DFOO=/path/with-linux-in-it would have been expanded to
"/path/with-1-in-it" because `linux=1` is one of the standard GCC
defines.

Change-Id: I7b65df3c9930faed4f1aff75ad726982ae3671e6
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2019-12-13 14:13:45 -06:00
Soby Mathew 1a433965af Merge "allwinner: Fix incorrect ARISC code patch offset check" into integration 2019-12-13 17:20:04 +00:00
Olivier Deprez 2bcc672f34 Merge changes from topic "aa/sel2_support" into integration
* changes:
  S-EL2 Support: Check for AArch64
  Add support for enabling S-EL2
2019-12-13 16:26:32 +00:00
Sandrine Bailleux 49c71a36c1 Merge "allwinner: power: Add DLDO4 power rail" into integration 2019-12-13 08:47:28 +00:00
Sandrine Bailleux a47f60f609 Merge "intel: s10: Remove unused source code" into integration 2019-12-13 07:20:50 +00:00
Ziyuan Xu f0063ef948 plat/rockchip: cliam a macro to enable hdcp feature for DP
HDCP is using a binary driver, add macro PLAT_RK_DP_HDCP to make it as
an option.

Change-Id: I54ef1a3635a28e8ae56654bd1e91dfe011520a7f
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-13 09:47:58 +08:00
Justin Chadwell 8cca5a79f1 Remove -Wmissing-declarations warning from WARNING1 level
A function declaration declares the name of the function and the type of
the parameter it returns. A function prototype is a function declaration
that also specifies the type of the arguments of the function. Essentially,
a function prototype helps the compiler ensure whether the function call
matches the return type and the right number/type of arguments of function.
A function prototype itself serves as a function declaration for new style
functions.
The warning flag -wmissing-prototype is good enough to check for missing
function prototype and is exhaustive compared to -wmissing-declaration,
therefore  making the later redundant.

Note that, at this point, these flags are part of WARNING1 which is not
used for TF-A build by default. Several platforms use upstream libraries
(such as zlib etc) which are in old style c code. After the TF-A build
process is restructred using CMake framework, we plan to enable WARNING1,
WARNING2 and WARNING3 incrementally as the new build platform can compile
each BL binary of a particular platform with set of  unique compilation
flags.

Change-Id: I9c6bf9da74e0840e4d2624bc12376e199953c213
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
2019-12-12 19:33:46 -06:00
Sandrine Bailleux 4987435196 Merge changes from topic "enable-tegra194-compilation" into integration
* changes:
  docs: tegra: add support for Tegra194 class of SoCs
  Tegra194: smmu: add support for backup multiple smmu regs
  Tegra194: introduce tegra_mc_def.h
  Tegra194: 40-bit wide memory address space
  Tegra194: psci: rename 'percpu_data' variable
2019-12-12 14:32:42 +00:00
Soby Mathew 7999904074 Merge "PIE: make call to GDT relocation fixup generalized" into integration 2019-12-12 14:25:47 +00:00
Manish Pandey da90359b78 PIE: make call to GDT relocation fixup generalized
When a Firmware is complied as Position Independent Executable it needs
to request GDT fixup by passing size of the memory region to
el3_entrypoint_common macro.
The Global descriptor table fixup will be done early on during cold boot
process of primary core.

Currently only BL31 supports PIE, but in future when BL2_AT_EL3 will be
compiled as PIE, it can simply pass fixup size to the common el3
entrypoint macro to fixup GDT.

The reason for this patch was to overcome the bug introduced by SHA
330ead806 which called fixup routine for each core causing
re-initializing of global pointers thus overwriting any changes
done by the previous core.

Change-Id: I55c792cc3ea9e7eef34c2e4653afd04572c4f055
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
2019-12-12 14:16:14 +00:00
Hadi Asyrafi 0d1b704ad8 intel: s10: Remove unused source code
remove plat_sip_svc.c and plat_psci.c in stratix 10 platform directory
as both has been refactored to common directory for sharing with agilex
platform

Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I395fed66408f536e8fefd637681e742c63621818
2019-12-12 10:46:15 +08:00
Gilad Ben-Yossef b8622922c8 cryptocell: add cryptocell 712 RSA 3K support
Add the support needed to enable using CryptoCell integration with
with RSA 3K support.

Signed-off-by: Gilad Ben-Yossef <gilad.benyossef@arm.com>
Change-Id: I95527cb0c41ae012109e8968dd20a4ae9fe67f17
2019-12-11 14:18:18 +02:00
Alexei Fedorov fcccd358e4 Merge "libc: add memrchr" into integration 2019-12-11 10:14:13 +00:00
Ambroise Vincent ebff107268 libc: add memrchr
This function scans a string backwards from the end for the first
instance of a character.

Change-Id: I46b21573ed25a0ff222eac340e1e1fb93b040763
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-12-11 08:51:26 +01:00
Ambroise Vincent d01969118f arm: gicv3: Fix compiler dependent behavior
C99 standard: "What constitutes an access to an object that has
volatile-qualified type is implementation-defined".

GCC is not considering the cast to void of volatile structures as an
access and so is not actually issuing reads.

Clang does read those structures by copying them on the stack, which in
this case creates an overflow because of their large size.

This patch removes the cast to void and instead uses the USED attribute
to tell the compiler to retain the static variables.

Change-Id: I952b5056e3f6e91841e7ef9558434352710ab80d
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
	       Zelalem Aweke <zelalem.aweke@arm.com>
2019-12-10 15:53:44 -06:00