Commit graph

14039 commits

Author SHA1 Message Date
Chris Kay
7e38758925 build: prefer gcc-ar over ar
The `gcc-ar` wrapper exists to make it easier to support LTO on some
versions of GCC. The two commands are compatible, accepting exactly the
same arguments, so this change moves us to `gcc-ar` to ensure that we
are configuring LTO correctly.

Change-Id: I24a4cfaad29d35b09f847299081f83ca9b41aa8a
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Chris Kay
86e489c190 build: add --no-warn-rwx-segments when linking with GCC
This flag is currently not included when linking with BFD via GCC.
Without it, builds can fail when linking via GCC.

Change-Id: Id37e05f6fb4eea4620861eb1bc8668c41f21ba20
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Chris Kay
7fc4d77808 build: always use the C compiler to assemble
The ROM library is the only component in the repository that compiles
assembly files using the assembler directly. This change migrates it to
the C compiler instead, like the rest of the project.

Change-Id: I6c50660eeb9be2ca8dcb0e626c37c197466b0fa1
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Chris Kay
781cb31439 build: always use the C compiler to preprocess
We're a bit inconsistent about which tool we use to preprocess source
files; in some places we use `$(CC) -E` whilst in others we use `cpp`.

This change forces all invocations of the C preprocessor to use the
first scheme, which ensures that the preprocessor behaves the same way
as the C compiler used when compiling C source files.

Change-Id: Iede2f25ff86ea8b43d7a523e32648058d5023832
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Chris Kay
e068a7ca86 fix(rcar): fix implicit rule invocations in tools
The `rzg_layout_create` and `rcar_layout_create` tools have a rule to
build object files from C files, but it depends on object files in the
parent directory when it should depend on object files in the current
directory. Consequently, the rule is not triggering and the implicit C
compilation rule is executed instead. This rule works, so I have
replaced the broken rule with exactly the same command as what the
implicit rule is executing and fixed the dependency.

Change-Id: Ib8d640361adff8c4d660738dda230e5536bec629
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Manish V Badarkhe
2c5c394fe7 Merge "refactor(juno): move plat_def_uuid_config to fiptool" into integration 2024-01-18 14:55:11 +01:00
Yann Gautier
a6462e05cf feat(memmap): add RELA section display
When PIE is enabled, it can be handy to display the .rela.dyn section.
Add RELA in the list of symbols parsed, to display this section in
memory map.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ic40da54ce6fb6e281fb1a6627e9b8830993cfb2c
2024-01-18 14:02:18 +01:00
Manish V Badarkhe
4377ad81ab Merge "fix(memmap): fix memory map dump when SEPARATE_CODE_AND_RODATA=0" into integration 2024-01-18 13:54:22 +01:00
Manish Pandey
22d79f2c7f Merge changes from topic "tl_bl31_bl32" into integration
* changes:
  feat(qemu): enable transfer list to BL31/32
  feat(optee): enable transfer list in opteed
2024-01-18 12:29:53 +01:00
Yann Gautier
88528f5577 feat(stm32mp2-fdts): add board ID OTP in STM32MP257F-EV1
Ad the board ID OTP node for the STM32MP257F-EV1 board.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I394b27f50a8f45c919a1e907e03572b25d958ae4
2024-01-18 11:32:10 +01:00
Yann Gautier
c238a46a76 feat(stm32mp2-fdts): add OTP nodes in STM32MP251 SoC DT file
Add the BSEC node in STM32MP25 device tree file, with the OTP fuses
that will be used by TF-A.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I1ffdbd17829f4adf7b113ae0bec7547a6d1b4bac
2024-01-18 11:32:10 +01:00
Yann Gautier
cb0d6b5b5f fix(stm32mp2): add missing include
Without #include <plat/common/platform.h>, we have the following warning
with sparse:
plat/st/stm32mp2/bl2_plat_setup.c:15:6: warning: symbol
 'bl2_el3_early_platform_setup' was not declared. Should it be static?
plat/st/stm32mp2/bl2_plat_setup.c:23:6: warning: symbol
 'bl2_platform_setup' was not declared. Should it be static?
plat/st/stm32mp2/bl2_plat_setup.c:27:6: warning: symbol
 'bl2_el3_plat_arch_setup' was not declared. Should it be static?

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I18f9265c1eef1f8e8e0eac3d6c37a959e5c9e8b6
2024-01-18 11:32:10 +01:00
Yann Gautier
3007c72844 feat(st): do not directly call BSEC functions in common code
When STM32MP2 boots on Cortex-M33, the Cortex-A35 do no more have access
to BSEC peripheral. New static inline stm32_otp_* wrappers are added,
which just redirect to BSEC functions.

While at it remove a useless bsec.h include.

Change-Id: Ie0f917c02e48acf456634f455dae41805bf6adbf
Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
2024-01-18 11:30:42 +01:00
Yann Gautier
189db9486d feat(st): use stm32_get_otp_value_from_idx() in BL31
The shadowing of the OTP is done in BL2.
As for BL32 on AARCH32 systems, stm32_get_otp_value_from_idx()
should also use bsec_read_otp() in BL31.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Ib406cfc154339e6d3cde3c925bc6e9416d77b689
2024-01-18 11:30:42 +01:00
Yann Gautier
9cd784db55 refactor(st): update test for closed chip
The function stm32mp_is_closed_device() is replaced with
stm32mp_check_closed_device(), which return an uint32_t, either
STM32MP_CHIP_SEC_OPEN or STM32MP_CHIP_SEC_CLOSED.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Ie0790cdc36c4b6522083bc1f0e7c38e8061e6adf
2024-01-18 11:30:42 +01:00
Patrick Delaunay
c706104507 refactor(st-bsec): improve BSEC driver
In order to ease the introduction of a new BSEC3 driver for STM32MP25,
the BSEC2 driver is reworked. Unused functions are removed. The
bsec_base global variable is removed in favor of the macro BSEC_BASE.
A rework is also done around function checking the state of BSEC.

Change-Id: I1ad76cb67333ab9a8fa1d65db34d74a712bf1190
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2024-01-18 11:30:42 +01:00
Yann Gautier
b8816d3cbd refactor(st): use dashes for BSEC node names
This is something commonly asked by Linux kernel DT maintainers [1].
The mentioned doc is not upstreamed, but may be checked with dtbs_check.
While at it align some nodes with Linux or OP-TEE.

[1] https://lore.kernel.org/linux-arm-kernel/20231125184422.12315-1-krzysztof.kozlowski@linaro.org/

Change-Id: I63e983c2a00eda3cd8b81c66c0cd1a97cf8249b7
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2024-01-18 11:30:42 +01:00
Sekhar Nori
6dc8ee61ff fix(memmap): fix memory map dump when SEPARATE_CODE_AND_RODATA=0
When building BL1 with SEPARATE_CODE_AND_RODATA=0, symbol names
__RO_{START|END}__ are ignored by memory map dump script.

Fix it by including the symbol in regular expression.

While at it, update the copyright year to current.

Change-Id: Iafeab75c5711429ea0b744510caf27dd8784a29a
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2024-01-18 13:02:53 +05:30
Bipin Ravi
68cac6a0f2 fix(cpus): workaround for Cortex-A78C erratum 2683027
Cortex-A78C erratum 2683027 is a cat B erratum that applies to
revisions r0p1 - r0p2 and is still open. The workaround is to
execute a specific code sequence in EL3 during reset.

SDEN can be found here:
https://developer.arm.com/documentation/SDEN-2004089/latest

Change-Id: I2bf9e675f48b62b4cd203100f7df40f4846aafa8
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-01-17 14:28:04 -06:00
Bipin Ravi
a65c5ba351 fix(cpus): workaround for Cortex-X3 erratum 2266875
Cortex-X3 erratum 2266875 is a Cat B erratum that applies to
all revisions <= r1p0 and is fixed in r1p1. The workaround is to
set CPUACTLR_EL1[22]=1 which will cause the CFP instruction to
invalidate all branch predictor resources regardless of context.

SDEN Documentation:
https://developer.arm.com/documentation/2055130/latest

Change-Id: I9c610777e222f57f520d223bb03fc5ad05af1077
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-01-17 14:27:08 -06:00
Bipin Ravi
3f9df2c6ad fix(cpus): workaround for Cortex-X3 erratum 2302506
Cortex-X3 erratum 2302506 is a cat B erratum that applies to
revisions r0p0-r1p1 and is fixed in r1p2. The workaround is to
set bit[0] of CPUACTLR2 which will force PLDW/PFRM ST to behave
like PLD/PRFM LD and not cause invalidation to other PE caches.

There might be a small performance degradation to this workaround
for certain workloads that share data.

SDEN can be found here:
https://developer.arm.com/documentation/2055130/latest

Change-Id: I048b830867915b88afa36582c6da05734a56d22a
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-01-17 14:22:21 -06:00
Raymond Mao
305825b490 feat(qemu): enable transfer list to BL31/32
Enable handoff to BL31 and BL32 using transfer list.
Encode TL_TAG_OPTEE_PAGABLE_PART as transfer entry.
Fallback to default handoff args when transfer list is disabled or
fails to archieve args from transfer entries.
Refactor handoff from BL2 to BL33.
Minor fixes of comment style.

Change-Id: I55d92ca7f5c4727bacc9725a7216c0ac70d16aec
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
2024-01-17 12:21:39 -08:00
Raymond Mao
0e8def996e feat(optee): enable transfer list in opteed
Enable handoff to OP-TEE using transfer list.
Create transfer list when loading OP-TEE image via non-secure SMC call.
Fallback to default handoff args when transfer list is disabled or
transfer list signature does not exist.

Change-Id: I94bb5b7fdfbb8829016a9d5d9ef5aff993d7cc99
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
2024-01-17 12:18:09 -08:00
Madhukar Pappireddy
436c66b32a Merge "fix(ti): do not stop non-secure timer on world switch" into integration 2024-01-17 21:03:20 +01:00
J-Alves
6a3225e227 fix(spm): silence warning in sp_mk_generator
Silence warning from sp_mk_generator that 'is not' operator
is not meant for integers. This replaces the referred instance
with '!='.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I0d31ad65466dbeafebbfc929e506c3e290913aca
2024-01-17 09:15:28 +00:00
Manish Pandey
a28fac0bce Merge changes from topic "st-asm-helpers" into integration
* changes:
  feat(stm32mp2): put back core 1 in wfi after debugger's halt
  feat(stm32mp2): add plat_my_core_pos
  fix(stm32mp2): correct early/crash console init
2024-01-16 16:51:31 +01:00
Madhukar Pappireddy
fc9ad8c42b Merge "feat(el3-spmc): add support for FFA_CONSOLE_LOG" into integration 2024-01-16 16:50:40 +01:00
Shruti Gupta
638a6f8e04 feat(el3-spmc): add support for FFA_CONSOLE_LOG
Add support for FFA_CONSOLE_LOG in EL3 SPMC,
Disallow forwarding FFA_CONSOLE_LOG across worlds.
Add support for FFA_CONSOLE_LOG in FFA_FEATURES.

Input parameters:
w0/x0 - FFA_CONSOLE_LOG_32/64
w1/x1 - Character count
w2/x2-w7/x7 - 24 or 48 characters depending upon whether a SMC32 or
SMC64 FID was used.

Output parameters in case of success:
w0/x0 - FFA_SUCCESS

Output parameters in case of error:
w0/x0 - FFA_ERROR
w2/x2 - NOT_SUPPORTED: ABI is not implemented
        INVALID_PARAMETERS: Parameters are incorrectly encoded

Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: I004c043729e77d1b9aa396c42d25c73d9268169a
2024-01-16 14:04:29 +00:00
Sandrine Bailleux
23d6774ab5 Merge "feat(qemu-sbsa): mpidr needs to be present" into integration 2024-01-16 09:47:43 +01:00
Mahesh Rao
6cbe2c5d19 feat(intel): enable query of fip offset on RSU
Enable query of fip offset from QSPI on RSU boot for
Intel agilex and intel agilex5 platform

Change-Id: Iaa189c54723a8656b9691da5849fd86b9986cfa1
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2024-01-16 13:26:35 +08:00
Mahesh Rao
62be2a1ae3 feat(intel): support query of fip offset using RSU
Query the fip binary from SPT table on RSU boot on Intel Agilex series.

Change-Id: I8856b49539f33272625d4c0a8c26b81b5864c4eb
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2024-01-16 13:26:21 +08:00
Akshay Belsare
6a80c20eff fix(xilinx): deprecate SiP service count query
As per SMCCC Section 6.2, the call count query for all the services
has been deprecated from SMCCC v1.2 onwards.

Inline with above change, AMD-Xilinx SiP service count query has
been deprecated and now onwards will return unknown function
identifier error.

Change-Id: I296d119d65549fdb01718d08351d255550e4ead0
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2024-01-16 06:21:58 +01:00
Marcin Juszkiewicz
4fc54c99d0 feat(qemu-sbsa): mpidr needs to be present
Coverity Scan reminded that we need to take care of MPIDR properly.
We need to make sure that we get MPIDR values from QEMU.

No MPIDR == panic() in case which should not happen.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Change-Id: Idb5fe7d958f0bcecd3d66a643743f478538f4a8b
2024-01-15 17:05:09 +01:00
Manish V Badarkhe
a4fab36d51 Merge "fix(spm): not defining load-address in SP config" into integration 2024-01-15 17:00:01 +01:00
Michael Trimarchi
6611e81e14 fix(rockchip): fix documentation in how build bl31 in AARCH64
Rockchip Aarch64 SoCs expect TF-A's BL31

Change-Id: Ie74be32e2bd24c4de38990791b4a03d2b7695b4d
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-01-15 11:25:58 +01:00
Manish V Badarkhe
34bb883a56 docs(threat-model): provide PSR specification reference
Added an assumption in generic threat model that platform's hardware
conforms the Platform Security Requirements specification.

Change-Id: I753287feec1cd459edfd3d1c103e0e701827cc05
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2024-01-13 08:04:03 +00:00
Andrew Davis
d2e1f6a881 fix(ti): do not stop non-secure timer on world switch
As stated in the commit introducing the NS_TIMER_SWITCH build flag,
saving/restoring this registers causes the non-secure timer to stop
while in the secure world and non-secure timer interrupts are prevented
from asserting until we return to the non-secure world. This breaks
any realtime OS on the non-secure side that uses this timer for
realtime scheduling.

This flag is by default off, but OP-TEE SPD enables it. The K3 OP-TEE
platform makes no use of these registers and we would like to have
support for realtime OSs while also supporting the OP-TEE SPD. Disable
this flag in our platform definition.

Signed-off-by: Andrew Davis <afd@ti.com>
Change-Id: I65055512d897b93b7690fd63c734f4731a6e09e6
2024-01-12 10:12:06 -06:00
Antonio Borneo
2331a34f78 feat(stm32mp2): put back core 1 in wfi after debugger's halt
The core 1 is put in wfi for pen holding. If a debugger halts the
core, it causes the core to exit from wfi.

Let the core to jump back in wfi when the debugger resumes the
core's execution.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Change-Id: I9b5607b05cdcde905dc4047af8d6f1292d53d701
2024-01-12 17:04:38 +01:00
Yann Gautier
d1c85da8ef feat(stm32mp2): add plat_my_core_pos
This function is required, at least for bakery locks.

Change-Id: I28906c50e0a0ebff5d387a424247513ec1a599fc
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2024-01-12 17:04:30 +01:00
Yann Gautier
4da462dcdc fix(stm32mp2): correct early/crash console init
The former code, using x2 register, was removing the LPEN bit from UART
config register. So the UART clock is stopped as soon as the CA35 is in
CSleep. It was then displaying crap in Linux console.
The ands check instruction is replaced with a clearer tst instruction
directly with the bit to be tested.

Change-Id: I8a2b3ab195981dee2962e0c2f5d501d5933c17f4
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2024-01-12 17:04:07 +01:00
Sandrine Bailleux
e12b765e28 Merge "fix(memmap): fix footprint free space calculation" into integration 2024-01-12 12:40:00 +01:00
Harrison Mutai
9e72d01ed2 fix(memmap): fix footprint free space calculation
Calculate the free space as the range between the
limit and the end of the memory region *_REGION_END.

Change-Id: I9cacadea2543c9f5ddaebca82344a83678cd7d55
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-01-12 10:27:22 +00:00
Sandrine Bailleux
01e0f09095 Merge changes from topic "drop-dt-from-edk2/cpu" into integration
* changes:
  docs(qemu-sbsa): describe what we get from QEMU
  feat(qemu-sbsa): handle CPU information
2024-01-12 11:22:08 +01:00
J-Alves
04e7f80823 fix(spm): not defining load-address in SP config
The FF-A specification has made it such that SPs
may optionally specify their load address in the manifest.

This info was being retrieved to generate some information
for the SPMC manifest. However, it is not a mandatory utility.

This change relaxes the case in which the SP manifest doesn't
have a load address.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ic4c1b1ec6666522900c113903be45ba0eb5d0bf6
2024-01-11 17:31:59 +00:00
Marcin Juszkiewicz
9b07643618 docs(qemu-sbsa): describe what we get from QEMU
QEMU provides us with minimal information about hardware platform using
minimalistic DeviceTree. This is not a Linux DeviceTree. It is not even
a firmware DeviceTree.

Change-Id: I7b6cc5f53a4f78a9ed69bc7fc2fa1a69ea65428d
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2024-01-11 10:17:38 +01:00
Marcin Juszkiewicz
42925c15be feat(qemu-sbsa): handle CPU information
We want to remove use of DeviceTree from EDK2. So we move
functions to TF-A:

- counting cpu cores
- checking NUMA node id
- checking MPIDR

And then it gets passed to EDK2 via SMC calls.

Change-Id: I1c7fc234ba90ba32433b6e4aa2cf127f26da00fd
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2024-01-11 10:17:38 +01:00
Manish Pandey
eefa45cfaf Merge "fix(context-mgmt): align the memory address of EL2 context registers" into integration 2024-01-10 21:52:52 +01:00
Madhukar Pappireddy
32455d9073 Merge "feat(imx8m): make bl33 start configurable via PRELOADED_BL33_BASE" into integration 2024-01-10 17:26:13 +01:00
Sandrine Bailleux
07edc5cfc7 Merge "feat(intel): support wipe DDR after calibration" into integration 2024-01-10 14:49:27 +01:00
Sandrine Bailleux
3bfda6b588 Merge "fix(intel): update from INFO to VERBOSE when print debug message" into integration 2024-01-10 14:45:59 +01:00