Skip to content

Commit 827a108

Browse files
Jean-Philippe Bruckerwildea01
authored andcommitted
arm64: Save and restore OSDLR_EL1 across suspend/resume
When the CPU comes out of suspend, the firmware may have modified the OS Double Lock Register. Save it in an unused slot of cpu_suspend_ctx, and restore it on resume. Cc: <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 6fda41b commit 827a108

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

arch/arm64/mm/proc.S

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,25 @@ ENTRY(cpu_do_suspend)
6565
mrs x2, tpidr_el0
6666
mrs x3, tpidrro_el0
6767
mrs x4, contextidr_el1
68-
mrs x5, cpacr_el1
69-
mrs x6, tcr_el1
70-
mrs x7, vbar_el1
71-
mrs x8, mdscr_el1
72-
mrs x9, oslsr_el1
73-
mrs x10, sctlr_el1
68+
mrs x5, osdlr_el1
69+
mrs x6, cpacr_el1
70+
mrs x7, tcr_el1
71+
mrs x8, vbar_el1
72+
mrs x9, mdscr_el1
73+
mrs x10, oslsr_el1
74+
mrs x11, sctlr_el1
7475
alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
75-
mrs x11, tpidr_el1
76+
mrs x12, tpidr_el1
7677
alternative_else
77-
mrs x11, tpidr_el2
78+
mrs x12, tpidr_el2
7879
alternative_endif
79-
mrs x12, sp_el0
80+
mrs x13, sp_el0
8081
stp x2, x3, [x0]
81-
stp x4, xzr, [x0, #16]
82-
stp x5, x6, [x0, #32]
83-
stp x7, x8, [x0, #48]
84-
stp x9, x10, [x0, #64]
85-
stp x11, x12, [x0, #80]
82+
stp x4, x5, [x0, #16]
83+
stp x6, x7, [x0, #32]
84+
stp x8, x9, [x0, #48]
85+
stp x10, x11, [x0, #64]
86+
stp x12, x13, [x0, #80]
8687
ret
8788
ENDPROC(cpu_do_suspend)
8889

@@ -105,8 +106,8 @@ ENTRY(cpu_do_resume)
105106
msr cpacr_el1, x6
106107

107108
/* Don't change t0sz here, mask those bits when restoring */
108-
mrs x5, tcr_el1
109-
bfi x8, x5, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH
109+
mrs x7, tcr_el1
110+
bfi x8, x7, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH
110111

111112
msr tcr_el1, x8
112113
msr vbar_el1, x9
@@ -130,6 +131,7 @@ alternative_endif
130131
/*
131132
* Restore oslsr_el1 by writing oslar_el1
132133
*/
134+
msr osdlr_el1, x5
133135
ubfx x11, x11, #1, #1
134136
msr oslar_el1, x11
135137
reset_pmuserenr_el0 x0 // Disable PMU access from EL0

0 commit comments

Comments
 (0)