[PATCH RFC v9 08/25] arm64: Initialize POR_EL1 register on cpu_resume()
Kevin Brodsky
kevin.brodsky at arm.com
Thu Sep 3 09:45:36 PDT 2026
On 03/09/2026 07:56, Linu Cherian wrote:
> Kevin,
>
> On Tue, Aug 18, 2026 at 03:08:50PM +0100, Kevin Brodsky wrote:
>> From: Yeoreum Yun <yeoreum.yun at arm.com>
>>
>> The POR_EL1 register is reset to an unknown value after cpu_suspend().
>> Since POR_EL1 always holds POR_EL1_INIT when entering cpu_suspend(),
>> initialize POR_EL1 with POR_EL1_INIT before cpu_do_resume().
>>
>> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
>> Signed-off-by: Kevin Brodsky <kevin.brodsky at arm.com>
>> ---
>> arch/arm64/kernel/sleep.S | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
>> index f093cdf71be1..e0a6ad85cd24 100644
>> --- a/arch/arm64/kernel/sleep.S
>> +++ b/arch/arm64/kernel/sleep.S
>> @@ -3,6 +3,7 @@
>> #include <linux/linkage.h>
>> #include <asm/asm-offsets.h>
>> #include <asm/assembler.h>
>> +#include <asm/kpkeys.h>
>> #include <asm/smp.h>
>>
>> .text
>> @@ -134,6 +135,17 @@ SYM_FUNC_START(_cpu_resume)
>> /* load sp from context */
>> ldr x2, [x0, #CPU_CTX_SP]
>> mov sp, x2
>> +
>> +#ifdef CONFIG_ARM64_POE
>> +alternative_if_not ARM64_HAS_S1POE
>> + b .Lskip_por_set
>> +alternative_else_nop_endif
>> + mov_q x2, POR_EL1_INIT
>> + msr_s SYS_POR_EL1, x2
>> + /* isb can be skipped since cpu_do_resume() will do it. */
>> +.Lskip_por_set:
>> +#endif /* CONFIG_ARM64_POE */
> Would it be better to move this under__cpu_setup ?
I didn't think about that, that's quite neat as it avoids having to take
care of the resume path separately. It also feels fairly logical as
POR_EL1 should be configured very early (since it impacts all accesses
once enabled). Will do in the next version, thanks!
I was concerned about accesses to POR_EL1 being trapped, but in fact
there is no EL1 control to trap it so no concern there. I realised I
forgot to set HFGRT{R,W}_EL2.nPOR_EL1 though... I'll fix that up in the
next version. (This has no effect when running at EL2 with VHE so I
didn't notice that beforehand.)
- Kevin
More information about the linux-arm-kernel
mailing list