Commit graph

1984 commits

Author SHA1 Message Date
Govindraj Raja
830ed3927a Merge "feat(feat_sctlr2): enable FEAT_SCTLR2 for Realm world" into integration 2024-11-05 18:29:38 +01:00
Javier Almansa Sobrino
b17fecd6cf feat(feat_sctlr2): enable FEAT_SCTLR2 for Realm world
Change-Id: I62e769ae796bbeb41741c2c421a5f129d875f5fb
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
2024-11-05 06:07:36 +02:00
Manish V Badarkhe
e01bcfb02c Merge "build: fix grouped targets on Make <= 4.2" into integration 2024-11-04 15:22:35 +01:00
Boyan Karatotev
25cde5f810 fix(romlib): prevent race condition on the build directory
When building with many cores (-j64), there's a good chance that the
rule to make the build directory is getting executed at the same time as
the rule for romlib.ldflags. On my machine, the former is slower,
resulting in romlib_generator.py not being able to write the file as the
directory doesn't exist yet.

Add an explicit dependency on the build directory for the target.
This ensures that we have a build directory before we start putting
stuff in it.

Change-Id: I120b0dc66c692c759ab1046c735be405b41db87c
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2024-10-30 14:15:03 +00:00
Chris Kay
a57b94ec7c build: fix grouped targets on Make <= 4.2
Grouped targets are a feature introduced with GNU Make 4.3 which enable
rules with multiple targets to communicate that all of the targets of
that rule are built simultaneously, rather than independently.

For example, without grouped targets the following rule may be executed
twice:

    a.txt b.txt:
    	touch a.txt b.txt

    # $ remake -j2 a.txt b.txt
    # touch a.txt b.txt
    # touch a.txt b.txt

In this example, both `a.txt` and `b.txt` are touched twice, when the
rule should only be executed once. Instead, this rule can use a grouped
target:

    a.txt b.txt &:
    	touch a.txt b.txt

    # $ remake -j2 a.txt b.txt
    # touch a.txt b.txt
    # remake: 'b.txt' is up to date.

In this case, both `a.txt` and `b.txt` are created once only, as Make
now knows that the recipe will create both files.

Note that pattern rules with multiple targets always behave this way.

Previously, we assumed that the grouped target feature was available,
but on systems still packaging Make 4.2, most prominently Ubuntu 20.04,
this is not the case. This change adds a check to ensure that we do not
use grouped targets if they are unavailable.

Change-Id: Ifd9da35421ae11468d7a25d3cbc76f6036921749
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-10-28 12:10:36 +00:00
Govindraj Raja
306551362c feat(d128): add support for FEAT_D128
This patch disables trapping to EL3 when the FEAT_D128
specific registers are accessed by setting the SCR_EL3.D128En bit.

If FEAT_D128 is implemented, then FEAT_SYSREG128 is implemented.
With FEAT_SYSREG128 certain system registers are treated as 128-bit,
so we should be context saving and restoring 128-bits instead of 64-bit
when FEAT_D128 is enabled.

FEAT_SYSREG128 adds support for MRRS and MSRR instruction which
helps us to read write to 128-bit system register.
Refer to Arm Architecture Manual for further details.

Change the FVP platform to default to handling this as a dynamic option
so the right decision can be made by the code at runtime.

Change-Id: I1a53db5eac29e56c8fbdcd4961ede3abfcb2411a
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-10-24 14:51:55 -05:00
Olivier Deprez
190ae70204 Merge "feat(cpus): add support for cortex-a720ae" into integration 2024-10-24 15:26:23 +02:00
Govindraj Raja
034b919748 Merge "chore(cpus): optimise runtime errata applications" into integration 2024-10-21 19:53:23 +02:00
Olivier Deprez
2752c2a849 Merge "feat(cpus): add support for arcadia cpu" into integration 2024-10-21 17:20:12 +02:00
Ahmed Azeem
8118078b71 feat(cpus): add support for cortex-a720ae
Add the basic CPU library code to support Cortex-A720AE.
The overall library code is adapted based on Cortex-A720 code.

Signed-off-by: David Hu <david.hu2@arm.com>
Signed-off-by: Ahmed Azeem <ahmed.azeem@arm.com>
Change-Id: I3d64dc5a3098cc823e656a5ad3ea05cd71598dc6
2024-10-21 15:20:34 +01:00
Olivier Deprez
5ec9ade9dd Merge "fix(brbe): allow RME builds with BRBE" into integration 2024-10-21 12:12:17 +02:00
Manish Pandey
17ef5da7fd Merge "feat(context-mgmt): introduce EL3/root context" into integration 2024-10-18 14:44:19 +02:00
Boyan Karatotev
9890eab574 fix(brbe): allow RME builds with BRBE
It used to be the case that a FEAT_RME build could not be built with
FEAT_BRBE support. BRBE doesn't have a 3-world aware disable and
MDCR_EL3 was not context switched to allow for disabling in Realm world.

As of commit 123002f917 MDCR_EL3 is
context switched. Since the flag for BRBE support is
ENABLE_BRBE_FOR_NS, move brbe_enable() to only happen for NS world. The
other worlds will see BRBE disabled and branch recording prohibited.
This allows for a build with both RME and BRBE.

Note that EL2 BRBE registers are not context switched. Further work is
needed if non-NS support is required.

Change-Id: I82f0f08399dcd080902477dc9636bc4541685f89
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2024-10-18 11:30:34 +01:00
Govindraj Raja
8fa5460708 feat(cpus): add support for arcadia cpu
Add basic CPU library code to support the Arcadia CPU.

Change-Id: Iecb0634dc6dcb34e9b5fda4902335530d237cc43
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-10-17 09:34:03 -05:00
Boyan Karatotev
db9ee83432 chore(cpus): optimise runtime errata applications
The errata framework has a helper to invoke workarounds, complete with a
cpu rev_var check. We can use that directly instead of the
apply_cpu_pwr_dwn_errata to save on some code, as well as an extra
branch. It's also more readable.

Also, apply_erratum invocation in cpu files don't need to check the
rev_var as that was already done by the cpu_ops dispatcher for us to end
up in the file.

Finally, X2 erratum 2768515 only applies in the powerdown sequence, i.e.
at runtime. It doesn't achieve anything at reset, so we can label it
accordingly.

Change-Id: I02f9dd7d0619feb54c870938ea186be5e3a6ca7b
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2024-10-16 13:59:57 +01:00
Jayanth Dodderi Chidanand
40e5f7a58f feat(context-mgmt): introduce EL3/root context
* This patch adds root context procedure to restore/configure
  the registers, which are of importance during EL3 execution.

* EL3/Root context is a simple restore operation that overwrites
  the following bits: (MDCR_EL3.SDD, SCR_EL3.{EA, SIF}, PMCR_EL0.DP
  PSTATE.DIT) while the execution is in EL3.

* It ensures EL3 world maintains its own settings distinct
  from other worlds (NS/Realm/SWd). With this in place, the EL3
  system register settings is no longer influenced by settings of
  incoming worlds. This allows the EL3/Root world to access features
  for its own execution at EL3 (eg: Pauth).

* It should be invoked at cold and warm boot entry paths and also
  at all the possible exception handlers routing to EL3 at runtime.
  Cold and warm boot paths are handled by including setup_el3_context
  function in  "el3_entrypoint_common"  macro, which gets invoked in
  both the entry paths.

* At runtime, el3_context is setup at the stage, while we get prepared
  to enter into EL3 via "prepare_el3_entry" routine.

Change-Id: I5c090978c54a53bc1c119d1bc5fa77cd8813cdc2
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-10-15 13:25:58 +01:00
Jayanth Dodderi Chidanand
4ec4e545c6 feat(sctlr2): add support for FEAT_SCTLR2
Arm v8.9 introduces FEAT_SCTLR2, adding SCTLR2_ELx registers.
Support this, context switching the registers and disabling
traps so lower ELs can access the new registers.

Change the FVP platform to default to handling this as a dynamic option
so the right decision can be made by the code at runtime.

Change-Id: I0c4cba86917b6b065a7e8dd6af7daf64ee18dcda
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-10-13 18:44:54 -05:00
Jayanth Dodderi Chidanand
6d0433f040 feat(the): add support for FEAT_THE
Arm v8.9 introduces FEAT_THE, adding Translation Hardening Extension
Read-Check-Write mask registers, RCWMASK_EL1 and RCWSMASK_EL1.
Support this, context switching the registers and disabling
traps so lower ELs can access the new registers.

Change the FVP platform to default to handling this as a dynamic option
so the right decision can be made by the code at runtime.

Change-Id: I8775787f523639b39faf61d046ef482f73b2a562
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2024-10-13 18:44:54 -05:00
Mark Dykes
5765e0c95a Merge "fix(cpus): modify the fix for Cortex-A75 erratum 764081" into integration 2024-10-07 16:59:28 +02:00
Sona Mathew
7f152ea685 fix(cpus): modify the fix for Cortex-A75 erratum 764081
Apply the mitigation only for the revision and variant
mentioned in the SDEN.

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

Change-Id: Ifda1f4cb32bdec9a9af29397ddc03bf22a7a87fc
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-10-03 10:07:47 -05:00
Ryan Everett
db7eb68817 fix(cpus): workaround for Cortex-X4 erratum 3076789
Cortex-X4 erratum 3076789 is a Cat B erratum that is present
in revisions r0p0, r0p1 and is fixed in r0p2.

The workaround is to set chicken bits CPUACTLR3_EL1[14:13]=0b11
and CPUACTLR_EL1[52] = 1.
Expected performance degradation is < 0.5%, but isolated
benchmark components might see higher impact.

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

Change-Id: Ib100bfab91efdb6330fdcdac127bcc5732d59196
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-09-30 13:49:13 +01:00
Mark Dykes
e6f7929d12 Merge "fix(cpus): workaround for Cortex-X4 erratum 2897503" into integration 2024-09-25 17:04:20 +02:00
Manish V Badarkhe
1297a45d6a Merge changes from topic "dynamic-toolchain" into integration
* changes:
  build: allow multiple toolchain defaults
  build: determine toolchain tools dynamically
2024-09-25 13:53:54 +02:00
Arvind Ram Prakash
609d08a86d fix(cpus): workaround for Cortex-X4 erratum 2897503
Cortex-X4 erratum 2897503 is a Cat B erratum that applies
to all revisions <= r0p1 and is fixed in r0p2.

The workaround is to set CPUACTLR4_EL1[8] to 1.

SDEN documentation:
https://developer.arm.com/documentation/SDEN-2432808/latest

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I3178a890b6f1307b310e817af75f8fdfb8668cc9
2024-09-24 23:16:12 +02:00
Moritz Fischer
670150b804 chore(gpt): fix typo in comment
Fix a confusing typo in comment docstring.

Change-Id: I9424454b9fa140bf6a482dea7f8cba24806068b6
Signed-off-by: Moritz Fischer <moritzf@google.com>
2024-09-17 18:16:00 +02:00
Chris Kay
3789c3c000 build: determine toolchain tools dynamically
Since the introduction of the toolchain detection framework into the
build system, we have done determination and identification of the
toolchain(s) used for the build at the initialization of the build
system.

This incurs a large cost to the build every time - for every toolchain
that has been requested by the current makefile, we try to identify each
tool in the list of known tool classes, even if that tool doesn't
actually see any use.

For the clean and check-like targets we worked around this by disabling
most of the toolchains if we detect these targets, but this is
inflexible and not very reliable, and it still means that when building
normal targets we are incurring that cost for all tools whether they are
used or not.

This change instead modifies the toolchain detection framework to only
initialize a tool for a given toolchain when it is first used. This does
mean that we can no longer warn about an incorrectly-configured
toolchain at the beginning of build system invocation, but it has the
advantage of substantially reducing build time and the complexity of
*using* the framework (at the cost of an increase in complexity in the
framework itself).

Change-Id: I7f3d06b2eb58c1b26a846791a13b0037f32c8013
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-09-10 09:47:06 +00:00
Jayanth Dodderi Chidanand
f4303d05ea feat(cm): handle asymmetry for FEAT_TCR2
With introduction of FEAT_STATE_CHECK_ASYMMETRIC, the asymmetry of cores
can be handled. FEAT_TCR2 is one of the features which can be
asymmetric across cores and the respective support is added here.

Adding a function to handle this asymmetry by re-visting the
feature presence on running core.
There are two possible cases:
 - If the primary core has the feature and secondary does not have it
   then the feature is disabled.
 - If the primary does not have the feature and secondary has it then,
   the feature need to be enabled in secondary cores.

Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: I73a70891d52268ddfa4effe40edf04115f5821ca
2024-09-05 16:28:23 +01:00
Manish V Badarkhe
cc4f383863 Merge changes from topic "clean-up-errata-compatibility" into integration
* changes:
  refactor(cpus): remove cpu specific errata funcs
  refactor(cpus): directly invoke errata reporter
2024-08-27 16:23:58 +02:00
Madhukar Pappireddy
021cdbfbd4 Merge changes from topic "jc/refact_el1_ctx" into integration
* changes:
  feat(cm): enhance the cpu_context memory report
  refactor(cm): remove el1 context when SPMD_SPM_AT_SEL2=1
2024-08-21 21:55:56 +02:00
Jayanth Dodderi Chidanand
781e1a44e0 feat(cm): enhance the cpu_context memory report
Currently, as part of the context_memory report, we explicitly
list the EL3, EL1 and EL2 registers and memory usage per CPU
for each world. The remaining bits in the cpu_context_t structure
are grouped and listed as other section.

This patch enhances this part, by individually listing all the
remaining bits (GPREGS, PAUTH_REGS) separately providing
a much detailed overview of the context memory consumption
amongst the registers.

The patch has been tested on the CI with the following patch
and the results are summarised precisely.
[https://review.trustedfirmware.org/c/ci/tf-a-ci-scripts/+/28849]

Change-Id: I16f210b605ddd7900600519520accf1ccd057bc7
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-08-21 16:43:16 +01:00
Jayanth Dodderi Chidanand
a0674ab081 refactor(cm): remove el1 context when SPMD_SPM_AT_SEL2=1
* Currently, EL1 context is included in cpu_context_t by default
  for all the build configurations.
  As part of the cpu context structure, we hold a copy of EL1, EL2
  system registers, per world per PE. This context structure is
  enormous and will continue to grow bigger with the addition of
  new features incorporating  new registers.

* Ideally, EL3 should save and restore the system registers at its next
  lower exception level, which is EL2 in majority of the configurations.

* This patch aims at optimising the memory allocation in cases, when
  the members from the context structure are unused. So el1 system
  register context must be omitted when lower EL is always x-EL2.

* "CTX_INCLUDE_EL2_REGS" is the internal build flag which gets set,
  when SPD=spmd and SPMD_SPM_AT_SEL2=1 or ENABLE_RME=1.
  It indicates, the system registers at EL2 are context switched for
  the respective build configuration. Here, there is no need  to save
  and restore EL1 system registers, while x-EL2 is enabled.

Henceforth, this patch addresses this issue, by taking out the EL1
context at all possible places, while EL2 (CTX_INCLUDE_EL2_REGS) is
enabled, there by saving memory.

Change-Id: Ifddc497d3c810e22a15b1c227a731bcc133c2f4a
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-08-21 16:35:27 +01:00
Mark Dykes
31826ba221 Merge "fix(cpus): workaround for Cortex-A720 erratum 2792132" into integration 2024-08-21 16:41:19 +02:00
Jayanth Dodderi Chidanand
a0d9a973a4 chore(cm): reorganise sctlr_el1 and tcr_el1 ctx code
SCTLR_EL1 and TCR_EL1 regs are included either as part of errata
"ERRATA_SPECULATIVE_AT" or under el1_sysregs_t context structure.
The code to write and read into these context entries, looks
repetitive and is invoked at most places.
This section is refactored to bring them under a static procedure,
keeping the code neat and easier to maintain.

Change-Id: Ib0d8c51bee09e1600c5baaa7f9745083dca9fee1
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-08-21 08:45:25 +01:00
Manish V Badarkhe
4b6e4e618e Merge changes from topic "mp/simd_ctxt_mgmt" into integration
* changes:
  feat(fvp): allow SIMD context to be put in TZC DRAM
  docs(simd): introduce CTX_INCLUDE_SVE_REGS build flag
  feat(fvp): add Cactus partition manifest for EL3 SPMC
  chore(simd): remove unused macros and utilities for FP
  feat(el3-spmc): support simd context management upon world switch
  feat(trusty): switch to simd_ctx_save/restore apis
  feat(pncd): switch to simd_ctx_save/restore apis
  feat(spm-mm): switch to simd_ctx_save/restore APIs
  feat(simd): add rules to rationalize simd ctxt mgmt
  feat(simd): introduce simd context helper APIs
  feat(simd): add routines to save, restore sve state
  feat(simd): add sve state to simd ctxt struct
  feat(simd): add data struct for simd ctxt management
2024-08-20 22:30:06 +02:00
Arvind Ram Prakash
b1bde25ed9 fix(cpus): workaround for Cortex-A720 erratum 2792132
Cortex-A720 erratum 2792132 is a Cat B erratum that is present
in revision r0p0, r0p1 and is fixed in r0p2.

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

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

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I8d11fe65a2ab5f79244cc3395d0645f77256304c
2024-08-19 15:19:08 -05:00
Madhukar Pappireddy
308ebfa188 feat(simd): introduce simd context helper APIs
This patch adds the common API to save and restore FP and SVE. When SVE
is enabled we save and restore SVE which automatically covers FP. If FP
is enabled while SVE is not, then we save and restore FP only.

The patch uses simd_ctx_t to save and restore both FP and SVE which
means developers need not use fp or sve routines directly. Once all the
calls to fpregs_context_* are replaced with simd_ctx_*, we can remove
fp_regs_t data structure and macros (taken care in a following patch).

simd_ctx_t is currently allocated in section of its own. This will go
into  BSS section by default but platform will have option of relocating
it to a different section by overriding in plat.ld.S.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Signed-off-by: Okash Khawaja <okash@google.com>
Change-Id: I090f8b8fa3862e527b6c40385249adc69256bf24
2024-08-19 11:10:10 -05:00
Madhukar Pappireddy
6d5319afec feat(simd): add routines to save, restore sve state
This adds assembly routines to save and restore SVE registers. In order
to share between FPU and SVE the code to save and restore FPCR and
FPSR, the patch converts code for those registers into macro.
Since we will be using simd_ctx_t to save and restore FPU also, we use
offsets in simd_ctx_t for FPSR and FPCR. Since simd_ctx_t has the same
structure at the beginning as fp_regs_t, those offsets should be the
same as CTX_FP_* offsets, when SVE is not enabled. Note that the code
also saves and restores FPEXC32 reg along with FPSR and FPCR.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Signed-off-by: Okash Khawaja <okash@google.com>
Change-Id: I120c02359794aa6bb6376a464a9afe98bd84ae60
2024-08-19 11:10:10 -05:00
Manish V Badarkhe
553b70c3ef Merge changes from topic "ar/asymmetricSupport" into integration
* changes:
  feat(tc): enable trbe errata flags for Cortex-A520 and X4
  feat(cm): asymmetric feature support for trbe
  refactor(errata-abi): move EXTRACT_PARTNUM to arch.h
  feat(cpus): workaround for Cortex-A520(2938996) and Cortex-X4(2726228)
  feat(tc): make SPE feature asymmetric
  feat(cm): handle asymmetry for SPE feature
  feat(cm): support for asymmetric feature among cores
  feat(cpufeat): add new feature state for asymmetric features
2024-08-19 11:56:49 +02:00
Arvind Ram Prakash
721249b0c0 feat(cm): asymmetric feature support for trbe
This patch checks if the Errata 2938996(Cortex-A520) , 2726228(Cortex-X4)
applies to cores and if affected applies the errata workaround which
disables TRBE.

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I53b037839820c8b3a869f393588302a365d5b97c
2024-08-17 09:38:44 +01:00
Arvind Ram Prakash
4a97ff5111 feat(cpus): workaround for Cortex-A520(2938996) and Cortex-X4(2726228)
This patch implements errata functions for two errata, both of them
disable TRBE as a workaround. This patch doesn't have functions
that disable TRBE but only implemented helper functions that are
used to detect cores affected by Errata 2938996(Cortex-A520) & 2726228(Cortex-X4)

Cortex-X4 SDEN documentation:
    https://developer.arm.com/documentation/SDEN2432808/latest

Cortex-A520 SDEN Documentation:
    https://developer.arm.com/documentation/SDEN-2444153/latest

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I8f886a1c21698f546a0996c719cc27dc0a23633a
2024-08-17 09:37:55 +01:00
Manish Pandey
188f8c4b60 feat(cm): handle asymmetry for SPE feature
With introduction of FEAT_STATE_CHECK_ASYMMETRIC, the asymmetry of cores
can be handled. SPE is one of the features which can be asymmetric
across cores.

Add a function to handle this asymmetry by re-visting the feature
presence on running core.
There are two possible cases:
 - If the primary has the feature and secondary does not have it then,
   the feature needs to be disabled.
 - If the primary does not have the feature and secondary has it then,
   the feature need to be enabled

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ibb2b88b5ef63b3efcb80801898ae8d8967e5c271
2024-08-17 09:36:10 +01:00
Manish Pandey
2f41c9a7be feat(cm): support for asymmetric feature among cores
TF-A assumes that all the cores in a platform has architecture feature
parity, this is evident by the fact that primary sets up the
Non-secure context of secondary cores.

With changing landscape of platforms (e.g. big/little/mid cores), we are
seeing more and more platforms which has feature asymmetry among cores.
There is also a scenario where certain CPU erratum only applies to one
type of cores and requires a feature to be disabled even it supports
the feature.

To handle these scenarios, introduce a hook in warmboot path which would
be called on the running CPU to override any feature disparity in the
NS context stashed up by primary. Note that, re-checking of feature for
Secure/Realm context is not required as the context is created on
running core itself.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I5a01dbda528fa8481a00fdd098b58a7463ed0e22
2024-08-17 09:35:53 +01:00
Manish Pandey
43d1d951dd feat(cpufeat): add new feature state for asymmetric features
Introduce a new feature state CHECK_ASYMMETRIC to cater for the features
which are asymmetric across cores. This state is useful for platforms
which has architectural asymmetric cores (A feature is only present in
one type of core e.g. big).
This state is similar to FEAT_STATE_CHECK (dynamic detection) except
that feature state is also checked on each core during warmboot path and
override the context (just for asymmetric features) which was setup by
core executing CPU_ON call.

Only Non-secure context will be re-checked as secure and realm context
is created on same core.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ic78a0b6ca996e0d7881c43da1a6a0c422f528ef3
2024-08-17 09:35:13 +01:00
Manish V Badarkhe
2d4f264ba5 Merge changes from topic "romlib-fixes" into integration
* changes:
  fix(romlib): wrap indirectly included functions
  fix(arm): remove duplicate jumptable entry
2024-08-17 10:09:06 +02:00
Mark Dykes
abeb8ad6c1 Merge "fix(cpus): workaround for Cortex-A720 erratum 2844092" into integration 2024-08-17 00:18:54 +02:00
Mark Dykes
28e4ec1b39 Merge "fix(cpus): workaround for Cortex-X4 erratum 2816013" into integration 2024-08-17 00:18:02 +02:00
Jimmy Brisson
d95d56bd2b fix(romlib): wrap indirectly included functions
The problem that this resolves is a bit involved; the following
must be met at the same time for some function <to_be_wrapped>:

 * to_be_wrapped must be specified as part of the romlib
 * to_be_wrapped must _not_ be referenced by any translation unit
   in TF-A
 * to_be_wrapped must be referenced by a translation unit in a
   dependent library, mbedtls for example.

Under these circumstances, to_be_wrapped will not be wrapped, and
will instead reference its original definition while simultaneously
residing in romlib.

This is a side effect of two issues with romlib prior to this patch:

 1 to_be_wrapped is expected to wrap by duplicating its definition.
    This causes any condition that links against both the base and
    wrapper functions to be a link error (duplicate symbol definition).
 2 to_be_wrapped is in its own translation unit
    This causes the wrappers to be used by TF-A in an as needed.

The duplicate function definitions can be worked around using the
linker's `--wrap` flag, which redirects all references to a symbol
to resolve to `__wrap_<symbol>` and the original symbol to be
available as `__real_<symbol>`. Most of the changes handle creating
this arguments and passing them to the linker.

Further, once you use the linker's wrap, you will encounter another
issue: if TF-A does not use a function, its wrapper is not present.
This causes link issues when a library and not TF-A uses the wrapper.
Note that this issue would have been resolved previously by ignoring
the wrapper and using the base definition.

This further issue is worked around by concatenating the assembly for
all of the wrappers into a single translation unit. It's possible to
work around this issue in a few other ways, including reordering the
libraries passed to the linker to place libwrapper.a last or grouping
the libraries so that symbols from later libraries may be resolved
with prior libraries.

I chose the translation unit concatenation approach as it revealed
that a jumptable has duplicate symbols within it.

Change-Id: Ie57b5ae69bde2fc8705bdc7a93fae3ddb5341ed9
Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
2024-08-15 10:49:07 -05:00
Charlie Bareham
01959a1656 fix(psci): fix parent parsing in psci_is_last_cpu_to_idle_at_pwrlvl
The function always checks the first parent of the current core
instead parse the tree topology to find the parent at parent level
of the CPU. It is because the current loop has no effect as it uses
a fixed parameter 'my_idx' and returns the FIRST parent of CPU.
Also, it looks for the parent nodes in the array of CPU nodes, but
actually they are in a separate array.

This update allows to parse the PSCI topology tree to find
the parent at parent level of the CPU identified by my_idx.

Fixes: 606b743007 ("feat(psci): add support for OS-initiated mode")
Change-Id: I96fb5ecc154a76b16adca5b5055217b8626c9e66
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-08-06 09:20:29 +01:00
Manish V Badarkhe
1baf62469e Merge changes from topic "ar/asymmetricSupport" into integration
* changes:
  feat(trbe): introduce trbe_disable() function
  feat(spe): introduce spe_disable() function
  chore(spe): rename spe_disable() to spe_stop()
2024-08-05 17:16:52 +02:00
Sona Mathew
12140908a5 fix(cpus): workaround for Cortex-A720 erratum 2844092
Cortex-A720 erratum 2844092 is a Cat B erratum that is present
in revisions r0p0, r0p1 and is fixed in r0p2.

The workaround is to set bit[11] of CPUACTLR4_EL1 register.

SDEN documentation:
https://developer.arm.com/documentation/SDEN-2439421/latest

Change-Id: I3d8eacb26cba42774f1f31c3aae2a0e6fecec614
Signed-off-by: Sona Mathew <sonarebecca.mathew@arm.com>
2024-08-01 13:40:32 -05:00