arm64: Define name for the original RES1 bit but now functinal bit
v2 cover arm64: Define name for the original RES1 bit but now functinal bit
According the talk[1], because the architecture get updated, what used to be a RES1 bit becomes a functinal bit. So we can define the name for these bits, this also increase the readability.
[1] lore.kernel.org/[email protected]
v1:
https://lore.kernel.org/all/[email protected]/
Thanks, Eric for the suggestions:
- Rephrase the commit title in patch 1.
- Use the _BITULL().
- Delete the SCTLR_EL1_RES1 and unwind its definition into INIT_SCTLR_EL1_MMU_OFF.
Shaoqin Huang (2):
arm64: Use _BITULL() to define SCTLR_EL1 bit fields
arm64: Define name for these bits used in SCTLR_EL1
lib/arm64/asm/sysreg.h | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
Signature · 1 line
2.39.1
PATCH v2 1/2 arm64: Use _BITULL() to define SCTLR_EL1 bit fields
Currently the SCTLR_EL1_* is defined by (1 << x), all of them can be replaced by the _BITULL() macro to make the format consistent with the SCTLR_EL1_RES1 definition.
--- lib/arm64/asm/sysreg.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
lib/arm64/asm/sysreg.h +11 -11
@@ -80,17 +80,17 @@ asm(#define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7)/* System Control Register (SCTLR_EL1) bits */ -#define SCTLR_EL1_EE (1 << 25) -#define SCTLR_EL1_WXN (1 << 19) -#define SCTLR_EL1_I (1 << 12) -#define SCTLR_EL1_SA0 (1 << 4) -#define SCTLR_EL1_SA (1 << 3) -#define SCTLR_EL1_C (1 << 2) -#define SCTLR_EL1_A (1 << 1) -#define SCTLR_EL1_M (1 << 0) - -#define SCTLR_EL1_RES1 (_BITUL(7) | _BITUL(8) | _BITUL(11) | _BITUL(20) | \ - _BITUL(22) | _BITUL(23) | _BITUL(28) | _BITUL(29)) +#define SCTLR_EL1_EE _BITULL(25) +#define SCTLR_EL1_WXN _BITULL(19) +#define SCTLR_EL1_I _BITULL(12) +#define SCTLR_EL1_SA0 _BITULL(4) +#define SCTLR_EL1_SA _BITULL(3) +#define SCTLR_EL1_C _BITULL(2) +#define SCTLR_EL1_A _BITULL(1) +#define SCTLR_EL1_M _BITULL(0) + +#define SCTLR_EL1_RES1 (_BITULL(7) | _BITULL(8) | _BITULL(11) | _BITULL(20) | \ + _BITULL(22) | _BITULL(23) | _BITULL(28) | _BITULL(29))#define INIT_SCTLR_EL1_MMU_OFF \ SCTLR_EL1_RES1
Signature · 1 line
2.39.1
PATCH v2 2/2 arm64: Define name for these bits used in SCTLR_EL1
In reply to Shaoqin HuangCurrently some fields in SCTLR_EL1 don't define a name and directly used in the SCTLR_EL1_RES1, that's not good now since these fields have been functional and have a name.
Delete the SCTLR_EL1_RES1 since these bits are not RES1 if the related feature has been implemented, it's wired to define these bits as RES1. So simply delete the SCTLR_EL1_RES1 and unwind its definition to INIT_SCTLR_MMU_OFF.
According to the ARM DDI 0487J.a, define the name related to these fields.
--- lib/arm64/asm/sysreg.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
lib/arm64/asm/sysreg.h +11 -3
@@ -80,18 +80,26 @@ asm(#define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7)/* System Control Register (SCTLR_EL1) bits */ +#define SCTLR_EL1_LSMAOE _BITULL(29) +#define SCTLR_EL1_NTLSMD _BITULL(28)#define SCTLR_EL1_EE _BITULL(25) +#define SCTLR_EL1_SPAN _BITULL(23) +#define SCTLR_EL1_EIS _BITULL(22) +#define SCTLR_EL1_TSCXT _BITULL(20)#define SCTLR_EL1_WXN _BITULL(19)#define SCTLR_EL1_I _BITULL(12) +#define SCTLR_EL1_EOS _BITULL(11) +#define SCTLR_EL1_SED _BITULL(8) +#define SCTLR_EL1_ITD _BITULL(7)#define SCTLR_EL1_SA0 _BITULL(4)#define SCTLR_EL1_SA _BITULL(3)#define SCTLR_EL1_C _BITULL(2)#define SCTLR_EL1_A _BITULL(1)#define SCTLR_EL1_M _BITULL(0) -#define SCTLR_EL1_RES1 (_BITULL(7) | _BITULL(8) | _BITULL(11) | _BITULL(20) | \ - _BITULL(22) | _BITULL(23) | _BITULL(28) | _BITULL(29))#define INIT_SCTLR_EL1_MMU_OFF \ - SCTLR_EL1_RES1 + (SCTLR_EL1_ITD | SCTLR_EL1_SED | SCTLR_EL1_EOS | \ + SCTLR_EL1_TSCXT | SCTLR_EL1_EIS | SCTLR_EL1_SPAN | \ + SCTLR_EL1_NTLSMD | SCTLR_EL1_LSMAOE)#endif /* _ASMARM64_SYSREG_H_ */
Signature · 1 line
2.39.1
Hi Shaoqin,
Quoted 14 lines · Shaoqin Huang
According the talk[1], because the architecture get updated, what used to be a RES1 bit becomes a functinal bit. So we can define the name for these bits, this also increase the readability.
[1] lore.kernel.org/[email protected]
v1:
https://lore.kernel.org/all/[email protected]/
Thanks, Eric for the suggestions:
- Rephrase the commit title in patch 1.
- Use the_BITULL().
- Delete theSCTLR_EL1_RES1and unwind its definition intoINIT_SCTLR_EL1_MMU_OFF.
Quoted 3 lines
Shaoqin Huang (2):
arm64: Use_BITULL()to defineSCTLR_EL1bit fields
arm64: Define name for these bits used inSCTLR_EL1
for the series
Eric
Quoted 4 lines
lib/arm64/asm/sysreg.h | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
Andrew Jones
AppliedQuoted 14 lines · Shaoqin Huang
According the talk[1], because the architecture get updated, what used to be a RES1 bit becomes a functinal bit. So we can define the name for these bits, this also increase the readability.
[1] lore.kernel.org/[email protected]
v1:
https://lore.kernel.org/all/[email protected]/
Thanks, Eric for the suggestions:
- Rephrase the commit title in patch 1.
- Use the_BITULL().
- Delete theSCTLR_EL1_RES1and unwind its definition intoINIT_SCTLR_EL1_MMU_OFF.
Quoted 1 line
[...]
Applied to arm/queue, thanks!
https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/arm/queue
drew