diff options
author | James Morse <james.morse@arm.com> | 2016-08-26 16:03:42 +0100 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-05-22 14:54:29 +0530 |
commit | 6b98e8a1a7a21d077243d53c743e0ee3fe247590 (patch) | |
tree | 62d5e8fb2887de417466dcbf0d129af9a85a5318 | |
parent | 5611fa25bd735238d546c433abdfa05409747db4 (diff) | |
download | linaro-android-wip/hibernate-hikey-mainline-rebase-4.4.x.tar.gz |
arm64: kernel: Fix unmasked debug exceptions when restoring mdscr_el1wip/hibernate-hikey-mainline-rebase-4.4.x
Changes to make the resume from cpu_suspend() code behave more like
secondary boot caused debug exceptions to be unmasked early by
__cpu_setup(). We then go on to restore mdscr_el1 in cpu_do_resume(),
potentially taking break or watch points based on uninitialised registers.
Mask debug exceptions in cpu_do_resume(), which is specific to resume
from cpu_suspend(). Debug exceptions will be restored to their original
state by local_dbg_restore() in cpu_suspend(), which runs after
hw_breakpoint_restore() has re-initialised the other registers.
Reported-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fixes: cabe1c81ea5b ("arm64: Change cpu_resume() to enable mmu early then access sleep_sp by va")
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 744c6c37cc18705d19e179622f927f5b781fe9cc)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r-- | arch/arm64/mm/proc.S | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 5bb61de23201..9d37e967fa19 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -100,7 +100,16 @@ ENTRY(cpu_do_resume) msr tcr_el1, x8 msr vbar_el1, x9 + + /* + * __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking + * debug exceptions. By restoring MDSCR_EL1 here, we may take a debug + * exception. Mask them until local_dbg_restore() in cpu_suspend() + * resets them. + */ + disable_dbg msr mdscr_el1, x10 + msr sctlr_el1, x12 /* * Restore oslsr_el1 by writing oslar_el1 |