summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/sysreg.h
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2016-09-06 16:04:45 +0300
committerWill Deacon <will.deacon@arm.com>2016-09-09 20:12:08 +0300
commit8a71f0c656e0521867931eecff54eb3a35ca65a7 (patch)
tree4c460a0145d2a9a1c2a70b93ceb294a2c7280ac7 /arch/arm64/include/asm/sysreg.h
parent0e27a7fce60f8c334ef59de0fbf5df8744e752e0 (diff)
downloadlinux-8a71f0c656e0521867931eecff54eb3a35ca65a7.tar.xz
arm64: sysreg: replace open-coded mrs_s/msr_s with {read,write}_sysreg_s
Similar to our {read,write}_sysreg accessors for architected, named system registers, this patch introduces {read,write}_sysreg_s variants that can take arbitrary sys_reg output and therefore access IMPDEF registers or registers that unsupported by binutils. Reviewed-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/sysreg.h')
-rw-r--r--arch/arm64/include/asm/sysreg.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 7e4ecd1d2ac9..e8d46e8e6079 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -274,6 +274,21 @@ asm(
: : "rZ" (__val)); \
} while (0)
+/*
+ * For registers without architectural names, or simply unsupported by
+ * GAS.
+ */
+#define read_sysreg_s(r) ({ \
+ u64 __val; \
+ asm volatile("mrs_s %0, " __stringify(r) : "=r" (__val)); \
+ __val; \
+})
+
+#define write_sysreg_s(v, r) do { \
+ u64 __val = (u64)v; \
+ asm volatile("msr_s " __stringify(r) ", %0" : : "rZ" (__val)); \
+} while (0)
+
static inline void config_sctlr_el1(u32 clear, u32 set)
{
u32 val;