Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix E: Bring-up checklists

These checklists condense Part 17 and the sections it builds on into lists you can tick off against a new port, a code review or a failing boot. Each item says what to do, how to confirm it, and what a miss looks like. The reasoning is in the linked sections, and the sequences themselves are in Appendix C. TF-A function names are given as the reference implementation, not as the only correct one.

Conventions: “whole-register write” means a write from a constant built from named fields, with RES1 bits set and RES0 bits clear, before any read-modify-write (17.1). “Per world” means the value is rebuilt for every exception return to that Security state (17.2).

E.1 EL3 initialisation (every core, every reset)

#ItemConfirmSymptom of a missSee
1The core reaches RVBAR_EL3. If it does not, check the reset controller, the clocks, RVBARADDR and the ROM mapping before suspecting firmwareReset Catch (EDECR.RCE) or a CTI halt; QEMU -d int,cpu_reset,in_asm -S -sNo instruction retires17.1
2SCTLR_EL3 whole-register write first: EE explicit, M=C=0, RES1 bits set, and EIS/EOS = 1 (RES1 without FEAT_ExS, real controls with it); ISBRead back; compare with the RES1 maskWrong endianness on the first load; non-synchronizing exception entry/return on FEAT_ExS cores17.2, 7.8
3On a fixed reset vector: cold/warm decision (plat_get_my_entrypoint) before touching any shared state, stackless, from a location valid with caches offWarm-boot a secondary while the primary runsWarm-booting core corrupts the primary’s .data/.bss17.1
4VBAR_EL3 written, then ISB, before anything that can faultA deliberate BRK reports through your vectorJump through an UNKNOWN vector on the first UNDEF17.1, 3.1
5CPU reset handler selected by MIDR_EL1: errata workarounds for this variant/revision, IMPLEMENTATION DEFINED CPU*CTLR settings, CPUECTLR_EL1.SMPEN=1 on pre-DynamIQ coresPrint MIDR and the applied errata list (TF-A ERRATA_*, errata reporting)Rare corruption, hangs under load; on pre-DynamIQ cores, incoherent L11.3, 8.8
6SCR_EL3, CPTR_EL3, MDCR_EL3 whole-register writes from constants. No read-modify-write before thatRun once with debugger-planted non-zero values in these registers; behaviour must not changeRandom traps (TWI, EA), FP traps (EC 0x07), debug or PMU leaking into Secure state17.1, 17.2
7MDCR_EL3: SDD=1; SPME=0 and SCCD/MCCD where implemented; SPE/TRBE/BRBE ownership fields per worldCount cycles across an SMC: Secure time must not be countedSecure execution visible to Normal-world perf17.2, 16.3
8Only then unmask SError at EL3 (DAIFClr A) and set SCR_EL3.EA per the RAS modelInject an SError with the RAS error-injection registers, if presentSError through an UNKNOWN vector, or lost17.1, 3.4, 16.8
9Secondaries leave (power off or hold pen) before the primary initialises memoryRelease order in a traceTwo cores zeroing .bss17.4
10C runtime with MMU off: SRAM/DRAM scrubbed if ECC-protected; RW range invalidated by VA (system-cache leftovers); .bss zeroed with aligned stores and no DC ZVA; firmware built with -mstrict-alignFour-state RTL with X-propagation; FVP with cache modellingSError at “the first memory access”; Alignment faults in memset17.1, 6.5
11CNTFRQ_EL0 written on every core (only the highest EL can); system counter enabled once (CNTCR.EN in CNTControlBase)CNTPCT_EL0 advances; same frequency on all coresTimeouts that never expire; time running at the wrong rate4.6, 17.2
12ICC_SRE_EL3.{SRE,Enable}=1; ISB; read backSRE reads 1Kernel dies in early GIC probe4.5
13ACTLR_EL3: grant lower ELs only the IMPLEMENTATION DEFINED register access they need (usually none)Lower-EL write to ACTLR_EL1 trapsKernel or guest can change core tuning and errata bits17.2
14EL3 MMU and caches on as early as a minimal map exists (E.2)E.2Slow boot; unaligned or DC ZVA faults in C17.2
15Feature audit: for every feature the ID registers advertise and the OS will use, the EL3 enable bit is set and its registers are context-switched per world. Build with FEATURE_DETECTION=1 once per new coreDirected test touching one register per advertised feature from Normal-world EL2, with a Secure round trip in betweenEC 0x18 trap to EL3, or an injected UNDEF in the kernel (EC 0x00 at EL1); silent state leakage between worlds17.3
16First exception return: per-world SCR_EL3 (NS, RW, HCE, routing, feature enables); SPSR_EL3 (M = EL2h 0b1001 or EL1h 0b0101, AArch64, DAIF masked); ELR_EL3; target SCTLR_ELx clean; EL2 controls written if EL2 exists but software starts at EL1; GPRs zeroed except argumentsHalt at el3_exit and read the contextIllegal exception return: the PE stays at EL3 with PSTATE.IL, and the next instruction takes EC 0x0E with ELR_EL3 = intended entry17.2, 3.2, 12.2

E.2 MMU on (any EL)

#ItemConfirmSymptom of a missSee
1Translation tables built in memory the walker will read coherently. If built with the MMU or D-cache off: DC IVAC the table region to the PoC before and after buildingPoison the table lines through a cacheable alias first; boot must still succeed (cache modelling on)Garbage walks or random faults on silicon only9.3
2TCR_ELx: T0SZ and TG0 match the starting level the tables were built for (TG0 and TG1 encodings differ); PS/IPS ≤ ID_AA64MMFR0_EL1.PARange and ≥ the largest output address; IRGN0/ORGN0/SH0 match how the tables are mappedRecompute the starting level by hand (5.4)Level-0 (starting-level) Translation fault on the first fetch; Address size fault5.2, 5.3
3MAIR_ELx attribute indices agree with every descriptor’s AttrIndxDecode a few leaf descriptors by handCode mapped Device (faults or no speculation); MMIO mapped Normal6.5
4Leaf descriptors: AF=1 (unless hardware AF is enabled), blocks aligned to their size, SH consistent across aliases, code not XN, SCTLR.WXN consistent with writable code pagesAT S1ExR + PAR_EL1 after the MMU is on (not before: with M=0, AT reports the flat mapping)Access flag fault; Permission fault on the first fetch5.9, 5.5
5Map only memory that exists and is ready: no PA holes, untrained DDR or Secure carve-outs inside large Normal blocks; MMIO as Device and XNReview the memory map against the SoC mapAsynchronous SErrors or bus hangs with no instruction to blame9.3, 14.2
6The enabling code, the stack and the vectors are mapped at VA = PA (or the code branches to its new VA from an identity-mapped page)Disassemble the enable routine; check its page in the tablesRecursive exceptions at VBAR right after M=19.3
7Local TLB invalidate (TLBI ALLE3/ALLE2/VMALLE1) before enablingIn the disassemblyStale entries from an earlier stage or a warm reset9.3
8DSB ISH; ISB between the MAIR/TCR/TTBR writes and the SCTLR write; ISB after itIn the disassembly; compiler-generated MSR needs an explicit isb()Works single-stepping, fails at speed9.3, 7.8
9Data written before the D-cache was enabled and read after: invalidate (not clean) by VA to the PoC before enablingChecker pattern written with caches off, read with caches onData “disappears” after enabling9.3, 6.6
10Every later change to a live mapping uses the 9.1 sequence, or break-before-make for OA/type/size changes, and is not done while another PE uses the mappingCode review of every remap helperSporadic Translation faults on secondaries; TLB conflict aborts (DFSC 0b110000)9.1, 9.2

E.3 GIC on (GICv3)

#ItemConfirmSymptom of a missSee
1Each PE: ICC_SRE_EL3, then ICC_SRE_EL2, then ICC_SRE_EL1, SRE=1 (and Enable=1 at EL3 and EL2), ISB after eachRead back SREICC_* accesses UNDEF or trap4.5
2Boot PE, Secure: GICD_CTLR.ARE_S/ARE_NS set while the group enables are clear; DS=0 if there is a Secure world; poll RWPRead GICD_CTLRLegacy routing (8-PE limit, no LPIs); Secure registers reachable from Non-secure4.5
3Multi-chip GICs (GIC-600/GIC-700, IMPLEMENTATION DEFINED registers): chip routing table (GICD_DCHIPR, GICD_CHIPRn) programmed before any Distributor enable, SPI block ranges disjoint and completeGICD_CHIPSR.RTS reports consistentSPIs pending on one chip and invisible on another4.5, 17.5
4Every SPI configured while disabled: IGROUPR/IGRPMODR, IPRIORITYR, ICFGR (level vs edge), IROUTER (affinity matching the real MPIDR_EL1 layout)Dump the registers; compare IROUTER with each target’s MPIDR_EL1Interrupt pending forever (no matching Redistributor); level interrupt firing once4.5
5GICD_CTLR.EnableGrp0/EnableGrp1NS/EnableGrp1S; poll RWPRead backNothing forwarded, including SGIs/PPIs under affinity routing4.5
6Each PE, Secure: power the Redistributor (GICR_PWRR on GIC-600 class, IMPLEMENTATION DEFINED); GICR_WAKER.ProcessorSleep=0; poll ChildrenAsleep==0Read GICR_WAKERInterrupts held back for this PE only4.5
7Find this PE’s Redistributor by matching GICR_TYPER.Affinity_Value with MPIDR_EL1; frame stride 128 KB (256 KB with VLPIS); stop at GICR_TYPER.LastLog the frame index found per PEWalk runs off the end (looks like an early-boot hang)4.5
8SGIs/PPIs in the SGI_base frame: group, priority, ICFGR1, GICR_ISENABLER0Timer PPI firesNo timer tick4.5
9CPU interface: ICC_PMR_EL1 above the priorities in use (it resets to 0, masking everything), ICC_BPR*, ICC_CTLR_EL1/EL3 (EOImode), ICC_IGRPEN0_EL1/ICC_IGRPEN1_EL1 (or ICC_IGRPEN1_EL3)ICC_HPPIR*_EL1 shows the pending INTIDPending but never signalled4.5, 4.3
10Routing and masking: SCR_EL3.IRQ/FIQ, HCR_EL2.IMO/FMO, PSTATE.I/F match the intended model; SCR_EL3.FIQ identical on all CPUsForce pending with GICD_ISPENDR/GICR_ISPENDR0FIQ at EL3 instead of IRQ at EL1 (wrong group); nothing taken3.3, 4.3
11Handler: acknowledge, clear the source with a read-back, DSB, EOI; deactivate if EOImode=1GICD_ISACTIVER not stuckDelivered once, never again4.2, 7.9
12LPIs (if used): property and pending tables allocated and cleaned (or coherent), GICR_CTLR.EnableLPIs last; ITS tables and command queue set up per IHI0069INT command delivers an LPILPIs silently never arrive4.4

E.4 Secondary CPU on (PSCI CPU_ON)

#ItemConfirmSymptom of a missSee
1plat_core_pos_by_mpidr() validates every field of the requested MPIDR, for the real affinity layout (MT, Aff0 as thread on DynamIQ)Fuzz CPU_ON with invalid MPIDRs: expect INVALID_PARAMETERSWrong core started; out-of-bounds index at EL317.4
2Entry point validated (validate_ns_entrypoint)Pass an address outside Non-secure DRAMEL3 jumps the core into arbitrary memory17.4
3PSCI state the target reads with caches off (ON_PENDING, entry point, context) cleaned to the PoC, unless the platform is hardware-coherent from resetCache-modelled FVP or siliconTarget reads stale state and goes back to sleep or uses the wrong entry17.4, 8.8
4Cluster power and interconnect membership: if the cluster was off, power it and (older interconnects) add it to the snoop and DVM domains before the core enables cachesInterconnect snoop counters for the clusterIncoherent caches; TLBI broadcasts not reaching the new core17.4, 17.5
5Target reset path runs all of E.1 that is per core: SCTLR_EL3, vectors, reset handler (errata, SMPEN on pre-DynamIQ), CNTFRQ_EL0, ICC_SRE_EL3, EL3 MMUErrata report on every core, not only the primaryErrata applied only on core 017.1
6Redistributor wake and CPU interface init on the target (pwr_domain_on_finish)Send an SGI to the new coreCore runs but receives no interrupts4.5
7Target’s Non-secure context (SCR_EL3, SPSR_EL3, ELR_EL3 = entry, x0 = context ID) built by the caller and visible to the target after its MMU is onHalt the target at el3_exitWrong EL or wrong entry on the secondary only17.4
8The OS treats CPU_ON success as “request accepted” and runs its own handshake or polls AFFINITY_INFOOS logBoot hangs waiting for a core that never came up17.4
9Hold-pen platforms only: mailbox write cleaned to the PoC (or Non-cacheable), DSB SY, SEVRelease from a cold pen in RTLSecondary never leaves the pen17.4, 7.10

E.5 Caches off before power-down (CPU_OFF, power-down CPU_SUSPEND)

#ItemConfirmSymptom of a missSee
1State coordination done under the power-domain locks; the last core of a cluster (or the OS, in OS-initiated mode) decides the cluster statePSCI stats (PSCI_STAT_COUNT/RESIDENCY)Cluster powered off under a running core17.4
2SPD/SPMC notified and its state saved; extension state not in the context (for example AMU counters) savedResume a core and compareSecure world loses state; counters reset17.4
3Timers: the OS’s next event moved to an always-on timer (broadcast timer, CNTBaseN frame); owners of CNTV_CVAL_EL0, CNTKCTL_EL1, CNTHCTL_EL2, CNTVOFF_EL2 restore them on resume; EL3 rewrites CNTFRQ_EL0Wake from a timer-only idle periodCore never wakes; virtual time jumps17.4, 4.6
4Pre-DynamIQ: clear SCTLR_EL3.C; ISB; set/way clean+invalidate L1 (and L2 on the last core of the cluster) with levels from CLIDR_EL1; then clear CPUECTLR_EL1.SMPEN; ISB; DSB SY. In that orderStress with another core writing lines the target holds dirty during power-downLost dirty lines; stale data on other cores (SMPEN cleared too early)8.8
5DynamIQ: CPUPWRCTLR_EL1.CORE_PWRDN_EN=1; ISB; hardware flushes and leaves coherency. Cluster hints in CLUSTERPWRDN_EL1 are advisoryPMU L1D_CACHE_WB (0x15) on the target before WFICore retains power, or the request is ignored8.8
6No cacheable writes of data needed later after the flush (stack spills included); data the warm-boot path reads with caches off is clean to the PoCChecker patterns on the power-down stack surviveCorruption after many suspend cycles8.8
7GIC: GICR_WAKER.ProcessorSleep=1, poll ChildrenAsleep==1; CPU interface disabled; SPIs targeted at this core migrated (OS) or 1-of-N participation removed (GICR_CTLR.DPG* where GICR_TYPER.DPGS=1)Wake by an SPI aimed at the sleeping coreLost wake-up; SPI pending until the core returns17.4, 4.5
8Cache-related errata for this core revision applied (for example clean-as-clean+invalidate workarounds)SDEN cache, CMO and power-down categories reviewedCorruption only after thousands of cycles8.8, 1.3
9Power controller programmed (often SCMI to an SCP); DSB SY; WFI. A WFI that falls through is handled as an immediate wake-upCount fall-throughsCore spins in EL3 or returns with caches off17.4, 7.6
10Last cluster or chiplet down: cluster cache flushed (by the last core or by hardware) before the cluster leaves the snoop and DVM domain; on return, invalidate TLBs and caches as from resetInterconnect counters show snoops stop and restartStale TLB entries or lines after cluster power-up8.8, 17.5

Validation note: Each checklist has a matching stress test in the linked sections. In short: X-propagation RTL runs and planted UNKNOWN values for E.1 (17.1); a poisoned-cache MMU-on test for E.2 (9.3); forced-pending plus real-device tests on every die, before and after a power cycle, for E.3 (4.5); and a randomised PSCI loop with interrupts aimed at sleeping cores and checker patterns for E.4 and E.5 (17.4, 8.8). Run the cache-related tests on silicon or with FVP cache-state modelling enabled; without it, none of the dirty-line failures can occur. For what the kernel expects at handover, see the entry-state table in 17.6.