arm64: suspend: Initialize PMR on resume

When we resume from cpu_suspend() context tracking, specially,
ct_idle_exit() performs IRQ save/restore sequence. It doesn't cause
any functional issues since we have masked all exceptions prior
suspend and have not restored them. However, in case of pseudo-NMI PMR
can be set by firmware to arbitrary value, thus IRQ save/restore
routines manipulates this arbitrary value. Again, it doesn't cause any
issues since PMR variant of IRQ save helper carries a
__pmr_irqs_disabled_flags() guard.

Going forward __pmr_irqs_disabled_flags() guard will be gone and we
will call __pmr_local_irq_disable() unconditionally - that would cause
warning in case CONFIG_ARM64_DEBUG_PRIORITY_MASKING is set.

Initialize PMR to a value known to Linux on resume until the normal
exception restore path restores the saved DAIF and PMR state.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
Vladimir Murzin
2026-07-27 17:34:14 +01:00
committed by Will Deacon
parent 630ca6c58f
commit d3ebdc1772

View File

@@ -169,6 +169,13 @@ alternative_if ARM64_HAS_RAS_EXTN
msr_s SYS_DISR_EL1, xzr
alternative_else_nop_endif
#ifdef CONFIG_ARM64_PSEUDO_NMI
alternative_if ARM64_HAS_GIC_PRIO_MASKING
mov x1, #GIC_PRIO_IRQON
msr_s SYS_ICC_PMR_EL1, x1
alternative_else_nop_endif
#endif
ptrauth_keys_install_kernel_nosync x14, x1, x2, x3
isb
ret