Commit graph

11784 commits

Author SHA1 Message Date
Andre Przywara
1ae75529bc feat(fvp): emulate trapped RNDR
When a platform decides to use FEAT_RNG_TRAP, every RNDR or RNDRSS read
will trap into EL3. The platform can then emulate those instructions, by
either executing the real CPU instructions, potentially conditioning the
results, or use rate-limiting or filtering to protect the hardware
entropy pool. Another possiblitiy would be to use some platform specific
TRNG device to get entropy and returning this.

To demonstrate platform specific usage, add a demo implementation for the
FVP: It will execute the actual CPU instruction and just return the
result. This should serve as reference code to implement platform specific
policies.

We change the definition of read_rndr() and read_rndrrs() to use the
alternative sysreg encoding, so that all assemblers can handle that.

Add documentation about the new platform specific RNG handler function.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Change-Id: Ibce817b3b06ad20129d15531b81402e3cc3e9a9e
2022-12-21 12:59:36 +00:00
Andre Przywara
ccd81f1e09 feat(el3-runtime): introduce system register trap handler
At the moment we only handle SMC traps from lower ELs, but ignore any
other synchronous traps and just panic.
To cope with system register traps, which we might need to emulate,
introduce a C function to handle those traps, and wire that up in the
exception handler to be called.

We provide a dispatcher function (in C), that will call platform
specific implementation for certain (classes of) system registers.
For now this is empty.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Change-Id: If147bcb49472eb02791498700300926afbcf75ff
2022-12-21 10:25:25 +00:00
Olivier Deprez
f4d8ed50d2 Merge "fix(el3-spmc): report execution state in partition info get" into integration 2022-12-20 17:30:16 +01:00
Sandrine Bailleux
15a6c959de Merge "feat(tc): add delegated attest and measurement tests" into integration 2022-12-20 15:58:06 +01:00
Manish Pandey
01617e0bee Merge "fix(gic): wrap cache enabled assert under plat_can_cmo" into integration 2022-12-19 11:44:45 +01:00
Sandrine Bailleux
ff4a2c17eb Merge "fix(intel): add mailbox error return status for FCS_DECRYPTION" into integration 2022-12-19 08:37:23 +01:00
Manish V Badarkhe
6952ce49c2 Merge "fix(arm): arm_rotpk_header undefined reference" into integration 2022-12-17 11:44:21 +01:00
laurenw-arm
95302e4b23 fix(arm): arm_rotpk_header undefined reference
Moving ARM_ROTPK_S to default to arm_dev_rotpk.S as it was not being
set for Juno cryptocell and this should be the value in most cases.

Change-Id: I56a5a4e61f1ca728b87322b0b09a0d73ed1d5ee0
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2022-12-16 17:17:20 +00:00
Mate Toth-Pal
25dd2172ae feat(tc): add delegated attest and measurement tests
This patch adds Delegated Attestation and Measured Boot tests to the
plat/arm/board/tc platform.
The test suite can be activated by adding the build time option
`PLATFORM_TEST=1` to the make command. In this case the boot sequence is
not finished, plat_error_handler is called after the tests are run
(regardless of the test result.)

The actual test code is coming from the Trusted-Firmware-M project. Some
of the files of the tf-m-tests and tf-m-extras repo are linked to the
BL31 image.

Versions used for testing:
https://git.trustedfirmware.org/TF-M/tf-m-tests
    614e8c358377e4146e8ee13d1246e59d01b4bf1b

https: //git.trustedfirmware.org/TF-M/tf-m-extras
    3be9fdd557e6df449de93c2101973fb011699b3d

Change-Id: I98f0f5f760a39d2d7e0dd11d33663ddb75f0b6fc
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2022-12-16 17:15:57 +01:00
Joanna Farley
7b77bd0d1f Merge "fix(xilinx): resolve integer handling issue" into integration 2022-12-16 16:59:44 +01:00
Sandrine Bailleux
bba0e7ebd6 Merge "fix(intel): missing NCORE CCU snoop filter fix in BL2" into integration 2022-12-16 15:37:07 +01:00
Akshay Belsare
4e46db40fc fix(xilinx): resolve integer handling issue
OEN Number 48 to 63 is for Trusted App and OS.
GET_SMC_OEN limits the return value of OEN number to 63 by bitwise AND
operation with 0x3F. Thus the upper limit check for OEN value returned
by GET_SMC_OEN is not required.
Removing the upper limit check for the OEN value returned by GET_SMC_OEN
resolves integer handling issue CONSTANT_EXPRESSION_RESULT

Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
Change-Id: Ie04a4e2fb7cc85ec6055a5662736a805a89f7085
2022-12-16 17:43:43 +05:30
Bipin Ravi
309b18bdc9 Merge changes Ibb593369,I9cc984dd into integration
* changes:
  fix(el3_runtime): allow SErrors when executing in EL3
  fix(el3_runtime): do not save scr_el3 during EL3 entry
2022-12-15 16:51:32 +01:00
Madhukar Pappireddy
79664cfcf9 Merge changes I2b23e7c8,I779587af,Ic46de7a4,If753e987,I00171b05, ... into integration
* changes:
  fix(layerscape): unlock write access SMMU_CBn_ACTLR
  fix(nxp-ddr): add checking return value
  feat(lx2): enable OCRAM ECC
  fix(nxp-tools): fix coverity issue
  fix(nxp-ddr): fix coverity issue
  fix(nxp-ddr): fix underrun coverity issue
  fix(nxp-drivers): fix sd secure boot failure
  feat(lx2): support more variants
  fix(lx2): init global data before using it
  fix(ls1046a): 4 keys secureboot failure resolved
  fix(nxp-crypto): fix secure boot assert inclusion
  fix(nxp-crypto): fix coverity issue
  fix(nxp-drivers): fix fspi coverity issue
  fix(nxp-drivers): fix tzc380 memory regions config
  fix(layerscape): fix nv_storage assert checking
  fix(nxp-ddr): apply Max CDD values for warm boot
  fix(nxp-ddr): use CDDWW for write to read delay
  fix(layerscape): fix errata a008850
2022-12-15 16:38:07 +01:00
Soby Mathew
bc1123fab8 Merge "fix(gpt_rme): fix compilation error for gpt_rme.c" into integration 2022-12-15 15:52:42 +01:00
Olivier Deprez
6d4f4c3e39 Merge changes from topic "qemu_sel2" into integration
* changes:
  docs(build): describes the SPMC_OPTEE build option
  feat(qemu): support el3 spmc
  feat(el3-spmc): make platform logical partition optional
  feat(qemu): support s-el2 spmc
  feat(qemu): update abi between spmd and spmc
  fix(sptool): add dependency to SP image
2022-12-15 14:25:16 +01:00
Sieu Mun Tang
76ed32236a fix(intel): add mailbox error return status for FCS_DECRYPTION
Add 2 more mailbox error return status for FCS_DECRYPTION when sending
mailbox command to SDM

Signed-off-by: Sieu Mun Tang <sieu.mun.tang@intel.com>
Change-Id: Ifff4faa397232cc0080f9fca6f6948ac305915c4
2022-12-15 12:28:23 +08:00
Jit Loon Lim
b34a48c1ce fix(intel): missing NCORE CCU snoop filter fix in BL2
Clear Ncore CCU snoop filter. There is hardware bug in NCORE CCU IP
and it is causing an issue in the coherent directory tracking of
outstanding cache lines.

Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
Change-Id: I9ee67c94e6379d318516ae8f660a62323ce8d563
2022-12-15 12:27:17 +08:00
Madhukar Pappireddy
19e09e27f6 Merge changes Ib02688f7,If17fe04d into integration
* changes:
  fix(cpus): workaround for Cortex-X2 erratum 2768515
  fix(cpus): workaround for Cortex-A710 erratum 2768515
2022-12-14 17:44:00 +01:00
Jens Wiklander
bb0e33602d docs(build): describes the SPMC_OPTEE build option
Explains that the SPMC_OPTEE build option is used to load the SPMC at
S-EL1 using an OP-TEE specific mechanism.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I71757d2d9ac98caf0ac6d8e64b221adaa0f70846
2022-12-14 17:06:31 +01:00
Manish Pandey
1cbe42a510 fix(el3_runtime): allow SErrors when executing in EL3
SCR_EL3.EA is set to 1 in BL31 initialization and is cleared before
entering to lower ELs(except for RAS FFH case "HANDLE_EA_EL3_FIRST_NS").
The cleared value persist even during run time when execution comes
back to EL3.

When SCR_EL3.EA is 0 and execution state is EL3, Async EAs(delivered
as SErrors) are implicitly masked and hence any Async EA by EL3 will
remain pending and will trap at the exception level EA is targeted
to and unmasked when entering lower EL.
This causes unexpected EA at lower EL. This is a very rare
to get SError in EL3 until unless there is any programming error.

This patch sets SCR_EL3.EA to 1 when entering EL3 from lower EL.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ibb593369edb034f670fd85ee79adc9829b900a83
2022-12-14 15:47:34 +01:00
Manish Pandey
e61713b007 fix(el3_runtime): do not save scr_el3 during EL3 entry
scr_el3 registers cannot be modified in lower ELs which means it retains
the same value which is stored in the EL3 cpu context structure for the
given world. So, we should not save the register when entering to EL3
from lower EL as we have the copy of it present in cpu context.

During EL3 execution SCR_EL3 value can be modifed for following cases
 1. Changes which is required for EL3 execution, this change is temp
    and do not need to be saved.
 2. Changes which affects lower EL execution, these changes need to be
    written to cpu context as well and will be retrieved when scr_el3
    is restored as part of exiting EL3

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I9cc984ddf50e27d09e361bd83b1b3c9f068cf2fd
2022-12-14 14:44:43 +00:00
Olivier Deprez
4e025c6326 Merge changes from topic "ffa_el3_spmc_fixes" into integration
* changes:
  fix(tsp): use verbose for power logs
  fix(el3-spmc): fix coverity scan warnings
  fix(el3-spmc): improve bound check for descriptor
2022-12-13 18:53:57 +01:00
Madhukar Pappireddy
8b1d186a58 Merge changes Ie6a13e4a,I517074b8,Ifd29b748,I1279d9cb,I3b78e0c5, ... into integration
* changes:
  feat(imx8mq): add BL31 PIE support
  refactor(imx8mq): introduce BL31_SIZE
  refactor(imx8mq): make use of setup_page_tables()
  feat(imx8mq): always set up console
  feat(imx8mq): remove empty bl31_plat_runtime_setup
  feat(imx8mq): make IMX_BOOT_UART_BASE configurable via build parameter
2022-12-13 15:13:48 +01:00
Lucas Stach
8cfa94b7a7 feat(imx8mq): add BL31 PIE support
Enable PIE support so the BL31 firmware can be loaded from anywhere
within the OCRAM (SRAM). For the PIE support we only need to replace
the BL31_BASE define by the BL31_START symbol which is a relocatable
and we need to enable it by setting ENABLE_PIE := 1.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: Ie6a13e4ae0fdc6627a94798d7a86df7d5b310896
2022-12-13 11:08:42 +01:00
Lucas Stach
0445a4ab1f refactor(imx8mq): introduce BL31_SIZE
No functional change.

Introduce BL31_SIZE define and calculate the limits based on the
BL31_BASE and the BL31_SIZE define. Also make use of SZ_64K to make
it easier to read. This is required for later BL31 PIE support since
it drops the calculation based on the BL31_LIMIT and BL31_BASE.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: I517074b866b5bf11841b51777f87c926b304488d
2022-12-13 11:08:42 +01:00
Lucas Stach
c0fb887433 refactor(imx8mq): make use of setup_page_tables()
Improve code readability and align with other i.MX8M* platforms.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: Ifd29b74872e3a567288d208de4827403078164e9
2022-12-13 11:08:42 +01:00
Lucas Stach
36be10861e feat(imx8mq): always set up console
This aligns the i.MX8MQ platform behaviour with the other i.MX8M*
platforms by always setting up the console UART.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: I1279d9cb4feb6e789422b9844cab711b8daae74e
2022-12-13 11:08:37 +01:00
Lucas Stach
7698dbab96 feat(imx8mq): remove empty bl31_plat_runtime_setup
Having this empty definition is actively harmful, as it prevents the
default weak function to be used, which does a switch of the console
state.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: I3b78e0c524c4907714036dba573a44d8f9c48b09
2022-12-13 11:08:33 +01:00
Lucas Stach
202737efda feat(imx8mq): make IMX_BOOT_UART_BASE configurable via build parameter
This aligns the i.MX8MQ build with the other i.MX8M platforms by
allowing to override the default IMX_BOOT_UART_BASE value via a make
parameter.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: Iad9b844517209fc7d051c61767f71ac9fa2b55c7
2022-12-13 11:07:02 +01:00
Lauren Wehrmeister
abd6d7ea60 Merge changes from topic "full_dev_rsa_key" into integration
* changes:
  docs(arm): add ARM_ROTPK_LOCATION variant full key
  feat(arm): add ARM_ROTPK_LOCATION variant full key
2022-12-12 22:18:26 +01:00
Channagoud kadabi
78fbb0ec83 fix(gic): wrap cache enabled assert under plat_can_cmo
with reference to feature 04c730 (feat(cpus): make cache ops conditional),
booting with caches in debug recovery means SCTLR_C_BIT will be 0.
Wrap the assert for the d-cache enabled check in CONDITIONAL_CMO and
plat_can_cmo calls to allow booting with d-cache disabled.

Signed-off-by: Channagoud kadabi <kadabi@google.com>
Change-Id: I80153df493d1ec9e5e354c7c2e6a14322d22c446
2022-12-12 20:33:40 +02:00
Manish Pandey
96851eeb8d Merge changes from topic "fix_misra_st_drivers" into integration
* changes:
  fix(st-gpio): define shift as uint32_t
  fix(st-sdmmc): check transfer size before filling register
2022-12-12 17:03:23 +01:00
Manish Pandey
c781765e09 Merge "fix(st): include utils.h to solve compilation error" into integration 2022-12-12 16:58:58 +01:00
Yann Gautier
377846b65e fix(st): include utils.h to solve compilation error
If compiling with STM32MP13 with DECRYPTION_SUPPORT != none, there is
a compilation error:
plat/st/common/stm32mp_crypto_lib.c:
 In function 'plat_get_enc_key_info':
plat/st/common/stm32mp_crypto_lib.c:532:25:
 error: implicit declaration of function 'zeromem'
 [-Werror=implicit-function-declaration]
  532 |                         zeromem(key, *key_len);
      |                         ^~~~~~~

Adding #include <lib/utils.h> solves the error.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0a20c5632f0379612149333e69875369d4cfca15
2022-12-12 15:15:38 +01:00
Joanna Farley
c0d68bbfbe Merge "fix(xilinx): use lib/smccc.h macros instead of trusty spd" into integration 2022-12-12 11:21:01 +01:00
Akshay Belsare
0ee07d796c fix(xilinx): use lib/smccc.h macros instead of trusty spd
There is no reason to use macros from trusty spd header and creating
dependency on it. Use directly macros from lib/smccc.h

Co-developed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
Change-Id: I7cf1f76a5358ffc297c914f41c437469f5a42411
2022-12-12 14:25:51 +05:30
laurenw-arm
9b1dad8bb5 docs(arm): add ARM_ROTPK_LOCATION variant full key
Updating documentation to reflect the new ARM_ROTPK_LOCATION variant of
the full ROTPK, as opposed to the hash of it.

Change-Id: I0f83c519bd607ef1270c7d30ee9bc55451ce4ae2
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2022-12-09 14:55:39 -06:00
laurenw-arm
5f899286ea feat(arm): add ARM_ROTPK_LOCATION variant full key
Add support for ARM_ROTPK_LOCATION=devel_full_dev_rsa_key, which
implements the scenario where the platform provides the full ROTPK, as
opposed to the hash of it. This returns a 2kB development RSA key
embedded into the firmware.

The motivation for this patch is to extend our test coverage in the CI.
Right now, the authentication framework allows platforms to return
either the full ROTPK or a hash of it (*). However, the FVP platform
only supports returning a hash currently so we cannot easily exercise
the full key scenario. This patch adds that capability.

(*) Or even no key at all if it's not deployed on the platform yet, as
is typically the case on pre-production/developement platforms.

Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: Ie869cca1082410e63894e2b7dea2d31155684105
2022-12-09 14:54:50 -06:00
Manish Pandey
25eb64726d Merge changes from topic "fix_misra_st_drivers" into integration
* changes:
  fix(st-clock): avoid arithmetics on pointers
  fix(st-clock): give the size for parent_mp13 and dividers_mp13 tables
  fix(st-clock): remove useless switch
  fix(st-clock): use Boolean type for tests
  fix(st-regulator): use Boolean type for tests
  fix(st-regulator): enclose macro parameters in parentheses
  fix(st-regulator): rework for_each_*rdev macros
  fix(st-regulator): explicitly check operators precedence
  fix(st-pmic): define pmic_regs table size
  fix(st-pmic): enclose macro parameter in parentheses
2022-12-09 13:04:05 +01:00
Manish Pandey
d6ce990789 Merge changes from topic "fix_misra_st_platform" into integration
* changes:
  fix(stm32mp1): rework DWL buffer cache invalidation
  fix(stm32mp1): add const for strings in stm32mp_get_soc_name()
  fix(st): use Boolean type for tests
  fix(st): rework secure-status check in fdt_get_status()
  fix(st): use indices when counting GPIOs in DT
  fix(st): add U suffix for unsigned numbers
  fix(st): explicitly check operators precedence
2022-12-09 12:54:13 +01:00
AlexeiFedorov
a0d5147b82 fix(gpt_rme): fix compilation error for gpt_rme.c
This patch fixes compilation error for gpt_init_l0_tables()
function in lib/gpt_rme/gpt_rme.c reported by GCC 13.0.0:

"gpt_rme/gpt_rme.c:765:5: error: conflicting types for
'gpt_init_l0_tables' due to enum/integer mismatch;
have 'int(unsigned int,  uintptr_t,  size_t)'
{aka 'int(unsigned int,  long unsigned int,  long unsigned int)'}"

Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I38f28be290337e7d37d59b52cad7bde5b96b8d51
2022-12-09 11:27:14 +00:00
Manish V Badarkhe
557bc9dcf3 Merge changes from topic "tonnad01/gcc_warn_fix" into integration
* changes:
  fix(scmi): change function prototype to fix gcc error
  fix(rdn1edge): change variable type to fix gcc sign conversion error
2022-12-09 12:09:57 +01:00
Sandrine Bailleux
85bc0486a9 Merge "docs: add threat model for AP-RSS interface" into integration 2022-12-09 10:15:12 +01:00
Tamas Ban
c201d6e8d1 docs: add threat model for AP-RSS interface
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: Ic818da12584503e1a96396c4b55a8db14ae7584a
2022-12-09 10:15:09 +01:00
Jens Wiklander
302f05354f feat(qemu): support el3 spmc
Introduce additional defines needed when compiling the QEMU platform
with SPMC at EL3.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: If6dbe41fa8761637e39579a1f6818dabc769c139
2022-12-08 15:40:25 +01:00
Jens Wiklander
555677fe81 feat(el3-spmc): make platform logical partition optional
Prior to this commit a logical platform specific partition is added when
compiling with SPMC at EL3. Not all platform need to add a logical
platform so make this optional.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I3bdd2a91350330c1637e8d84765974bfb6b225d7
2022-12-08 15:40:25 +01:00
Jens Wiklander
36802e2c79 feat(qemu): support s-el2 spmc
Supports S-EL2 SPMC + S-EL1 SP on qemu. S-EL1 SPs packaged in .pkg files
are added to the FIP as blob with an UUID. BL2 parses TB_FW_CONFIG to
know which SP blobs to load into memory.

Co-developed-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I4b61c4c048f31540d4f1ef9e05f0b12deb341e06
2022-12-08 15:40:03 +01:00
Jens Wiklander
25ae7ad187 feat(qemu): update abi between spmd and spmc
Updates the ABI between SPMD and the SPMC at S-EL1 so that the hard
coded SPMC manifest can be replaced by a proper manifest via TOS FW
Config. TOS FW Config is provided via QEMU_TOS_FW_CONFIG_DTS as a DTS
file when building.  The DTS is turned into a DTB which is added to the
FIP.

Note that this is an incompatible change and requires corresponding
change in OP-TEE ("core: sel1 spmc: boot abi update").

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: Ibabe78ef50a24f775492854ce5ac54e4d471e369
2022-12-08 15:18:48 +01:00
Alexei Fedorov
a0f256b033 Merge "fix(rmmd): add missing padding to RMM Boot Manifest and initialize it" into integration 2022-12-08 14:53:50 +01:00