| #
4087ed6c |
| 11-Dec-2023 |
Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> |
refactor(cm): reset the cptr_el3 before perworld context setup
Currently, the registers which are maintained per-world, does not take into account the reset value while configuring the context for t
refactor(cm): reset the cptr_el3 before perworld context setup
Currently, the registers which are maintained per-world, does not take into account the reset value while configuring the context for the respective world. This leads to an issue, wherein the register retains the same value across world switch, which is an error.
This patch addresses this problem, by configuring the register (cptr_el3) precisely according to the world, the cpu is in execution via resetting it before initializing the world specific context.
Change-Id: I592d82af373155fca67eed109c199341c305f0b9 Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
show more ...
|
| #
e5e39c35 |
| 07-Nov-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge "refactor(cm): introduce INIT_UNUSED_NS_EL2 macro" into integration
|
| #
183329a5 |
| 15-Aug-2023 |
Arvind Ram Prakash <arvind.ramprakash@arm.com> |
refactor(cm): introduce INIT_UNUSED_NS_EL2 macro
Introducing INIT_UNUSED_NS_EL2 macro which guards the code that disables the unused EL2 when a platform hands off from EL3 to NS-EL1 instead of NS-EL
refactor(cm): introduce INIT_UNUSED_NS_EL2 macro
Introducing INIT_UNUSED_NS_EL2 macro which guards the code that disables the unused EL2 when a platform hands off from EL3 to NS-EL1 instead of NS-EL2. Platforms without NS-EL2 in use must enable this flag.
BREAKING CHANGE: Initialisation code for handoff from EL3 to NS-EL1 disabled by default. Platforms which do that need to enable this macro going forward
Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com> Change-Id: I61431cc4f7e2feb568d472828e5fd79cc73e51f5
show more ...
|
| #
95620113 |
| 31-Oct-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge "refactor(cm): move EL3 registers to global context" into integration
|
| #
461c0a5d |
| 18-Jul-2023 |
Elizabeth Ho <elizabeth.ho@arm.com> |
refactor(cm): move EL3 registers to global context
Currently, EL3 context registers are duplicated per-world per-cpu. Some registers have the same value across all CPUs, so this patch moves these re
refactor(cm): move EL3 registers to global context
Currently, EL3 context registers are duplicated per-world per-cpu. Some registers have the same value across all CPUs, so this patch moves these registers out into a per-world context to reduce memory usage.
Change-Id: I91294e3d5f4af21a58c23599af2bdbd2a747c54a Signed-off-by: Elizabeth Ho <elizabeth.ho@arm.com> Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
show more ...
|
| #
0e1dc0f2 |
| 25-Oct-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge "fix(mpam): refine MPAM initialization and enablement process" into integration
|
| #
edebefbc |
| 11-Oct-2023 |
Arvind Ram Prakash <arvind.ramprakash@arm.com> |
fix(mpam): refine MPAM initialization and enablement process
Restricts MPAM to only NS world and enables trap to EL3 for access of MPAM registers from lower ELs of Secure and Realm world.
This patc
fix(mpam): refine MPAM initialization and enablement process
Restricts MPAM to only NS world and enables trap to EL3 for access of MPAM registers from lower ELs of Secure and Realm world.
This patch removes MPAM enablement from global context and adds it to EL3 State context which enables/disables MPAM during world switches. Renamed ENABLE_MPAM_FOR_LOWER_ELS to ENABLE_FEAT_MPAM and removed mpam_init_el3() as RESET behaviour is trapping.
Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com> Change-Id: I131f9dba5df236a71959b2d425ee11af7f3c38c4
show more ...
|
| #
01582a78 |
| 06-Oct-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(cm): enable S-EL2 globally for all contexts refactor(cm): remove world differentiation for EL2 context restore
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(cm): enable S-EL2 globally for all contexts refactor(cm): remove world differentiation for EL2 context restore fix(cm): make ICC_SRE_EL2 fixup generic to all worlds refactor(cm): clean up SCR_EL3 and CPTR_EL3 initialization
show more ...
|
| #
9f4b6259 |
| 22-Sep-2023 |
Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> |
refactor(cm): enable S-EL2 globally for all contexts
Currently, S-EL2 is being enabled specifically while we are in secure context and gets toggled up when we exit secure world. This behavior is not
refactor(cm): enable S-EL2 globally for all contexts
Currently, S-EL2 is being enabled specifically while we are in secure context and gets toggled up when we exit secure world. This behavior is not ideal and needs correction.
Enabling the S-EL2 via SCR_EL3.EEL2 register setting should be global and this patch addresses it.
Change-Id: If6c39ca258f2fefa835c4b51e0f6b68165fd2e35 Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
show more ...
|
| #
5c52d7e5 |
| 22-May-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): remove world differentiation for EL2 context restore
The EL2 context save/restore functions have an optimisation to not bother with the EL2 context when SEL2 is not in use. However, th
refactor(cm): remove world differentiation for EL2 context restore
The EL2 context save/restore functions have an optimisation to not bother with the EL2 context when SEL2 is not in use. However, this decision is made on the current value of SCR_EL3.EEL2, which is not the value for the selected security state, but rather, for the security state that came before it. This relies on the EEL2 bit's value to propagate identically to all worlds.
This has an unintended side effect that for the first entry into secure world, the restoring of the context is fully skipped, because SCR_EL3 is only initialized after the call to the restoring routine which means the EEL2 bit is not initialized (except when FEAT_RME is present). This is inconsistent with normal and realm worlds which always get their EL2 registers zeroed.
Remove this optimization to remove all the complexity with managing the EEL2 bit's value. Instead unconditionally save/restore all registers. It is worth noting that there is no performance penalty in the case where SEL2 is empty with this change. This is because SEL2 will never be entered, and as such no secure save/restore will happen anyway, while normal world remains unchanged.
Removing the value management of the EEL2 bit causes the CTX_ICC_SRE_EL2 register to be inaccessible in Secure world for some configurations. Make the SCR_EL3.NS workaround in cm_prepare_el3_exit_ns() generic on every access to the register.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I1f56d85814c5897b468e82d4bd4a08e3a90a7f8f
show more ...
|
| #
5e8cc727 |
| 23-May-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
fix(cm): make ICC_SRE_EL2 fixup generic to all worlds
For ICC_SRE_EL2.SRE the Arm ARM specifies that "If software changes this bit from 1 to 0, the results are UNPREDICTABLE". However, the indiscrim
fix(cm): make ICC_SRE_EL2 fixup generic to all worlds
For ICC_SRE_EL2.SRE the Arm ARM specifies that "If software changes this bit from 1 to 0, the results are UNPREDICTABLE". However, the indiscriminate zeroing of the EL2 context does just that for Secure and Realm worlds. Make this fixup generic to avoid the problem.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> Change-Id: Iee21ace17faf10eae52a046e6dfafc5141fa7f85
show more ...
|
| #
f0c96a2e |
| 20-Apr-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): clean up SCR_EL3 and CPTR_EL3 initialization
As with MDCR_EL3, setting some bits of these registers is redundant at reset since they do not matter for EL3 execution and the registers g
refactor(cm): clean up SCR_EL3 and CPTR_EL3 initialization
As with MDCR_EL3, setting some bits of these registers is redundant at reset since they do not matter for EL3 execution and the registers get context switched so they get overwritten anyway.
The SCR_EL3.{TWE, TWI, SMD, API, APK} bits only affect lower ELs so their place is in context management. The API and APK bits are a bit special as they would get implicitly unset for secure world when CTX_INCLUDE_PAUTH_REGS is unset. This is now explicit with their normal world values being always set as PAuth defaults to enabled. The same sequence is also added to realm world too. The reasoning is the same as for Secure world - PAuth will be enabled for NS, and unless explicitly handled by firmware, it should not leak to realm.
The CPTR_EL3.{ESM, EZ, TAM} bits are set by the relevant feat_enable()s in lib/extensions so they can be skipped too.
CPTR_EL3.TFP is special as it's needed for access to generic floating point registers even when SVE is not present. So keep it but move to context management.
This leaves CPTR_EL3.TCPAC which affects several extensions. This bit was set centrally at reset, however the earliest need for it is in BL2. So set it in cm_setup_context_common(). However, this CPTR_EL3 is only restored for BL31 which is clearly not the case. So always restore it.
Finally, setting CPTR_EL3 to a fresh RESET_VAL for each security state prevents any bits from leaking between them.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com> Change-Id: Ie7095e967bd4a6d6ca6acf314c7086d89fec8900
show more ...
|
| #
6a62ddff |
| 30-Aug-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge "feat(cpufeat): initialize HFG*_EL2 registers" into integration
|
| #
29440a2f |
| 17-Aug-2023 |
Manish V Badarkhe <manish.badarkhe@arm.com> |
Merge "refactor(cm): move remaining EL2 save/restore into C" into integration
|
| #
ac58e574 |
| 15-May-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): move remaining EL2 save/restore into C
MTE and common system registers are the last remaining EL2 save/restores in assembly. Convert them to C, like all the others.
Signed-off-by: Boy
refactor(cm): move remaining EL2 save/restore into C
MTE and common system registers are the last remaining EL2 save/restores in assembly. Convert them to C, like all the others.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: If690f792e70b97fd4b4cd5f43847a71719b128f1
show more ...
|
| #
4a530b4c |
| 10-Jul-2023 |
Juan Pablo Conde <juanpablo.conde@arm.com> |
feat(cpufeat): initialize HFG*_EL2 registers
HFG*_EL2 registers control the fine-grained traps introduced by FEAT_FGT. These traps come enabled by default so old systems unaware of this feature can
feat(cpufeat): initialize HFG*_EL2 registers
HFG*_EL2 registers control the fine-grained traps introduced by FEAT_FGT. These traps come enabled by default so old systems unaware of this feature can be trapped to EL3, not being able to handle the trap correctly. This patch disables all fine-grained traps by default to prevent such unexpected behavior.
Change-Id: If2ae97accbeed2bea51ae03b5225ce762ecffb25 Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
show more ...
|
| #
e2ce7d34 |
| 24-Jul-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(psci): extract cm_prepare_el3_exit_ns() to a common location refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respe
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(psci): extract cm_prepare_el3_exit_ns() to a common location refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respective feat_init_el3() only fix(cm): set MDCR_EL3.{NSPBE, STE} explicitly refactor(cm): factor out EL2 register setting when EL2 is unused
show more ...
|
| #
ece8f7d7 |
| 13-Feb-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respective feat_init_el3() only
These bits (MDCR_EL3.{NSTB, NSTBE, TTRF, TPM}, CPTR_EL3.TTA) only affect EL2 (and lower) execution. Each feat_init_el3() i
refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respective feat_init_el3() only
These bits (MDCR_EL3.{NSTB, NSTBE, TTRF, TPM}, CPTR_EL3.TTA) only affect EL2 (and lower) execution. Each feat_init_el3() is called long before any lower EL has had a chance to execute, so setting the bits at reset is redundant. Removing them from reset code also improves readability of the immutable EL3 state.
Preserve the original intention for the TTA bit of "enabled for NS and disabled everywhere else" (inferred from commit messages d4582d3088 and 2031d6166a and the comment). This is because CPTR_EL3 will be contexted and so everyone will eventually get whatever NS has anyway.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I3d24b45d3ea80882c8e450b2d9db9d5531facec1
show more ...
|
| #
b48bd790 |
| 08-Mar-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): factor out EL2 register setting when EL2 is unused
A bunch of registers need to be initialized when EL2 is unused. There are a lot of them which makes cm_prepare_el3_exit() quite unrea
refactor(cm): factor out EL2 register setting when EL2 is unused
A bunch of registers need to be initialized when EL2 is unused. There are a lot of them which makes cm_prepare_el3_exit() quite unreadable. Put them in their own function to improve this.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: If07954ed799643f89f177411d4266bb7c21cd394
show more ...
|
| #
a2d43637 |
| 17-Jul-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(amu): separate the EL2 and EL3 enablement code refactor(cpufeat): separate the EL2 and EL3 enablement code
|
| #
4085a02c |
| 27-Mar-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(amu): separate the EL2 and EL3 enablement code
Combining the EL2 and EL3 enablement code necessitates that it must be called at el3_exit, which is the only place with enough context to make
refactor(amu): separate the EL2 and EL3 enablement code
Combining the EL2 and EL3 enablement code necessitates that it must be called at el3_exit, which is the only place with enough context to make the decision of what needs to be set. Decouple them to allow them to be called from elsewhere. Also take some time to clarify and simplify AMU code.
The sanity check in the context_restore() is now wrong, as the cpu may turn off on suspend, thus resetting the value of the counter enables. Remove it.
Finally, this completes the migration to cm_manage_extensions_el3() and manage_extensions_nonsecure() so manage_extensions_nonsecure_mixed() is being removed.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I66399132364c32be66017506bb54cbadd8485577
show more ...
|
| #
60d330dc |
| 16-Feb-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cpufeat): separate the EL2 and EL3 enablement code
Combining the EL2 and EL3 enablement code necessitates that it must be called at el3_exit, which is the only place with enough context to
refactor(cpufeat): separate the EL2 and EL3 enablement code
Combining the EL2 and EL3 enablement code necessitates that it must be called at el3_exit, which is the only place with enough context to make the decision of what needs to be set. Decouple them to allow them to be called from elsewhere.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I147764c42771e7d4100699ec8fae98dac0a505c0
show more ...
|
| #
26d67076 |
| 29-Jun-2023 |
Manish Pandey <manish.pandey2@arm.com> |
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(pmu): convert FEAT_MTPMU to C and move to persistent register init feat(pmu): introduce pmuv3 lib/extensions f
Merge changes from topic "bk/context_refactor" into integration
* changes: refactor(pmu): convert FEAT_MTPMU to C and move to persistent register init feat(pmu): introduce pmuv3 lib/extensions folder fix(pmu): make MDCR_EL3.MTPME=1 out of reset refactor(cm): introduce a real manage_extensions_nonsecure()
show more ...
|
| #
c73686a1 |
| 15-Feb-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
feat(pmu): introduce pmuv3 lib/extensions folder
The enablement code for the PMU is scattered and difficult to track down. Factor out the feature into its own lib/extensions folder and consolidate t
feat(pmu): introduce pmuv3 lib/extensions folder
The enablement code for the PMU is scattered and difficult to track down. Factor out the feature into its own lib/extensions folder and consolidate the implementation. Treat it is as an architecturally mandatory feature as it is currently.
Additionally, do some cleanup on AArch64. Setting overflow bits in PMCR_EL0 is irrelevant for firmware so don't do it. Then delay the PMU initialisation until the context management stage which simplifies the early environment assembly. One side effect is that the PMU might count before this happens so reset all counters to 0 to prevent any leakage.
Finally, add an enable to manage_extensions_realm() as realm world uses the pmu. This introduces the HPMN fixup to realm world.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: Ie13a8625820ecc5fbfa467dc6ca18025bf6a9cd3
show more ...
|
| #
24a70738 |
| 08-Mar-2023 |
Boyan Karatotev <boyan.karatotev@arm.com> |
refactor(cm): introduce a real manage_extensions_nonsecure()
manage_extensions_nonsecure() is problematic because it updates both context and in-place registers (unlike its secure/realm counterparts
refactor(cm): introduce a real manage_extensions_nonsecure()
manage_extensions_nonsecure() is problematic because it updates both context and in-place registers (unlike its secure/realm counterparts). The in-place register updates make it particularly tricky, as those never change for the lifetime of TF-A. However, they are only set when exiting to NS world. As such, all of TF-A's execution before that operates under a different context. This is inconsistent and could cause problems.
This patch Introduce a real manage_extensions_nonsecure() which only operates on the context structure. It also introduces a cm_manage_extensions_el3() which only operates on register in-place that are not context switched. It is called in BL31's entrypoints so that all of TF-A executes with the same environment once all features have been converted.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: Ic579f86c41026d2054863ef44893e0ba4c591da9
show more ...
|