From: Yeoreum Yun <[email protected]>

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 <[email protected]>
Signed-off-by: Kevin Brodsky <[email protected]>
---
 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 */
+
        /*
         * cpu_do_resume expects x0 to contain context address pointer
         */
-- 
2.51.2


Reply via email to