aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/suspend.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-12-12 22:17:50 +0800
committerAlex Shi <alex.shi@linaro.org>2016-12-12 22:17:50 +0800
commitd2a15c13d6db9745a496a89025f665445b586ff2 (patch)
tree00cd710425a9354bc46fe42bd4320e121d92647a /arch/arm64/kernel/suspend.c
parent66e16b528a0b76260617552fce9c44fecb8b51fe (diff)
parenta057484ab40ff81f22a94bb62c035c78b5abd940 (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-rtlsk-v4.4-16.12-rt
Diffstat (limited to 'arch/arm64/kernel/suspend.c')
-rw-r--r--arch/arm64/kernel/suspend.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index b616e365cee3..5a0b1088c17c 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -1,7 +1,9 @@
#include <linux/ftrace.h>
#include <linux/percpu.h>
#include <linux/slab.h>
+#include <asm/alternative.h>
#include <asm/cacheflush.h>
+#include <asm/cpufeature.h>
#include <asm/debug-monitors.h>
#include <asm/pgtable.h>
#include <asm/memory.h>
@@ -88,11 +90,16 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
ret = fn(arg);
/*
- * Never gets here, unless the suspend finisher fails.
- * Successful cpu_suspend() should return from cpu_resume(),
- * returning through this code path is considered an error
- * If the return value is set to 0 force ret = -EOPNOTSUPP
- * to make sure a proper error condition is propagated
+ * PSTATE was not saved over suspend/resume, re-enable any
+ * detected features that might not have been set correctly.
+ */
+ asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN,
+ CONFIG_ARM64_PAN));
+
+ /*
+ * Restore HW breakpoint registers to sane values
+ * before debug exceptions are possibly reenabled
+ * through local_dbg_restore.
*/
if (!ret)
ret = -EOPNOTSUPP;