// Native secondary landing pad. PSCI context is the validated flat CPU ID. // No Rust, stack access, or exclusive atomic operation occurs before the // primary-owned Normal Inner-Shareable identity root is enabled. .section .text.os_product_d5_boot,"ax" .balign 4 .global __os_product_d5_secondary_entry .type __os_product_d5_secondary_entry, %function __os_product_d5_secondary_entry: msr daifset, #0xf msr spsel, #1 cmp x0, #1 b.lo .Ld5_park cmp x0, #3 b.hi .Ld5_park mov x19, x0 adrp x1, __os_product_d5_vectors add x1, x1, :lo12:__os_product_d5_vectors msr vbar_el1, x1 isb mrs x1, CurrentEL cmp x1, #4 b.ne __os_product_d5_fault // A separate 17-page region belongs to each CPU. The lowest page has // already been unmapped by the primary, and both canaries stay untouched. sub x2, x19, #1 mov x3, #0x1000 movk x3, #0x1, lsl #16 mul x2, x2, x3 adrp x1, OS_PRODUCT_D5_STACKS add x1, x1, :lo12:OS_PRODUCT_D5_STACKS add x1, x1, x2 add x1, x1, x3 sub x1, x1, #16 mov sp, x1 mrs x1, cpacr_el1 orr x1, x1, #(3 << 20) msr cpacr_el1, x1 isb bl __os_product_d5_prepare_local_cache adrp x2, OS_PRODUCT_D5_BOOT add x2, x2, :lo12:OS_PRODUCT_D5_BOOT ldp x3, x4, [x2] ldp x5, x6, [x2, #16] msr mair_el1, x5 msr tcr_el1, x4 msr ttbr0_el1, x3 dsb sy isb tlbi vmalle1 dsb sy isb msr sctlr_el1, x6 isb mov x0, x19 bl os_product_d5_secondary .Ld5_park: wfe b .Ld5_park .size __os_product_d5_secondary_entry, .-__os_product_d5_secondary_entry // This cold PSCI CPU owns only its private L1. Never invalidate shared higher // levels here: the primary already uses them. No exclusive access or Rust // borrow occurs before installing the primary's audited cacheable root. .balign 4 __os_product_d5_prepare_local_cache: adrp x1, OS_PRODUCT_D5_CACHE add x1, x1, :lo12:OS_PRODUCT_D5_CACHE add x1, x1, x19, lsl #9 ldr x4, =0x4435434143483031 str x4, [x1] mov x4, #1 str x4, [x1, #8] str x19, [x1, #16] str x4, [x1, #24] mrs x4, sctlr_el1 str x4, [x1, #32] tbnz x4, #0, __os_product_d5_fault tbnz x4, #2, __os_product_d5_fault mrs x4, daif str x4, [x1, #496] and x4, x4, #0x3c0 cmp x4, #0x3c0 b.ne __os_product_d5_fault mrs x4, cntpct_el0 str x4, [x1, #464] mrs x2, csselr_el1 str x2, [x1, #88] mrs x3, clidr_el1 str x3, [x1, #72] ubfx x17, x3, #24, #3 and x3, x3, #7 cmp x3, #2 b.lo __os_product_d5_fault cmp x3, #4 b.hi __os_product_d5_fault str x3, [x1, #128] mrs x4, id_aa64mmfr2_el1 ubfx x5, x4, #20, #4 str x5, [x1, #80] cmp x5, #1 b.hi __os_product_d5_fault cbz x17, .Ld5_local_nopoc dsb sy msr csselr_el1, xzr isb mrs x6, ccsidr_el1 str x6, [x1, #136] and x7, x6, #7 add x7, x7, #4 cmp x7, #9 b.hi __os_product_d5_fault cbnz x5, .Ld5_ccidx ubfx x8, x6, #3, #10 ubfx x9, x6, #13, #15 b .Ld5_geometry .Ld5_ccidx: ubfx x8, x6, #3, #21 ubfx x9, x6, #32, #24 .Ld5_geometry: cmp x8, #1023 b.hi __os_product_d5_fault lsr x4, x9, #16 cbnz x4, __os_product_d5_fault add x15, x8, #1 add x16, x9, #1 mul x17, x15, x16 mov x4, #0x100000 cmp x17, x4 b.hi __os_product_d5_fault str x15, [x1, #152] str x16, [x1, #160] mov x4, #1 lsl x4, x4, x7 str x4, [x1, #144] clz w12, w8 mov x11, x9 mov x15, #0 .Ld5_local_set: mov x10, x8 .Ld5_local_way: lsl x13, x10, x12 lsl x14, x11, x7 orr x13, x13, x14 dc isw, x13 add x15, x15, #1 subs x10, x10, #1 b.ge .Ld5_local_way subs x11, x11, #1 b.ge .Ld5_local_set mov x4, #1 str x4, [x1, #112] b .Ld5_local_done .Ld5_local_nopoc: mov x15, #0 str xzr, [x1, #112] .Ld5_local_done: msr csselr_el1, x2 dsb sy isb mrs x4, csselr_el1 str x4, [x1, #96] str x15, [x1, #104] str x15, [x1, #168] mov x4, #2 str x4, [x1, #120] ret .ltorg // All exceptions retain raw CPU-owned diagnostic bytes and park. They never // fabricate an ERET, work completion, CPU_OFF, or successful join. .balign 4 __os_product_d5_fault: msr daifset, #0xf mrs x0, MPIDR_EL1 and x0, x0, #0xff cmp x0, #3 b.hi .Ld5_park adrp x4, OS_PRODUCT_D5_FAULTS add x4, x4, :lo12:OS_PRODUCT_D5_FAULTS add x4, x4, x0, lsl #6 mrs x0, ESR_EL1 mrs x1, ELR_EL1 mrs x2, FAR_EL1 mrs x3, MPIDR_EL1 stp x0, x1, [x4] stp x2, x3, [x4, #16] mov x0, #1 str x0, [x4, #32] dsb sy sev b .Ld5_park .section .text.os_product_d5_vectors,"ax" .balign 2048 .global __os_product_d5_vectors .global __os_product_d5_vectors_end .type __os_product_d5_vectors, %object __os_product_d5_vectors: .rept 16 b __os_product_d5_fault .space 124 .endr __os_product_d5_vectors_end: .size __os_product_d5_vectors, .-__os_product_d5_vectors