fix(cm): disable SPE/TRBE correctlySPE and TRBE are unusual features. They have multi-bit enables whosefunction is not immediately apparent and disabling them is notstraightforward.While attemp
fix(cm): disable SPE/TRBE correctlySPE and TRBE are unusual features. They have multi-bit enables whosefunction is not immediately apparent and disabling them is notstraightforward.While attempting to figure this out, the disables were made a mess of.Patch fc7dca72b began changing the owning security state of SPE andTRBE. This was first used in patch 79c0c7fac0 with calls tospe_disable() and trbe_disbale(). However, patch 13f4a2525 reverted thesecurity state ownership, making the spe_disable() and trbe_disable()redundant and their comments incorrect - the DoS protection is achievedby the psb/tsb barriers on context switch, introduces separately inf80887337 and 73d98e375.Those patches got the behaviour full circle to what it was in fc7dca72bso the disables can be fully removed for clarity.However, the original method for disabling these features is not fullycorrect - letting the "disabled" state be all zeroes made the featuresseem enabled for secure world but they would trap. That is not a problemwhile secure world doesn't use them, but could lead to some confusingdebugging in the future. NS and Realm worlds were not affected. Thispatch fully establishes the pattern for SPE and TRBE's enablement,documents it, and implements it such.The description comments in the features boil down to 2 rules. There isa third rule possible:3. To enable TRBE/SPE for world X with a dirty buffer: * world X owns the buffer * trapping enabledThis is not listed as it would not work correctly withSMCCC_ARCH_FEATURE_AVAILABILITY which relies on trapping to be disabledto report correctly. If that is ever implemented, the SMCCCimplementation should be considered too.Change-Id: I5588a3d5fc074c2445470954d8c3b172bec77d43Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
refactor(cm): change owning security state when a feature is disabledSPE and TRBE don't have an outright EL3 disable, there are onlyconstraints on what's allowed. Since we only enable them for NS
refactor(cm): change owning security state when a feature is disabledSPE and TRBE don't have an outright EL3 disable, there are onlyconstraints on what's allowed. Since we only enable them for NS at themoment, we want NS to own the buffers even when the feature should be"disabled" for a world. This means that when we're running in NSeverything is as normal but when running in S/RL then tracing isprohibited (since the buffers are owned by NS). This allows us to fiddlewith context a bit more without having to context switch registers.Change-Id: Ie1dc7c00e4cf9bcc746f02ae43633acca32d3758Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
fix(brbe): allow RME builds with BRBEIt used to be the case that a FEAT_RME build could not be built withFEAT_BRBE support. BRBE doesn't have a 3-world aware disable andMDCR_EL3 was not context s
fix(brbe): allow RME builds with BRBEIt used to be the case that a FEAT_RME build could not be built withFEAT_BRBE support. BRBE doesn't have a 3-world aware disable andMDCR_EL3 was not context switched to allow for disabling in Realm world.As of commit 123002f9171384d976d95935b7f566740d69cc68 MDCR_EL3 iscontext switched. Since the flag for BRBE support isENABLE_BRBE_FOR_NS, move brbe_enable() to only happen for NS world. Theother 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 isneeded if non-NS support is required.Change-Id: I82f0f08399dcd080902477dc9636bc4541685f89Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
feat(cm): context switch MDCR_EL3 registerCurrently MDCR_EL3 register value is same for all theworlds(Non-secure, Secure, Realm and Root).With this approach, features enable/disable settingsrem
feat(cm): context switch MDCR_EL3 registerCurrently MDCR_EL3 register value is same for all theworlds(Non-secure, Secure, Realm and Root).With this approach, features enable/disable settingsremain same across all the worlds. This is not ideal asthere must be flexibility in controlling feature as perthe requirements for individual world.The patch addresses this by providing MDCR_EL3 a per worldvalue. Features with identical values for all the worlds aregrouped under ``manage_extensions_common`` API.Change-Id: Ibc068d985fe165d8cb6d0ffb84119bffd743b3d1Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
refactor(cpufeat): separate the EL2 and EL3 enablement codeCombining the EL2 and EL3 enablement code necessitates that it must becalled at el3_exit, which is the only place with enough context to
refactor(cpufeat): separate the EL2 and EL3 enablement codeCombining the EL2 and EL3 enablement code necessitates that it must becalled at el3_exit, which is the only place with enough context to makethe 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
refactor(brbe): enable FEAT_BRBE for FEAT_STATE_CHECKEDAt the moment we only support FEAT_BRBE to be either unconditionallycompiled in, or to be not supported at all.Add support for runtime dete
refactor(brbe): enable FEAT_BRBE for FEAT_STATE_CHECKEDAt the moment we only support FEAT_BRBE to be either unconditionallycompiled in, or to be not supported at all.Add support for runtime detection (ENABLE_BRBE_FOR_NS=2), by splittingis_feat_brbe_present() into an ID register reading function and a secondfunction to report the support status. That function considers bothbuild time settings and runtime information (if needed), and is usedbefore we access BRBE related registers.The FVP platform decided to compile in support unconditionally (=1),even though FEAT_BRBE is an ARMv9 feature, so is not available with theFVP model's default command line.Change that to the now supported dynamic option (=2), so the rightdecision can be made by the code at runtime.Change-Id: I5f2e2c9648300f65f0fa9a5f8e2f34e73529d053Signed-off-by: Andre Przywara <andre.przywara@arm.com>
feat(brbe): add brbe under feature detection mechanismThis change adds "FEAT_BRBE" to be part of feature detection mechanism.Previously feature enablement flags were of boolean type, possessinge
feat(brbe): add brbe under feature detection mechanismThis change adds "FEAT_BRBE" to be part of feature detection mechanism.Previously feature enablement flags were of boolean type, possessingeither 0 or 1. With the introduction of feature detection procedurewe now support three states for feature enablement build flags(0 to 2).Accordingly, "ENABLE_BRBE_FOR_NS" flag is now modified from booleanto numeric type to align with the feature detection.Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>Change-Id: I1eb52863b4afb10b808e2f0b6584a8a210d0f38c
feat(brbe): add BRBE support for NS worldThis patch enables access to the branch record buffer control registersin non-secure EL2 and EL1 using the new build option ENABLE_BRBE_FOR_NS.It is disab
feat(brbe): add BRBE support for NS worldThis patch enables access to the branch record buffer control registersin non-secure EL2 and EL1 using the new build option ENABLE_BRBE_FOR_NS.It is disabled for all secure world, and cannot be used with ENABLE_RME.This option is disabled by default, however, the FVP platform makefileenables it for FVP builds.Signed-off-by: John Powell <john.powell@arm.com>Change-Id: I576a49d446a8a73286ea6417c16bd0b8de71fca0