diff options
author | Mark Rutland <mark.rutland@arm.com> | 2016-09-08 14:55:38 +0200 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-09-09 12:43:50 +0200 |
commit | adf7589997927b1d84a5d003027b866bbef61ef2 (patch) | |
tree | f3bb449f2bda4e8992983b5d87e7dab1415fa17e /arch/arm64/kernel/cacheinfo.c | |
parent | arm64/kvm: use {read,write}_sysreg() (diff) | |
download | linux-adf7589997927b1d84a5d003027b866bbef61ef2.tar.xz linux-adf7589997927b1d84a5d003027b866bbef61ef2.zip |
arm64: simplify sysreg manipulation
A while back we added {read,write}_sysreg accessors to handle accesses
to system registers, without the usual boilerplate asm volatile,
temporary variable, etc.
This patch makes use of these across arm64 to make code shorter and
clearer. For sequences with a trailing ISB, the existing isb() macro is
also used so that asm blocks can be removed entirely.
A few uses of inline assembly for msr/mrs are left as-is. Those
manipulating sp_el0 for the current thread_info value have special
clobber requiremends.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/cacheinfo.c')
-rw-r--r-- | arch/arm64/kernel/cacheinfo.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index b8629d52fba9..9617301f76b5 100644 --- a/arch/arm64/kernel/cacheinfo.c +++ b/arch/arm64/kernel/cacheinfo.c @@ -39,7 +39,7 @@ static inline enum cache_type get_cache_type(int level) if (level > MAX_CACHE_LEVEL) return CACHE_TYPE_NOCACHE; - asm volatile ("mrs %x0, clidr_el1" : "=r" (clidr)); + clidr = read_sysreg(clidr_el1); return CLIDR_CTYPE(clidr, level); } @@ -55,11 +55,9 @@ u64 __attribute_const__ cache_get_ccsidr(u64 csselr) WARN_ON(preemptible()); - /* Put value into CSSELR */ - asm volatile("msr csselr_el1, %x0" : : "r" (csselr)); + write_sysreg(csselr, csselr_el1); isb(); - /* Read result out of CCSIDR */ - asm volatile("mrs %x0, ccsidr_el1" : "=r" (ccsidr)); + ccsidr = read_sysreg(ccsidr_el1); return ccsidr; } |