OSDN Git Service

arm64: move SCTLR_EL{1,2} assertions to <asm/sysreg.h>
authorMark Rutland <mark.rutland@arm.com>
Wed, 11 Jul 2018 13:56:37 +0000 (14:56 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 12 Jul 2018 13:40:38 +0000 (14:40 +0100)
commit1c312e84c2d71da4101754fa6118f703f7473e01
treeed4fdb6154157dc4d354127370cf6491a1b45bd7
parent3eb6f1f9e6364d5eca1ddf3c9e963c5916069190
arm64: move SCTLR_EL{1,2} assertions to <asm/sysreg.h>

Currently we assert that the SCTLR_EL{1,2}_{SET,CLEAR} bits are
self-consistent with an assertion in config_sctlr_el1(). This is a bit
unusual, since config_sctlr_el1() doesn't make use of these definitions,
and is far away from the definitions themselves.

We can use the CPP #error directive to have equivalent assertions in
<asm/sysreg.h>, next to the definitions of the set/clear bits, which is
a bit clearer and simpler.

At the same time, lets fill in the upper 32 bits for both registers in
their respective RES0 definitions. This could be a little nicer with
GENMASK_ULL(63, 32), but this currently lives in <linux/bitops.h>, which
cannot safely be included from assembly, as <asm/sysreg.h> can.

Note the when the preprocessor evaluates an expression for an #if
directive, all signed or unsigned values are treated as intmax_t or
uintmax_t respectively. To avoid ambiguity, we define explicitly define
the mask of all 64 bits.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/sysreg.h