aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-05-27 11:48:40 +0800
committerAlex Shi <alex.shi@linaro.org>2017-05-27 11:48:40 +0800
commit62a74fb4baea834664f7d61a2f644a84cfc1fb76 (patch)
tree87dd0049d32bdf5df2f35fd9084ad2668832329d
parent3feab0fd372fc656992d649734fe316261c51704 (diff)
parent8ab4646d94cfa23f0892331664374acee5763d02 (diff)
Merge branch 'v4.9/topic/PANemulation' into linux-linaro-lsk-v4.9lsk-v4.9-17.05
-rw-r--r--arch/arm64/include/asm/current.h10
-rw-r--r--arch/arm64/include/asm/uaccess.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/current.h b/arch/arm64/include/asm/current.h
index f2bcbe2d9889..86c404171305 100644
--- a/arch/arm64/include/asm/current.h
+++ b/arch/arm64/include/asm/current.h
@@ -9,9 +9,17 @@
struct task_struct;
+/*
+ * We don't use read_sysreg() as we want the compiler to cache the value where
+ * possible.
+ */
static __always_inline struct task_struct *get_current(void)
{
- return (struct task_struct *)read_sysreg(sp_el0);
+ unsigned long sp_el0;
+
+ asm ("mrs %0, sp_el0" : "=r" (sp_el0));
+
+ return (struct task_struct *)sp_el0;
}
#define current get_current()
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index f61fec91042a..6920afa8a9da 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -189,7 +189,7 @@ do { \
#define __uaccess_enable(alt) \
do { \
- if (uaccess_ttbr0_enable()) \
+ if (!uaccess_ttbr0_enable()) \
asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), alt, \
CONFIG_ARM64_PAN)); \
} while (0)