3.4 SError, architecturally
What an SError is
An SError is the asynchronous member of the exception classes (3.1), and the architecture’s channel for errors that cannot be, or were not, reported synchronously. Physical sources include:
- Asynchronous External aborts. A memory access completes with an error response from the interconnect or the slave (for example a decode error for a posted write to a hole in the map, or a slave error from a powered-down peripheral) after the instruction that issued it has retired. Writes are the classic case, because a store can retire before its response returns.
- RAS errors reported asynchronously. These include an uncorrectable ECC error found on a cache eviction or by a scrubber, poison that was deferred rather than consumed, and errors in structures not tied to any instruction. Error nodes are described in 16.7.
- IMPLEMENTATION DEFINED sources, such as a core-internal parity error.
There are also virtual SErrors, pended by HCR_EL2.VSE with syndrome from VSESR_EL2 (11.4), and, with FEAT_E3DSE, delegated SErrors that EL3 pends for EL2/EL1/EL0 through SCR_EL3.DSE (enabled by SCR_EL3.EnDSE).
Whether a particular bus error is reported synchronously (as an Abort EC) or as an SError is IMPLEMENTATION DEFINED in general. Loads are usually synchronous, posted stores are usually asynchronous, and the system interconnect has a say as well.
Routing is by SCR_EL3.EA and HCR_EL2.AMO, and masking is by PSTATE.A, with the FEAT_DoubleFault/DoubleFault2 refinements covered in 3.3. Remember that SCR_EL3.EA == 0 means that at EL3 SErrors are not taken at all.
Syndrome: the SError ISS (EC 0x2F)
Before FEAT_RAS, the SError ISS was IMPLEMENTATION DEFINED. FEAT_RAS (mandatory from v8.2) defines the architected layout used when IDS == 0:
| Bits | Field | Meaning |
|---|---|---|
[24] | IDS | 1 = bits [23:0] are IMPLEMENTATION DEFINED. Nothing below is valid |
[18] | ELS | FEAT_RASv2: 1 = a synchronous exception triggered by the instruction at ELR_ELx |
[17:16] | WU | FEAT_RASv2: whether a store that generated the abort updated the location |
[15] | VFV | FEAT_RASv2: FAR_ELx holds a valid VA for the error |
[14] | PFV | FEAT_PFAR: PFAR_ELx is valid |
[13] | IESB | FEAT_IESB: synchronized by an implicit ESB and taken immediately |
[12:10] | AET | Asynchronous Error Type (below) |
[9] | EA | IMPLEMENTATION DEFINED classification of External aborts |
[7:6] | WnRV, WnR | FEAT_RASv2: Write-not-Read information |
[5:0] | DFSC | 0b000000 Uncategorized, 0b010001 Asynchronous SError. Other values reserved |
AET, EA, IESB and the RASv2/PFAR fields are defined only when DFSC == 0b010001, and are RES0 otherwise. With DFSC == 0b000000, the error is “uncategorized” and the handler knows nothing about its containment.
AET | Name | State of the PE after the error |
|---|---|---|
0b000 | UC, Uncontainable | the error may have spread arbitrarily. Isolate or reset the system |
0b001 | UEU, Unrecoverable | contained, but the PE state is corrupted. The interrupted context cannot continue |
0b010 | UEO, Restartable | the PE state is not corrupted. Execution can resume from ELR_ELx |
0b011 | UER, Recoverable | the error is contained and was synchronized by an error synchronization event. Execution cannot simply resume, but software can recover by isolating the affected context (for example by terminating the thread that consumed the data) |
0b110 | CE, Corrected | informational |
The precise definitions are in the RAS specification (DDI0587). Linux’s arm64_is_fatal_ras_serror() is a useful reference mapping. It treats IDS == 1, an uncategorized DFSC, UC, UEU and UER as fatal, and only CE and UEO as survivable. That is a policy choice for this path (the kernel does not attempt UER recovery from an SError), not an architectural rule.
ESB and deferred errors
ESB (Error Synchronization Barrier, HINT #16, a NOP without FEAT_RAS) is the explicit error synchronization event. After an ESB, any physical SError that the error-synchronization rules require to be synchronized is pending. What happens next depends on masking:
- SError can be taken (unmasked, or targeting a higher EL): it is taken, at the ESB boundary.
- SError is masked (by
PSTATE.Aat its target EL, or because its target is a lower EL than the current one): the ESB defers it. The pending SError is cleared, and its syndrome is written toDISR_EL1withDISR_EL1.A(bit 31) set.DISR_EL1uses the sameIDS/AET/EA/DFSClayout as the ISS.
DISR_EL1 is the deferral register for EL1, EL2 and EL3, and access to it from lower ELs is redirected:
| Access from | Condition | Access goes to |
|---|---|---|
| EL1 | EL2 enabled and HCR_EL2.AMO == 1 (or the FEAT_DoubleFault2 TMEA condition) | VDISR_EL2 |
| EL1, EL2 | FEAT_E3DSE and effective SCR_EL3.EnDSE == 1 (checked after the EL1 row above) | VDISR_EL3 |
| EL1, EL2 | otherwise, SCR_EL3.EA == 1 | RAZ/WI |
| EL3 | always | DISR_EL1 |
At EL1 under a hypervisor with AMO == 1, physical SErrors target EL2, so an EL1 ESB can only defer a virtual SError. It records the syndrome (from VSESR_EL2) in VDISR_EL2 and clears HCR_EL2.VSE. The guest reads its DISR_EL1 and transparently gets VDISR_EL2.
The idiom, used by KVM on every guest exit, consumes errors without an unmask/remask window:
// at EL2, PSTATE.A == 1 after exception entry
esb // synchronize errors from the guest's instructions
mrs x1, DISR_EL1
tbnz x1, #31, guest_serror // A set: the error belongs to the guest, not to EL2
// guest_serror must clear DISR_EL1 (msr DISR_EL1, xzr); reading it does not clear A
IESB: implicit error synchronization
FEAT_IESB (permitted from v8.2) adds SCTLR_ELx.IESB (bit 21). When it is set, an implicit error synchronization event is inserted at every exception entry to ELx and every exception return from ELx. Errors caused by code before the boundary are therefore synchronized at the boundary, so they cannot leak into the next context and be blamed on it.
- If the synchronized SError can be taken immediately, it is taken, and
ESR_ELx.IESB == 1tells the handler that it belongs to the code before the boundary. An example is anERETfrom EL1 withSCR_EL3.EA == 1, where the target is EL3 and the error is unmasked. - If it is masked, which is the normal case on entry because entry sets
PSTATE.A, it stays pending, and the handler’s first explicitESBdefers it intoDISR_EL1as above. The implicit event itself does not defer anything and does not writeDISR_EL1: only theESBinstruction does.
When SCR_EL3.NMEA is effectively 1, SCTLR_EL3.IESB is treated as 1 (3.3).
When can an SError be attributed to an instruction?
Ranked from most to least precise:
- It is not an SError. A synchronous External abort (EC
0x24/0x25/0x20/0x21with DFSC0b010000, or the walk variants) is precise and belongs to the instruction atELR_ELx.FnVsays whetherFAR_ELxis valid. Consumed poison should take this path (16.7). - FEAT_RASv2 with
ISS.ELS == 1: the SError is architecturally reported as triggered by the instruction atELR_ELx, andVFV/WU/WnRadd detail. - Synchronized at a barrier (
ESB, or IESB withISS.IESB == 1): attributable to a region, meaning the context before the barrier, but not to an instruction. This is enough to decide “guest or host”, “EL1 or EL3”, or “this thread”. - Otherwise: imprecise.
ELR_ELxis just where the PE happened to be. The error could come from a store hundreds of instructions earlier, a speculative or prefetch access, or another agent’s transaction. TheERR<n>error records and the interconnect’s error logs are the only evidence (18.3).
Bring-up note: an SError that appears to come from “random” code shortly after DRAM or a new peripheral is first touched is usually case 4: a posted write to an address that the interconnect rejects. To bisect it, put
DSB SYfollowed byESB(withPSTATE.Amasked) after each suspect store and checkDISR_EL1.A. If the implementation treats that error as synchronizable by an error synchronization event (which errors are is IMPLEMENTATION DEFINED, and a decode error returned after the write has completed may not be), this converts the imprecise SError into a region-attributed one without changing the routing. If the SError targets a higher EL, theESBcannot defer it, but it is still taken at theESB, which gives the same attribution.
Validation note: to test the IESB and ESB paths, inject an error with the RAS pseudo-fault generation registers (
ERR<n>PFGCTL, see 16.8) so that it is signalled by an access issued just before anERET(how an injected fault binds to an access is IMPLEMENTATION DEFINED per error node, so check the core TRM). WithSCTLR_ELx.IESB == 1the SError must be reported withESR_ELx.IESB == 1(or deferred intoDISR_EL1if masked), and must never be taken after the first instruction of the new context. A report against the new context’s code means the implicit barrier is missing orIESBis not effective.
Checkpoint
Q3.4.1 A Non-secure kernel at EL1 executes ESB with PSTATE.A == 1. HCR_EL2.AMO == 1, SCR_EL3.EA == 0, and a physical SError caused by the kernel’s earlier store becomes pending. What happens?
- A. The ESB defers it into
DISR_EL1, which the kernel then reads - B. The SError targets EL2, which is above the current EL, so it is not masked by
PSTATE.Aand is taken to EL2 at the ESB - C. The ESB defers it into
VDISR_EL2 - D. It stays pending until the kernel clears
PSTATE.A
Answer
B. Deferral happens only for an SError that is masked at the current EL. With AMO == 1, physical SErrors from EL1 target EL2 and cannot be masked by EL1’s PSTATE.A. C is the tempting answer, but VDISR_EL2 records deferred virtual SErrors. A is wrong too: an EL1 read of DISR_EL1 would return VDISR_EL2 here.
Read more: Arm ARM (DDI0487), ESB; DISR_EL1; VDISR_EL2; Asynchronous exception masking
Q3.4.2 An EL3 handler receives an SError with ESR_EL3.IDS == 0, DFSC == 0b010001, AET == 0b010 and IESB == 0, on a core without FEAT_RASv2. Which conclusion is justified?
- A. The error was caused by the instruction at
ELR_EL3 - B. The interrupted context must be terminated, because its state is corrupted
- C. The PE state is not corrupted, so execution may resume at
ELR_EL3, but the error cannot be attributed to a particular instruction - D.
FAR_EL3holds the address of the failing access
Answer
C. AET 0b010 is UEO (Restartable). The PE state is intact, but nothing in the syndrome ties the error to ELR_EL3 (A): that would need RASv2 ELS, or at least a barrier-synchronized report. B describes UEU. FAR is not valid for an SError without RASv2 VFV == 1 (D).
Read more: Arm ARM (DDI0487), ISS encoding for an SError exception; RAS specification (DDI0587), error types
Q3.4.3 A hypervisor wants every SError caused by guest code to be identified as the guest’s, even when the error response arrives after the guest has trapped to EL2. Which mechanism provides this architecturally?
- A.
SCTLR_EL2.IESB == 1, plus anESBand aDISR_EL1.Acheck early in the EL2 exit path - B. A
DSB SYas the first instruction of the EL2 vector - C.
HCR_EL2.AMO == 1, which ensures that SErrors are taken in guest context - D.
SCR_EL3.NMEA == 1
Answer
A. The implicit error synchronization event at entry to EL2 makes the guest’s errors pending at the boundary. Because entry masked PSTATE.A, the first ESB defers them into DISR_EL1, attributed to the code before the boundary, which is the guest. A DSB (B) waits for accesses to complete, but it is not an error synchronization event and does not defer anything. AMO only routes SErrors (C). NMEA concerns EL3 masking (D).
Read more: Arm ARM (DDI0487), SCTLR_EL2.IESB; Error synchronization event; ESB