Commit graph

3117 commits

Author SHA1 Message Date
Bipin Ravi
7b02a57213 Merge "fix(gic600): workaround for Part 1 of GIC600 erratum 2384374" into integration 2024-03-06 21:24:20 +01:00
Arvind Ram Prakash
24a4a0a5ec fix(gic600): workaround for Part 1 of GIC600 erratum 2384374
GIC600 erratum 2384374 is a Category B erratum. Part 1 is fixed
in this patch, and the Part 1 failure mode is described as
'If the packet to be sent is a SET packet, then a higher priority SET
may not be sent when it should be until an unblocking event occurs.'

This is handled by calling gicv3_apply_errata_wa_2384374() in the
ehf_deactivate_priority() path, so that when EHF restores the priority
to the original priority, the interrupt packet buffered
in the GIC can be sent.

gicv3_apply_errata_wa_2384374() is the workaround for
the Part 2 of erratum 2384374 which flush packets from the GIC buffer
and is being used in this patch.

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

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I4bb6dcf86c94125cbc574e0dc5119abe43e84731
2024-03-06 14:16:35 -06:00
Stuart Yoder
9c36b900f9 feat(drtm): update DRTM version to 1.0
Update DRTM version from 0.1 to 1.0.

Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
Change-Id: Ic37fd29e4c2de1a29c2808870addba049d488773
2024-03-05 14:24:13 -06:00
Stuart Yoder
b94d59099f feat(drtm): update references to DRTM beta0
Update all references to DRTM beta0 to be 1.0 instead.

Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
Change-Id: Ieda70f26f3be42f4705e9b267706674c94f120f2
2024-03-05 14:17:15 -06:00
Stuart Yoder
c86cfa3597 feat(drtm): for TPM features fw hash algorithm should be 16-bits
The DRTM 1.0 spec changed the Firmware hash algorithm field
size from 32-bits to 16-bits.

Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
Change-Id: I713e32e01b1983bf21d97c93bbb28c77dc94a541
2024-03-05 14:17:04 -06:00
Madhukar Pappireddy
e8eb44182d Merge "fix(el3-spmc): add datastore linker script markers" into integration 2024-03-05 19:41:02 +01:00
Sughosh Ganu
8d08a1df1e style(fwu): change the metadata fields to align with specification
Change the names of some FWU metadata structure members to have them
align with the wording used in the corresponding specification. Use
the GUID type instead of UUID as the fields described in the
specification are GUIDs. Make corresponding changes to the code that
accesses these fields. No functional changes are introduced by the
patch.

Change-Id: Id3544ed1633811b0eeee2bf99477f9b7e6667044
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:40:05 +05:30
Sughosh Ganu
37e81a603d style(partition): use GUID values for GPT partition fields
The GPT partition uses GUID values for identification of partition
types and partitions. Change the relevant functions to use GUID values
instead of UUID's.

Change-Id: I30df66a8a02fb502e04b0285f34131b65977988e
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:40:05 +05:30
Sughosh Ganu
26aab79560 feat(fwu): add a function to obtain an alternate FWU bank to boot
Add a function fwu_get_alternate_boot_bank() to return a valid bank to
boot from. This function can be called by a platform to get an
alternate bank to try to boot the platform in the unlikely scenario of
the active bank being in an invalid state, or if the number of times
the platform boots in trial state exceeds a pre-set count.

Change-Id: I4bcd88e68e334c452882255bf028e01b090369d1
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:40:05 +05:30
Sughosh Ganu
56724d09c2 feat(fwu): modify the check for getting the FWU bank's state
The version 2 of the FWU metadata structure has a field bank_state in
the top level of the structure which can be used to check if a given
bank is in the either of Trial State, Accepted State, or in an Invalid
State. This is different from the binary states of Valid/Accepted
States that the bank could be in, as defined in the earlier version of
the specification.

Replace the fwu_is_trial_run_state() API with
fwu_get_active_bank_state() to get the state the current active bank
is in. The value returned by this API is then used by the caller to
take appropriate action.

Change-Id: I764f486840a3713bfe5f8e03d0634bfe09b23590
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:19:56 +05:30
Sughosh Ganu
a89d58bb20 feat(fwu): migrate FWU metadata structure to version 2
The latest version of the FWU specification [1] has changes to the
metadata structure. This is version 2 of the structure.

Primary changes include
 - bank_state field in the top level structure
 - Total metadata size in the top level structure
 - Image description structures now optional
 - Number of banks and images per bank values part of the structure

Make changes to the structure to align with version 2 of the structure
defined in the specification. These changes also remove support for
version 1 of the metadata structure.

[1] - https://developer.arm.com/documentation/den0118/latest/

Change-Id: I84b4e742e463cae92375dde8b4603b4a581d62d8
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:19:56 +05:30
Sughosh Ganu
e106a78ef0 feat(fwu): update the URL links for the FWU specification
Update the links for accessing the FWU Multi Bank update specification
to point to the latest revision of the specification.

Change-Id: I25f35556a94ca81ca0a7463aebfcbc2d84595e8f
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-01 14:19:56 +05:30
Shruti Gupta
ba33528a00 fix(el3-spmc): add datastore linker script markers
Datastore symbol used by EL3 SPMC is not relocated at
boot time when using ENABLE_PIE=1.
Use linker script markers instead of symbol.

Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: If22d2fc8deacc74c73d7dc51bb70093935d9fa2b
2024-02-29 14:54:37 +01:00
Manish V Badarkhe
c2f9ba88f4 Merge changes from topic "mp/undef_injection" into integration
* changes:
  feat(el3-runtime): introduce UNDEF injection to lower EL
  feat(cpufeat): added few helper functions
2024-02-28 14:38:49 +01:00
Manish Pandey
3c789bfccc feat(el3-runtime): introduce UNDEF injection to lower EL
For a feature to be used at lower ELs, EL3 generally needs to disable
the trap so that lower ELs can access the system registers associated
with the feature. Lower ELs generally check ID registers to dynamically
detect if a feature is present (in HW) or not while EL3 Firmware relies
statically on feature build macros to enable a feature.

If a lower EL accesses a system register for a feature that EL3 FW is
unaware of, EL3 traps the access and panics. This happens mostly with
EL2 but sometimes VMs can also cause EL3 panic.

To provide platforms with capability to mitigate this problem, UNDEF
injection support has been introduced which injects a synchronous
exception into the lower EL which is supposed to handle the
synchronous exception.

The current support is only provided for aarch64.

The implementation does the following on encountering sys reg trap

 - Get the target EL, which can be either EL2 or EL1
 - Update ELR_ELx with ELR_EL3, so that after UNDEF handling in lower EL
   control returns to original location.
 - ESR_ELx with EC_UNKNOWN
 - Update ELR_EL3 with vector address of sync exception handler with
   following possible causes
     - Current EL with SP0
     - Current EL with SPx
     - Lower EL using AArch64
 - Re-create SPSR_EL3 which will be used to generate PSTATE at ERET

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I1b7bf6c043ce7aec1ee4fc1121c389b490b7bfb7
2024-02-28 12:47:29 +00:00
Manish Pandey
57c266dc25 Merge "fix(gpt): use DC CIGDPAPA when MTE2 is implemented" into integration 2024-02-28 12:35:59 +01:00
Manish Pandey
30f05b4f5d feat(cpufeat): added few helper functions
Following utility functions/bit definitions done
 - Write a helper function to return the presence of following features
    - FEAT_UAO
    - FEAT_EBEP
    - FEAT_SEBEP
    - FEAT_SSBS
    - FEAT_NMI
    - FEAT_PAN
 - Add definition of some missing bits of SPSR.
 - Add GCSCR_EL1 register encoding and accessor function.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ifcead0dd8e3b32096e4ab810dde5d582a889785a
2024-02-28 10:02:24 +00:00
Manish V Badarkhe
df21d41b77 Merge changes I1415e402,Ia92cc693,I7a42f72e,I6e75659e,I4c6136c5, ... into integration
* changes:
  refactor(tc): correlate secure world addresses with platform_def
  feat(tc): add memory node in the device tree
  feat(tc): pass the DTB address to BL33 in R0
  feat(tc): add arm_ffa node in dts
  chore(tc): add dummy entropy to speed up the Linux boot
  feat(tc): choose the DPU address and irq based on the target
  feat(tc): add SCMI power domain and IOMMU toggles
  refactor(tc): move the FVP RoS to a separate file
  feat(tc): factor in FVP/FPGA differences
  feat(tc): introduce an FPGA subvariant and TC3 CPUs
  feat(tc): add TC3 platform definitions
  refactor(tc): sanitise the device tree
  feat(tc): add PMU entry
  feat(tc): allow booting from DRAM
  chore(tc): remove unused hdlcd
  feat(tc): add firmware update secure partition
  feat(tc): add spmc manifest with trusty sp
  refactor(tc): unify all the spmc manifests
  feat(arm): add trusty_sp_fw_config build option
  fix(tc): do not enable MPMM and Aux AMU counters always
  fix(tc): correct interrupts
  feat(tc): interrupt numbers for `smmu_700`
  feat(tc): enable gpu/dpu scmi power domain and also gpu perf domain
2024-02-27 10:59:58 +01:00
Manish Pandey
f7e6b3b9e0 Merge "fix(psa): fix static check failure" into integration 2024-02-27 10:50:01 +01:00
Boyan Karatotev
5ee4deb8e6 feat(tc): add memory node in the device tree
With new TC revisions, memory banks move around which requires an update
in platform_def. It also requires an update in the device tree which
doesn't come naturally. To avoid this, add the memory node such that it
uses the macros defined in platform_def.

By doing this we can put u-boot out of its misery in trying to come up
with the correct memory node and tf-a's device tree becomes complete.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Ia92cc6931abb12be2856ac3fb1455e4f3005b326
2024-02-26 16:07:41 +00:00
Manish Pandey
13caddef46 Merge "refactor(st-i2c): use fdt_read_uint32_default()" into integration 2024-02-26 12:09:27 +01:00
Arunachalam Ganapathy
0686a01b0c feat(arm): add trusty_sp_fw_config build option
Also increase add PLAT_ARM_SP_MAX_SIZE to override the default
ARM_SP_MAX_SIZE to support Trusty image and move OPTEE_SP_FW_CONFIG
documentation to build-internals.rst as it's not externally set-able.

Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Ief90ae9113d32265ee2200f35f3e517b7b9a4bea
2024-02-23 16:11:47 +00:00
Jayanth Dodderi Chidanand
59f8882b44 refactor(context-mgmt): move EL1 save/restore routines into C
Similar to the refactoring process followed for EL2 system registers,
moving the save and restore routines of EL1 system registers into C
file, thereby reducing assembly code.

Change-Id: Ib59fbbe2eef2aa815effe854cf962fc4ac62a2ae
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-02-22 10:34:40 +00:00
Manish V Badarkhe
bc0ff02cbb fix(psa): fix static check failure
Address the coding style issue that arose from patch [1], which
was inadvertently overlooked during the CI check.

[1]: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/26263

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I280766fddf0e9e366bb2376c52a6907093b0d958
2024-02-18 20:34:40 +00:00
Olivier Deprez
02088b64f3 Merge changes from topic "mb/tc-model-update" into integration
* changes:
  docs: update FVP TC2 model version and build (11.23/17)
  fix(tc): increase BL2 maximum size limit
  refactor(tc): update platform tests
  feat(rss): add defines for 'type' range and use them in psa_call()
  feat(rss): adjust parameter packing to match TF-M changes
  refactor(tc): remap console logs
2024-02-15 16:57:33 +01:00
David Vincze
a93bf0aaca refactor(tc): update platform tests
Update the TC's platform test Makefile and related common definitions
to correspond to newer TF-M code (commit hash: 4ab7a20).

Change-Id: I6ef3effe194a780a0533f9c0c2eab9d0f4efc1fc
Signed-off-by: David Vincze <david.vincze@arm.com>
2024-02-13 15:03:01 +00:00
David Vincze
002b10604b feat(rss): add defines for 'type' range and use them in psa_call()
Update the 'type' parameter checking according to changes
on RSS's (TF-M) side: 40b09ba1 [1]

[1]: https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/commit/?id=40b09ba1e4a7a4f726f98700eab7e4e4d8e95dcf

Change-Id: I8487e8ab24aa2dd080b5bb8f2f5c7e8fc15cf211
Signed-off-by: David Vincze <david.vincze@arm.com>
2024-02-13 15:03:01 +00:00
Tamas Ban
6f503e0eea feat(tc): add RSS SDS region right after SCMI payload
Add a second SDS region on the TC platform for communication with RSS.
RSS needs to share data with AP during early boot over shared memory
to support DPE. Reserve a memory region right after the SCMI secure
payload areas from unused memory.

Change-Id: I3a3a6ea5ce76531595c88754418602133a283c42
Signed-off-by: David Vincze <david.vincze@arm.com>
2024-02-13 14:36:14 +01:00
Tamas Ban
8d1a04bd37 refactor(css): support multiple SDS regions
Extend the SDS driver to be able to handle multiple
SDS regions:
 - AP-SCP
 - AP-RSS

Change-Id: Id303840b248c383b3f960227cbf6333d1cc75e65
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Signed-off-by: David Vincze <david.vincze@arm.com>
2024-02-13 14:36:14 +01:00
Olivier Deprez
62d6465213 fix(gpt): use DC CIGDPAPA when MTE2 is implemented
Use cache clean and invalidate of data and allocation tags by PA to PoPA
maintenance instruction (dc cigdpapa) in the GPT library upon changing
the PAS for a memory region. This is required to flush allocation tags
when MTE2 (and above) is implemented.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I4b70afb297f693b1d446839607922c47111ce063
2024-02-12 17:38:00 +01:00
Govindraj Raja
8e3978899a feat(mte): add mte2 feat
Add support for feat mte2. tfsr_el2 is available only with mte2,
however currently its context_save/restore is done with mte rather than
mte2, so introduce 'is_feat_mte2_supported' to check mte2.

Change-Id: I108d9989a8f5b4d1d2f3b9865a914056fa566cf2
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-02-12 08:20:01 -06:00
Manish Pandey
771a07156f Merge changes from topic "ADD_DELAY_IN_POLLING_SCMI" into integration
* changes:
  fix(scmi): induce a delay in monitoring SCMI channel status
  feat(css): initialise generic timer early in the boot
2024-02-08 16:02:56 +01:00
Manish Pandey
b1428d92d9 Merge changes from topic "stm32mp2-usb" into integration
* changes:
  feat(stm32mp2): add STM32MP_USB_PROGRAMMER compilation
  refactor(st): move macros to common folder
  refactor(stm32mp1): remove unused macros
  fix(usb): add missing include
2024-02-08 15:59:54 +01:00
Madhukar Pappireddy
4da4a1a61d Merge changes from topic "od/sme" into integration
* changes:
  fix(fvp): permit enabling SME for SPD=spmd
  feat(spmd): pass SMCCCv1.3 SVE hint to lower EL
2024-02-07 22:45:38 +01:00
Olivier Deprez
c925867ec1 feat(spmd): pass SMCCCv1.3 SVE hint to lower EL
A normal world caller can emit an SMC with the SVE hint bit set such
that the callee can perform an optimization by omitting to save/restore
the SVE context. Update the SPMD to pass this information to the SPMC
when set by the caller in the SMC flags parameter.
For now, restrict this behavior to the SPMC living at S-EL2.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Icf46eb8a391dd3ddd2ee6aff8581a2f1c8a1c274
2024-02-07 17:46:01 +01:00
Olivier Deprez
ce19ebd264 Merge changes from topic "ja/spm_rme" into integration
* changes:
  docs: change FVP argument in RME configuration
  feat(fvp): added calls to unprotect/protect memory
2024-02-07 17:21:39 +01:00
Lauren Wehrmeister
dfa8b3ba4c Merge "fix(cpus): workaround for Cortex-A715 erratum 2561034" into integration 2024-02-06 22:20:24 +01:00
Manish V Badarkhe
3d630fa26a Merge changes from topic "jc/psci_spe" into integration
* changes:
  fix(spe): invoke spe_disable during power domain off/suspend
  feat(psci): add psci_do_manage_extensions API
  fix(arm_fpga): halve number of PEs per core
2024-02-06 12:46:16 +01:00
J-Alves
6873088c2c feat(fvp): added calls to unprotect/protect memory
Added SiP calls to FVP platform to protect/unprotect a
memory range.
These leverage rme features to change the PAS of a given
memory range from non-secure to secure.

The mentioned call is leveraged by the SPMC in the memory
sharing flow, when memory is shared from the normal world
onto the secure world.

More details in the SPM related patches.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Iaf15d8603a549d247ffb1fc14c16bfb94d0e178a
2024-02-06 10:56:26 +00:00
Bipin Ravi
6a6b282378 fix(cpus): workaround for Cortex-A715 erratum 2561034
Cortex-A715 erratum 2561034 is a Cat B erratum that applies to
revision r1p0 and is fixed in r1p1.

The workaround is to set bit[26] in CPUACTLR2_EL1. Setting this
bit is not expected to have a significant performance impact.

SDEN documentation:
https://developer.arm.com/documentation/SDEN2148827/latest

Change-Id: I377f250a2994b6ced3ac7d93f947af6ceb690d49
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-02-05 17:14:21 -06:00
Yann Gautier
f84f21fa8d fix(usb): add missing include
When trying to compile USB stack for STM32MP2, the following warning
happens:
In file included from plat/st/stm32mp2/stm32mp2_usb_dfu.c:7:
include/drivers/usb_device.h:193:9: error: unknown type name 'bool'
  193 |         bool is_in;

Correct it by adding: #include <stdbool.h>

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: If17e4e269fcdc885e42f5fcad9cfb763829786e4
2024-02-05 09:24:54 +01:00
Manish Pandey
b55bf2562e Merge "feat(spmd): initialize SCR_EL3.EEL2 bit at RESET" into integration 2024-02-03 11:29:39 +01:00
Jayanth Dodderi Chidanand
160e8434ba feat(psci): add psci_do_manage_extensions API
Adding a new API under PSCI library,for managing all the architectural
features, required during power off or suspend cases.

Change-Id: I1659560daa43b9344dd0cc0d9b311129b4e9a9c7
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-02-02 20:06:28 +00:00
Manish Pandey
8815cdaf57 feat(spmd): initialize SCR_EL3.EEL2 bit at RESET
SCR_EL3.EEL2 bit enabled denotes that the system has S-EL2 present and
enabled, Ideally this bit is constant throughout the lifetime and
should not be modified. Currently this bit is initialized in the context
mgmt code where each world copy of the SCR_EL3 register has this bit set
to 1, but for the time duration between the RESET and the first exit to
a lower EL this bit is zero.

Modifying SCR_EL3.EEL2 along with EA bit at RESET does also helps in
mitigating against ERRATA_V2_3099206.

For details on Neoverse V2 errata 3099206, refer the SDEN document
given below.
https://developer.arm.com/documentation/SDEN-2332927/latest

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: If8b2bdbb19bc65391a33dd34cc9824a0203ae4b1
2024-02-02 18:15:21 +00:00
Pranav Madhu
af1ac2d7db fix(scmi): induce a delay in monitoring SCMI channel status
Reading the SCMI mailbox status in polling mode causes a burst of bus
accesses. On certain platforms, this would not be ideal as the shared
bus on the CPU subsystem might cause contentions across all the CPUs.
So allow platforms to specify a delay to be introduced while polling.

Change-Id: Ib90ad7b5954854071cfd543f4a27a178dde3d5c6
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
2024-02-02 17:14:27 +05:30
Yi Chou
b22e6898e1 feat(cros_widevine): add ChromeOS widevine SMC handler
The ChromeOS will use the SMC to pass some secrets from firmware to
optee.

Change-Id: Iaf3357d40a7ed22415926acd9d7979df24dd81f1
Signed-off-by: Yi Chou <yich@google.com>
2024-02-02 16:41:21 +08:00
Manish Pandey
7671008fcf fix(ehf): restrict secure world FIQ routing model to SPM_MM
Exception handling framework (EHF) changes the semantics of interrupts,
sync and async external aborts. As far as interrupts are concerned it
changes the routing model of foreign interrupts (FIQs) by changing
SCR_EL3.FIQ to 1 for both non-secure and secure except when SPMD is
used along with Hafnium/SPM at S-EL2 [1].
For NS world it means : G1S and G0 interrupts are routed to EL3
For Secure world it means : G1NS and G0 are routed to EL3

There is no upstream use case utilizing EHF and re-routing EL3
interrupts to the Secure world except when SPM_MM is present.

Modify the FIQ routing model during EHF init just for known use cases,
Always for NS world and for secure world only if SPM_MM is present.

[1]:https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/16047

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ic292bbe8dd02d560aece5802d79569d868d8500f
2024-02-01 13:15:43 +00:00
Lauren Wehrmeister
c6db6d0361 Merge "fix(cpus): workaround for Cortex X3 erratum 2641945" into integration 2024-01-30 23:27:01 +01:00
Manish V Badarkhe
28c79e1013 Merge changes from topic "plat_gpt_setup" into integration
* changes:
  feat(arm): move GPT setup to common BL source
  feat(arm): retrieve GPT related data from platform
  refactor(arm): rename L0/L1 GPT base macros
2024-01-30 12:13:14 +01:00
Manish Pandey
7516d93d3a Merge "feat(cpufeat): add feature detection for FEAT_CSV2_3" into integration 2024-01-29 22:46:39 +01:00