Commit Graph

1769 Commits

Author SHA1 Message Date
Lauren Wehrmeister 6a4afebb0f Merge "fix(cpus): workaround for Cortex-X4 erratum 2740089" into integration 2024-04-23 16:14:02 +02:00
Lauren Wehrmeister 8acdb13a9a Merge "fix(cpus): workaround for Cortex-A715 erratum 2728106" into integration 2024-04-23 16:13:55 +02:00
Madhukar Pappireddy d6c76e6c65 fix(cm): add more feature registers to EL1 context mgmt
The following system registers are made part of save and restore
operations for EL1 context:

TRFCR_EL1
SCXTNUM_EL0
SCXTNUM_EL1
GCSCR_EL1
GCSCRE0_EL1
GCSPR_EL1
GCSPR_EL0

Change-Id: I1077112bdc29a6c9cd39b9707d6cf10b95fa15e3
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2024-04-19 09:57:36 -05:00
Yann Gautier 85658c5695 Merge "fix(pmu): fix breakage on ARMv7 CPUs with SP_min as BL32" into integration 2024-04-19 14:04:52 +02:00
Soby Mathew 98f7b60ec6 Merge changes Ic40e1b7a,I0398b550,Ife594ed6,I3eb0f29b into integration
* changes:
  fix(gpt): unify logging messages
  chore(gpt): remove gpt_ prefix
  feat(aarch64): add functions for TLBI RPALOS
  feat(locks): add bitlock
2024-04-19 11:24:01 +02:00
Bipin Ravi c833ca66a6 fix(cpus): workaround for Cortex-X4 erratum 2740089
Cortex-X4 erratum 2740089 is a Cat B erratum that applies to
all revisions <=r0p1 and is fixed in r0p2. The workaround is to
insert a dsb before the isb in the power down sequence.

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

Change-Id: I1d0fa4dd383437044a4467591f65a4a8514cabdc
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-04-18 13:39:25 -05:00
AlexeiFedorov b99926ef7b fix(gpt): unify logging messages
This patch modifies GPT library comments and makes
logging messages consistent with PRIx64 usage and
TF-A format used in other modules.
Minor changes are made to make the code compliant
with MISRA C requirements.

Change-Id: Ic40e1b7ac43cd9602819698d00e1ce3a8c7183ce
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
2024-04-17 14:00:16 +02:00
AlexeiFedorov 20e2683daf chore(gpt): remove gpt_ prefix
This patch removes 'gpt_' prefix from the
names of static functions for better code
readability.

Change-Id: I0398b55047a73209da598b708240fcba47c779f7
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
2024-04-17 13:59:59 +02:00
Manish Pandey d3604b353e Merge changes from topic "lto-fixes" into integration
* changes:
  fix(bl1): add missing `__RW_{START,END}__` symbols
  fix(fvp): don't check MPIDRs with the power controller in BL1
  fix(arm): only expose `arm_bl2_dyn_cfg_init` to BL2
  fix(cm): hide `cm_init_context_by_index` from BL1
  fix(bl1): add missing spinlock dependency
2024-04-16 15:51:44 +02:00
AlexeiFedorov 222f885df3 feat(locks): add bitlock
This patch adds 'bitlock_t' type and bit_lock() and
bit_unlock() to support locking/release functionality
based on individual bit position. These functions use
atomic bit set and clear instructions which require
FEAT_LSE mandatory from Armv8.1.

Change-Id: I3eb0f29bbccefe6c0f69061aa701187a6364df0c
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
2024-04-15 12:14:16 +01:00
Mark Dykes 0cf4fda900 Merge "fix(handoff): correct representation of tag_id" into integration 2024-04-12 17:49:46 +02:00
Jayanth Dodderi Chidanand a796d5aa11 fix(cm): remove ENABLE_FEAT_MTE usage
commit@c282384dbb45b6185b4aba14efebbad110d18e49
removed ENABLE_FEAT_MTE but missed its usage in
context structure declaration path.

All mte regs that are currently context saved/restored
are needed only when FEAT_MTE2 is enabled, so move to
usage of FEAT_MTE2 and remove FEAT_MTE usage

Change-Id: I6b4417485fa6b7f52a31045562600945e48e81b7
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-04-12 06:42:42 +01:00
Chris Kay a6b3643c2a fix(cm): hide `cm_init_context_by_index` from BL1
BL1 requires the context management library but does not use or
implement `cm_init_context_by_index`. This change ensures that is not
compiled into BL1, as linking with LTO enabled causes an undefined
reference for this function.

Change-Id: I4a4602843bd75bc4f47b3e0c4c5a6efce1514ef6
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-04-11 11:20:32 +00:00
Bipin Ravi 10134e3556 fix(cpus): workaround for Cortex-A715 erratum 2728106
Cortex-A715 erratum 2728106 is a Cat B(rare) erratum that is present
in revision r0p0, r1p0 and r1p1. It is fixed in r1p2.

The workaround is to execute an implementation specific sequence in
the CPU.

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

Change-Id: Ic825f9942e7eb13893fdbb44a2090b897758cbc4
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
2024-04-10 15:12:13 -05:00
Mark Dykes a6cb061b62 Merge "fix(cc): code coverage optimization fix" into integration 2024-04-10 20:15:00 +02:00
Mark Dykes 4b50d7582f Merge "fix(cm): add more system registers to EL1 context mgmt" into integration 2024-04-08 23:14:03 +02:00
Mark Dykes 152ad112d7
fix(cc): code coverage optimization fix
Resolve issue where optimization is enabled for TF-A using
-Og and compile fail is seen in PSCI module.

Change-Id: Id9afb5c56a6937e7040b20cd01080c190c8276d5
Signed-off-by: Mark Dykes <mark.dykes@arm.com>
2024-04-08 13:38:01 -05:00
Bipin Ravi c97831eb09 Merge "build: use GCC to link by default" into integration 2024-04-05 22:21:15 +02:00
Madhukar Pappireddy ed9bb824e4 fix(cm): add more system registers to EL1 context mgmt
The following system registers are made part of save and restore
operations for EL1 context:
  MDCCINT_EL1
  MDSCR_EL1
  DISR_EL1
  PIRE0_EL1
  PIR_EL1
  POR_EL1
  S2POR_EL1
  TCR2_EL1

Some of these registers are available as part of core Armv8-A
architecture while others are made available through various
architectural extensions.

Change-Id: I507dccb9053ba177e1b98100fceccd1f32bdfc5c
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2024-04-03 11:08:35 -05:00
Harrison Mutai d594ace68d fix(handoff): correct representation of tag_id
The tag ID is a 3-byte field used to identify the contents of a TE. In
our library, the internal representation of the tag is a 2 byte field.
We currently ignore the top byte of this field, marking it res0. This
causes problems when dealing with non-standard TE types, whose range
starts at 0xff_f000.  This commit fixes this by using a bit-field with a
24-bit width, and packing `transfer_list_entry`.

Change-Id: Ib3c212f964b64f528ad6f3dd6ab8b4597b877cd9
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-04-03 13:16:24 +00:00
Ahmad Fatoum e6f8fc7437 fix(pmu): fix breakage on ARMv7 CPUs with SP_min as BL32
While comments introduced with the original commit claim that
pmuv3_disable_el3()/pmuv3_init_el3() are compatible with PMUv2 and
PMUv1, this is not true in practice: The function accesses the Secure
Debug Control Register (SDCR), which only available to ARMv8 CPUs.

ARMv8 CPUs executing in AArch32 mode would thus be able to disable
their PMUv3, while ARMv7 CPUs would hang trying to access the SDCR.

Fix this by only doing PMUv3 handling when we know a PMUv3 to be
available. This resolves boot hanging on all STM32MP15 platforms
that use SP_min as BL32 instead of OP-TEE.

Change-Id: I40f7611cf46b89a30243cc55bf55a8d9c9de93c8
Fixes: c73686a11c ("feat(pmu): introduce pmuv3 lib/extensions folder")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-02 16:17:03 +02:00
Chris Kay 2f1c5e7eb1 build: use GCC to link by default
When configuring GNU GCC as the C compiler, we usually use the GNU BFD
linker directly to link by default. However, this complicates things
because we also need to support LTO, which can only be done when linking
is done via the C compiler, and we cannot change the linker later on if
some other part of the build system wants to enable LTO.

This change migrates the default choice of linker to GCC if the C
compiler is GCC, in order to enable this use-case. This should have no
impact on anything outside of the build system, as by default GCC merely
acts as a wrapper around BFD.

Change-Id: I40771be2b0571def67bbfde9e877e7629ec8cdaa
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-04-02 09:52:17 +00:00
Madhukar Pappireddy 6aae3acfd0 fix(cm): save guarded control stack registers
This patch fixes a typo which led to incorrect context save
operations for two FEAT_GCS registers.

Change-Id: I3d3202a6721714bbc8f84c2d775d1b28afffa5df
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2024-04-01 16:13:59 -05:00
Madhukar Pappireddy eee0ec48b5 Merge changes from topic "mte_fixes" into integration
* changes:
  build(changelog): move mte to mte2
  refactor(mte): remove mte, mte_perm
2024-03-26 23:01:05 +01:00
Govindraj Raja c282384dbb refactor(mte): remove mte, mte_perm
Currently both FEAT_MTE and FEAT_MTE_PERM aren't used for enabling
of any feature bits in EL3. So remove both FEAT handling.

All mte regs that are currently context saved/restored are needed
only when FEAT_MTE2 is enabled, so move to usage of FEAT_MTE2 and
remove FEAT_MTE usage.

BREAKING CHANGE: Any platform or downstream code trying to use
SCR_EL3.ATA bit(26) will see failures as this is now moved to be
used only with FEAT_MTE2 with
commit@ef0d0e5478a3f19cbe70a378b9b184036db38fe2

Change-Id: Id01e154156571f7792135639e17dc5c8d0e17cf8
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-03-26 14:30:58 -05:00
Sona Mathew 328d304d27 chore: rename Poseidon to Neoverse V3
Rename Neoverse Poseidon to Neoverse V3, make changes
to related build flags, macros, file names etc.

Change-Id: I9e40ba8f80b7390703d543787e6cd2ab6301e891
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-03-26 11:27:31 -05:00
Bipin Ravi e7419780f7 Merge "fix(cpus): workaround for Cortex-A715 erratum 2413290" into integration 2024-03-26 01:12:57 +01:00
Sona Mathew bd2f7d3258 fix(cpus): workaround for Cortex-A715 erratum 2413290
Erratum 2413290 is a Cat B erratum that is present only
in revision r0p1 and is fixed in r1p1.

The initial implementation did not consider that this
fix is to be applied only when SPE (Statistical Profiling
Extension) is implemented and enabled. This patch applies
the fix by adding a check for ENABLE_SPE_FOR_NS.

Change-Id: I87b2175b89d6fb168c77e6ab233c90ca056791a1
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-03-24 22:45:31 -05:00
Bipin Ravi 152f4cfa16 fix(cpus): workaround for Cortex-A720 erratum 2926083
Cortex-A720 erratum 2926083 is a Cat B erratum that is present
in revisions r0p0, r0p1 and is fixed in r0p2. The errata is only
present when SPE (Statistical Profiling Extension) is implemented
and enabled.

The workaround is to set bits[58:57] of the CPUACTLR_EL1 to 'b11
when SPE is "implemented and enabled".

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

Change-Id: I30182c3893416af65b55fca9a913cb4512430434
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-03-22 16:10:07 -05:00
Manish Pandey 869ee08638 Merge "fix(mte): use ATA bit with FEAT_MTE2" into integration 2024-03-22 18:24:29 +01:00
Manish Pandey ceedd1dc02 Merge "refactor(cm): minor update on conditions used in prepare_el3_exit" into integration 2024-03-22 14:24:05 +01:00
Bipin Ravi 063d99b3ec Merge "chore: update status of Cortex-X3 erratum 2615812" into integration 2024-03-22 00:41:20 +01:00
Madhukar Pappireddy fe6c65749d Merge "fix(cpus): workaround for Cortex-A720 erratum 2940794" into integration 2024-03-22 00:09:19 +01:00
Sona Mathew f589a2a5f1 chore: update status of Cortex-X3 erratum 2615812
SDEN documentation:
https://developer.arm.com/documentation/2055130/latest

Change-Id: Ied7150bab505a743401cf4afa9a0a5f81d5fdff1
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-03-20 11:41:29 -05:00
Jayanth Dodderi Chidanand d39b123690 refactor(cm): minor update on conditions used in prepare_el3_exit
This patch covers the following:

* Conditions set for verifying the EL2 presence and its usage
  for various scenarios while exiting to Non secure world
  "cm_prepare_el3_exit" has been improved.

* It thereby also fixes the issue(misra_c_2012_rule_15_7_violation)
  for not terminating "if..else if" construct with an else statement
  and keeps code in accordance with MISRA standards.

Change-Id: Ie5284447f5ac91412552629b76dbf2e636a09fd9
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-03-20 09:59:42 +00:00
Bipin Ravi 7385213e60 fix(cpus): workaround for Cortex-A720 erratum 2940794
Cortex-A720 erratum 2940794 is a Cat B erratum that is present
in revision r0p0, r0p1 and is fixed in r0p2.

The workaround is to set bit[37] of the CPUACTLR2_EL1 to 1.

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

Change-Id: I1488802e0ec7c16349c9633bb45de4d0e1faa9ad
Signed-off-by: Bipin Ravi <biprav01@u203721.austin.arm.com>
2024-03-19 18:31:55 -05:00
Govindraj Raja ef0d0e5478 fix(mte): use ATA bit with FEAT_MTE2
Currently SCR_EL3.ATA bit(26) is used freely or either with FEAT_MTE,
But ATA bit is available only with FEAT_MTE2. So use FEAT_MTE2
conditional check for use of SCR_EL3.ATA.

Ref:
https://developer.arm.com/documentation/ddi0601/2023-12/AArch64-Registers/SCR-EL3--Secure-Configuration-Register?lang=en#fieldset_0-26_26-1

Change-Id: I0a5766a138b0be760c5584014f1ab817e4207a93
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-03-18 19:29:44 -05:00
Lauren Wehrmeister f36faa7157 Merge "fix(cpus): fix a defect in Cortex-A715 erratum 2561034" into integration 2024-03-12 19:17:49 +01:00
Bipin Ravi 57ab6d8976 fix(cpus): fix a defect in Cortex-A715 erratum 2561034
Cortex-A715 erratum 2561034 mitigation needs to be applied
during reset. This patch fixes the current macro usage from runtime
to reset for both start and end macros.

Change-Id: I4f115bbb27c57f16cada2a7eb314af8380f93cb4
Signed-off-by: Bipin Ravi <biprav01@u203721.austin.arm.com>
2024-03-11 16:46:14 -05:00
Sona Mathew 15a04615bb fix(cpus): workaround for Cortex-A715 erratum 2413290
Cortex-A715 erratum 2413290 is a Cat B erratum that is present
only in revision r1p0 and is fixed in r1p1. The errata is only
present when SPE(Statistical Profiling Extension) is enabled.

The workaround is to set bits[58:57] of the CPUACTLR_EL1 to 'b11
when SPE is enabled, ENABLE_SPE_FOR_NS=1.

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

Change-Id: Iaeb258c8b0a92e93d70b7dad6ba59d1056aeb135
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-03-11 10:48:10 -05:00
Manish Pandey e8090ce298 Merge "refactor(cm): couple el2 registers with dependent feature flags" into integration 2024-03-08 17:20:33 +01:00
Manish V Badarkhe e7d14fa83f Merge changes from topic "DPE" into integration
* changes:
  feat(tc): group components into certificates
  feat(dice): add cert_id argument to dpe_derive_context()
  refactor(sds): modify log level for region validity
  feat(tc): add dummy TRNG support to be able to boot pVMs
  feat(tc): get the parent component provided DPE context_handle
  feat(tc): share DPE context handle with child component
  feat(tc): add DPE context handle node to device tree
  feat(tc): add DPE backend to the measured boot framework
  feat(auth): add explicit entries for key OIDs
  feat(dice): add DPE driver to measured boot
  feat(dice): add client API for DICE Protection Environment
  feat(dice): add QCBOR library as a dependency of DPE
  feat(dice): add typedefs from the Open DICE repo
  docs(changelog): add 'dice' scope
  refactor(tc): align image identifier string macros
  refactor(fvp): align image identifier string macros
  refactor(imx8m): align image identifier string macros
  refactor(qemu): align image identifier string macros
  fix(measured-boot): add missing image identifier string
  refactor(measured-boot): move metadata size macros to a common header
  refactor(measured-boot): move image identifier strings to a common header
2024-03-07 21:41:23 +01:00
Lauren Wehrmeister 77b30cbabf Merge "fix(cpus): workaround for Cortex-A715 erratum 2344187" into integration 2024-03-07 16:52:46 +01:00
Jayanth Dodderi Chidanand d6af234431 refactor(cm): couple el2 registers with dependent feature flags
Currently the EL2 part of the context structure (el2_sysregs_t), is
mostly feature dependent.

For instance, CTX_HCRX_EL2 is only needed when FEAT_HCX
(ENABLE_FEAT_HCX=1) is set, but the entry is unconditionally added
in the EL2 context structure and thereby consuming memory even in
build configurations where FEAT_HCX is disabled.

Henceforth, all such context entries should be coupled/tied with
their respective feature enables and be optimized away when unused.
This would reduce the context memory allocation for platforms, that
dont enable/support all the architectural features at once.

Further, converting the assembly context-offset entries into
a c structure relies on garbage collection of the linker
removing unreferenced structures from memory, as well as aiding
in readability and future maintenance.

Change-Id: I0cf49498ee3033cb6f3ee3810331121b26627783
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-03-07 14:50:23 +00:00
Harrison Mutai 33c665ae95 fix(cpus): workaround for Cortex-A715 erratum 2344187
Cortex-A715 erratum 2344187 is a Cat B erratum that applies to r0p0,
r1p0 and is fixed in r1p1. The workaround is to set GCR_EL1.RRND to
0b1, and apply an implementation specific patch sequence.

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

Change-Id: I78ea39a91254765c964bff89f771af33b23f29c1
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-03-07 10:19:56 +00:00
Sona Mathew cc41b56f41 fix(cpus): workaround for Cortex-X4 erratum 2701112
Cortex-X4 erratum 2701112 is cat B erratum that applies to
revision r0p0 and is fixed in r0p1. This erratum affects
system configurations that do not use an Arm interconnect IP.

The workaround for this erratum is not implemented in EL3.
The erratum can be enabled/disabled on a platform level.
The flag is used when the errata ABI feature is enabled and can
assist the Kernel in the process of mitigation of the erratum.

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

Change-Id: I8ede1ee75b0ea1658369a0646d8af91d44a8759b
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-03-06 16:40:59 -06:00
Bipin Ravi 53b3cd2532 fix(cpus): workaround for Cortex-A715 erratum 2331818
Cortex-A715 erratum 2331818 is a cat B erratum that applies to
revisions r0p0 and r1p0 and is fixed in r1p1. The workaround is to
set bit[20] of CPUACTLR2_EL1. Setting this bit is expected to have
a negligible performance impact.

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

Change-Id: If3b1ed78b145ab6515cdd41135314350ed556381
Signed-off-by: Bipin Ravi <biprav01@u203721.austin.arm.com>
2024-03-06 13:57:02 -06:00
Bipin Ravi 1f73247132 fix(cpus): workaround for Cortex-A715 erratum 2420947
Cortex-A715 erratum 2420947 is a cat B erratum that applies only
to revision r1p0 and is fixed in r1p1. The workaround is to set
bit[33] of CPUACTLR2_EL1. This will prevent store and store-release
to merge inside the write buffer, and it is not expected to have
much performance impacts.

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

Change-Id: I01a71b878cd958e742ff8357f8cdfbfc5625de47
Signed-off-by: Bipin Ravi <biprav01@u203721.austin.arm.com>
2024-03-06 13:10:31 -06:00
Tamas Ban 6a415bd1e7 feat(dice): add cert_id argument to dpe_derive_context()
This custom argument is meant to simplify to group
components into certificates. Components with
the same cert_id contribute to the same certificate
regardless of the load order or the structure of the
derivation tree. This argument aims to flatten the tree
structure and make it easy to include branches or
subtrees in the main derivation line.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I83c4abc399616063a5eb04792d603899f7513627
2024-03-06 17:11:11 +01:00
Tamas Ban b03fe8c025 feat(dice): add client API for DICE Protection Environment
RSS provides the DICE Protection Environment
service (DPE). It partially implements the
DPE specification from TCG.

As a DPE profile, it supports the
Open Profile for DICE specification.
https://pigweed.googlesource.com/open-dice/+/refs/heads/main/docs/specification.md

In order to communicate with the service, commands
must be CBOR encoded.
The API implementation:
 - Expose a C API to the upper layer,
 - Do the CBOR encoding, decoding of the DPE
   commands,
 - Rely on the PSA framework to communicate
   with the RSS through an MHU.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I26a08f0c7cbffe07e725a7defbb6c60fd7735efe
2024-03-06 15:44:55 +01:00