[PATCH RFC v9 08/25] arm64: Initialize POR_EL1 register on cpu_resume()
Kevin Brodsky
kevin.brodsky at arm.com
Thu Nov 5 00:18:38 PST 2026
On 03/09/2026 18:45, Kevin Brodsky wrote:
> 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!
Turns out there's a complication here: __cpu_setup() always runs at EL1,
even when we will run with VHE at EL2. To make that case work, we would
also need to amend __finalise_el2 to transfer POR_EL1 into POR_EL2.
Overall it doesn't seem to be easier, and my impression is that we avoid
handling registers in __cpu_setup/__finalise_el2 if it can be done at a
later stage. I'll leave the approach unchanged in RFC v10.
- Kevin
More information about the linux-arm-kernel
mailing list