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>
This commit is contained in:
Родитель
0e27a7fce6
Коммит
8a71f0c656
|
@ -93,11 +93,7 @@
|
||||||
|
|
||||||
#include <asm/sysreg.h>
|
#include <asm/sysreg.h>
|
||||||
|
|
||||||
#define read_cpuid(reg) ({ \
|
#define read_cpuid(reg) read_sysreg_s(SYS_ ## reg)
|
||||||
u64 __val; \
|
|
||||||
asm("mrs_s %0, " __stringify(SYS_ ## reg) : "=r" (__val)); \
|
|
||||||
__val; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The CPU ID never changes at run time, so we might as well tell the
|
* The CPU ID never changes at run time, so we might as well tell the
|
||||||
|
|
|
@ -274,6 +274,21 @@ asm(
|
||||||
: : "rZ" (__val)); \
|
: : "rZ" (__val)); \
|
||||||
} while (0)
|
} 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)
|
static inline void config_sctlr_el1(u32 clear, u32 set)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче