2.6 The trap-control map
Every EL above EL0 owns a small set of registers that decide what the ELs below it may do. The rules are spread across hundreds of fields. This section is the orientation map: which register to open when something at a lower EL is UNDEFINED or traps unexpectedly. Field-by-field programming for bring-up is in 17.3. Fine-grained traps (HFGRTR_EL2 and the related registers) are in 11.1.
The map
| Area | EL3 controls (affect EL2, EL1, EL0) | EL2 controls (affect EL1, EL0) | EL1 controls (affect EL0) |
|---|---|---|---|
| World, routing, execution state | SCR_EL3: NS/NSE, RW, EEL2, IRQ/FIQ/EA routing | HCR_EL2: RW, TGE, E2H, IMO/FMO/AMO, VM | — |
| Calls and waits | SCR_EL3: SMD (SMC disable), HCE (HVC enable), TWI/TWE | HCR_EL2: TSC (trap SMC), TWI/TWE | SCTLR_EL1: nTWI/nTWE |
| FP / SIMD, SVE, SME | CPTR_EL3: TFP, EZ, ESM | CPTR_EL2: TFP, TZ, TSM (or FPEN, ZEN, SMEN when E2H = 1) | CPACR_EL1: FPEN, ZEN, SMEN |
| Trapping the trap registers | CPTR_EL3.TCPAC (EL2/EL1 accesses to CPTR_EL2/CPACR_EL1) | CPTR_EL2.TCPAC (CPACR_EL1) | — |
| Debug, PMU, trace, SPE | MDCR_EL3: TDA, TDOSA, TPM, SDD, SPD32, NSPB (SPE owner), NSTB (TRBE owner), TTRF, SCCD/MCCD; CPTR_EL3.TTA, TAM | MDCR_EL2: TDE, TDA, TDRA, TDOSA, TPM, TPMCR, HPMN, HPMD, E2PB, TPMS, TTRF; CPTR_EL2.TTA, TAM | MDSCR_EL1, PMUSERENR_EL0, CPACR_EL1.TTA |
| Virtual memory and ID | SCR_EL3: TID3, TID5 (FEAT_IDTE3, a recent addition); otherwise ID-register traps are at EL2 or in the FGT registers | HCR_EL2: TVM/TRVM, TTLB*, TPCP, TPU, TSW, TACR, TIDCP, TID0–TID5, TDZ | SCTLR_EL1: UCI, UCT, DZE, UMA |
| Security extensions | SCR_EL3: APK/API (PAuth), ATA (MTE tags), GCSEn, PIEn, EnSCXT | HCR_EL2: APK/API, ATA, EnSCXT; HCRX_EL2.GCSEn | SCTLR_EL1: EnIA/EnIB/EnDA/EnDB, ATA0, TSCXT |
| Extension-register gates | SCR_EL3: HXEn, TCR2En, SCTLR2En, FGTEn, D128En, ECVEn | HCRX_EL2: TCR2En, SCTLR2En, D128En | — |
| Newer instructions | SCR_EL3: TRNDR (RNDR), EnTP2 (SME TPIDR2), ADEn/EnAS0 (LS64), AMVOFFEN | HCRX_EL2: MSCEn/MCE2 (MOPS), EnALS/EnASR/EnAS0 (LS64), TALLINT, EnFPM | SCTLR_EL1: MSCEn, EnALS/EnASR/EnAS0, EnTP2 |
Some cells name fields that exist only with a particular feature, and the list is not exhaustive. Its purpose is to tell you which register’s description to read. The register descriptions in the System Register XML are the authority.
Reading the map: three rules
1. Polarity varies, so read each field. Arm has mixed “trap” and “enable” fields since v8.0, and the newer the field, the more likely it is an enable:
| Field | Value that permits the feature | Kind |
|---|---|---|
CPTR_EL3.TFP | 0 | trap |
CPTR_EL3.EZ, CPTR_EL3.ESM | 1 | enable |
SCR_EL3.SMD | 0 | disable |
SCR_EL3.HCE | 1 | enable |
SCR_EL3.APK, SCR_EL3.API | 1 | “do not trap” |
SCR_EL3.TRNDR | 0 | trap |
CPACR_EL1.FPEN | 0b11 | two-bit enable (EL0 and EL1 separately) |
Many of these fields reset to UNKNOWN values. Firmware must write every field of SCR_EL3, CPTR_EL3 and MDCR_EL3 deliberately, which is why TF-A builds them from explicit per-feature values instead of read-modify-write.
2. The same register can change shape. CPTR_EL2 has two layouts. With HCR_EL2.E2H = 0 it uses TFP/TZ/TSM trap bits. With E2H = 1 it uses the CPACR_EL1-style FPEN/ZEN/SMEN fields, so that a VHE host kernel can program it like CPACR_EL1. Code that sets CPTR_EL2 before deciding E2H programs the wrong layout.
3. Every trap at every EL applies. A lower-EL access is permitted only if no control at any higher EL traps or disables it. When several apply, the Arm ARM defines a priority, normally favouring the trap to the lowest target EL. The authoritative order is each register’s or instruction’s accessibility pseudocode (2.5). The exception class tells you which family fired:
| Symptom (ESR EC) | Typical cause |
|---|---|
| 0x00 | UNDEFINED: feature absent, or an enable such as MSCEn is effectively 0 |
| 0x07 | FP/SIMD trapped (FPEN, TFP) |
| 0x14 | 128-bit MRRS/MSRR trapped (D128En) |
| 0x16 / 0x17 | HVC / SMC routed, or trapped by HCR_EL2.TSC (0x17) |
| 0x18 | MSR/MRS/SYS trapped: by SCR_EL3.*En, HCR_EL2.T*, MDCR_ELx.T*, or FGT |
| 0x19 | SVE trapped (ZEN, TZ, EZ) |
| 0x1D | SME trapped (SMEN, TSM, ESM) |
Extension registers: HCRX_EL2, TCR2_ELx, SCTLR2_ELx
HCR_EL2, TCR_ELx and SCTLR_ELx ran out of free bits, so Arm added companion registers rather than reusing RES0 fields with new meanings:
HCRX_EL2(FEAT_HCX, mandatory from v8.7; see DDI0487 A2 for the earliest version that permits it) holds the EL2 controls for newer features: MOPS, LS64, NMI (TALLINT,VINMI/VFNMI), the XS attribute (FnXS),CMOW,GCSEn,D128En,TCR2En/SCTLR2En, and others.TCR2_ELx(FEAT_TCR2) extends translation control:PIE(permission indirection),POE/E0POE(permission overlays),D128,AIE,HAFT, and others. See 5.2.SCTLR2_ELx(FEAT_SCTLR2) extends system control with fields such asNMEA,EASE,EnADERR/EnANERRfor the newer RAS and abort behaviours, and the PAC-relatedEnPACM. See 3.3.
Each extension register is itself gated by the EL above it. Until EL3 sets SCR_EL3.HXEn, EL2’s accesses to HCRX_EL2 trap to EL3, and (with EL2 enabled) its fields take effective values that mostly disable the features. Until EL3 sets SCR_EL3.TCR2En and SCR_EL3.SCTLR2En, and EL2 sets HCRX_EL2.TCR2En and HCRX_EL2.SCTLR2En, the lower ELs’ accesses to TCR2_EL1/SCTLR2_EL1 trap. When EL2 is not implemented or not enabled, the HCRX_EL2 gates for TCR2En, SCTLR2En and D128En behave as 1, so a system without a hypervisor needs only the EL3 enables.
The pattern: features arrive disabled or trapped
Almost every feature added since v8.3 that adds architectural state or a new privilege-sensitive operation follows the same rule:
On a system where higher-EL software predates the feature, the feature is invisible or inert to lower ELs. It becomes usable only when each higher EL, in turn, opts in.
That is what keeps a v8.0-era EL3 or hypervisor safe on a newer core. Firmware that does not know about MTE tags, PAuth keys, SME’s ZA or GCS cannot fail to context-switch state it has never enabled. The corresponding bring-up consequence is that every new feature needs work at every EL above the one that uses it. For a Linux kernel at EL1 to use TCR2_EL1.PIE under KVM, EL3 must set SCR_EL3.HXEn, SCR_EL3.TCR2En and SCR_EL3.PIEn, EL2 must set HCRX_EL2.TCR2En (and the FGT or PIEn-related controls must not trap), and only then can EL1 program TCR2_EL1. Where a feature adds state, as SVE, SME, MTE tags, PAuth keys and GCS pointers do, the EL that enables it also takes on the obligation to save and restore that state across every world or VM switch it performs.
Security note: Enabling a feature at EL3 is a security decision, not just plumbing. Setting
CPTR_EL3.EZwithout saving and restoringZCR_EL2/Zstate on world switches leaks Secure vector state to the Normal world, or the reverse. SettingSCR_EL3.APKwithout per-world key management lets Normal-world code observe or influence the keys the Secure world uses. TF-A ties eachENABLE_FEAT_*build option to both the enable bit and the matching context-management code for this reason.
Bring-up note: When a newly enabled kernel feature dies at its first use with an exception at EL3 (EC 0x18 or 0x14 in
ESR_EL3), decode the ISS to get the register (2.5), then find whichSCR_EL3/CPTR_EL3/MDCR_EL3field gates it. In TF-A, that usually means a missingENABLE_FEAT_<X>=1(or=2, which enables the feature at runtime only if the ID register reports it) in the platform makefile. If the exception lands at EL2 instead, apply the same method toHCR_EL2/HCRX_EL2/CPTR_EL2/MDCR_EL2and the FGT registers.
Checkpoint
Q2.6.1 On a system with no EL2, EL3 firmware sets SCR_EL3.TCR2En = 1 but never sets SCR_EL3.HXEn. Can the EL1 kernel access TCR2_EL1?
- A. No:
HCRX_EL2.TCR2Enis also required, and it is inaccessible whileHXEn = 0 - B. Yes: when EL2 is not implemented or not enabled, the
HCRX_EL2.TCR2Engate behaves as 1, so only the EL3 enable matters - C. No:
TCR2_EL1exists only when FEAT_VHE is in use - D. Yes, but only after the kernel also sets
SCTLR2_EL1.TCR2En
Answer
B. HCRX_EL2.TCR2En has an effective value of 1 when EL2 is not implemented or not enabled in the current Security state, so the EL2 gate disappears and SCR_EL3.TCR2En alone decides. A is the right answer for a system with an enabled EL2, where HXEn = 0 makes the HCRX gates effectively 0. There is no SCTLR2_EL1.TCR2En field, so D is wrong.
Read more: Arm ARM (DDI0487), HCRX_EL2.TCR2En and SCR_EL3.TCR2En; TCR2_EL1 accessibility
Q2.6.2 A hypervisor running with HCR_EL2.E2H = 1 writes CPTR_EL2 with the value it used when it ran non-VHE (TFP = 0, TZ = 0, everything else 0). Guests now take FP traps to EL2. Why?
- A.
CPTR_EL3.TFPis set, and EL3 traps are reported at EL2 - B. With E2H = 1, FP traps from EL1 are always taken to EL2
- C.
CPACR_EL1.FPENmust be 0b11 in the guest as well, and it reset to 0 - D. With E2H = 1,
CPTR_EL2uses theFPEN/ZENlayout, so writing 0 there setsFPEN = 0b00, which traps FP
Answer
D. The CPTR_EL2 layout depends on E2H. In the VHE layout, FPEN is an enable field at bits [21:20], and 0 means “trap”. The non-VHE value of all-zeros therefore enables trapping. A is wrong because EL3 traps are taken to EL3. C could cause FP traps, but those would be taken to EL1, not EL2.
Read more: Arm ARM (DDI0487), CPTR_EL2 (both layouts); “Virtualization Host Extensions”
Q2.6.3 Why does the architecture make new features such as GCS or permission indirection disabled at lower ELs until each higher EL enables them, rather than enabled by default?
- A. To save power: disabled features are clock-gated
- B. Because ID registers cannot report a feature until it is enabled
- C. So that higher-EL software that predates the feature cannot be undermined by lower-EL state or behaviour it does not know to save, restore or virtualise
- D. Because the reset values of the enable fields are fixed by the Arm ARM as 0 on cold reset
Answer
C. A pre-GCS hypervisor does not context-switch GCSPR_EL1. If guests could enable GCS without it, state would leak or be corrupted between VMs. Opt-in at every level lets new cores run old firmware safely. B is wrong, since ID registers report implemented features independently of enables. D is wrong as a general claim: many enable fields reset to UNKNOWN, which is why firmware must program them explicitly.
Read more: Arm ARM (DDI0487), SCR_EL3, HCRX_EL2; Arm “Learn the architecture: AArch64 exception model”