[PATCH v6 05/12] arm64/sysreg: Define bits for previously RES1 fields in SCTLR_EL1

Mark Rutland mark.rutland at arm.com
Wed May 4 06:35:25 PDT 2022


On Tue, May 03, 2022 at 06:02:26PM +0100, Mark Brown wrote:
> In older revisions of the architecture SCTLR_EL1 contained several RES1
> fields but in DDI0487H.a these now all have assigned functions. In
> preparation for automatically generating sysreg.h provide explicit
> definitions for all these bits and use them in the INIT_SCTLR_EL1_ macros
> where _RES1 was previously used.
> 
> There should be no functional change.
> 
> Signed-off-by: Mark Brown <broonie at kernel.org>

AFAICT all the bits are good, and there should be no functional change:

Reviewed-by: Mark Rutland <mark.rutland at arm.com>

Mark.

> ---
>  arch/arm64/include/asm/sysreg.h | 53 ++++++++++++++++++++-------------
>  1 file changed, 32 insertions(+), 21 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index 7e9de3c87cd9..331e2521a81a 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -633,19 +633,24 @@
>  
>  #define SCTLR_ELx_ENIA_SHIFT	31
>  
> -#define SCTLR_ELx_ITFSB	(BIT(37))
> -#define SCTLR_ELx_ENIA	(BIT(SCTLR_ELx_ENIA_SHIFT))
> -#define SCTLR_ELx_ENIB	(BIT(30))
> -#define SCTLR_ELx_ENDA	(BIT(27))
> -#define SCTLR_ELx_EE    (BIT(25))
> -#define SCTLR_ELx_IESB	(BIT(21))
> -#define SCTLR_ELx_WXN	(BIT(19))
> -#define SCTLR_ELx_ENDB	(BIT(13))
> -#define SCTLR_ELx_I	(BIT(12))
> -#define SCTLR_ELx_SA	(BIT(3))
> -#define SCTLR_ELx_C	(BIT(2))
> -#define SCTLR_ELx_A	(BIT(1))
> -#define SCTLR_ELx_M	(BIT(0))
> +#define SCTLR_ELx_ITFSB	 (BIT(37))
> +#define SCTLR_ELx_ENIA	 (BIT(SCTLR_ELx_ENIA_SHIFT))
> +#define SCTLR_ELx_ENIB	 (BIT(30))
> +#define SCTLR_ELx_LSMAOE (BIT(29))
> +#define SCTLR_ELx_nTLSMD (BIT(28))
> +#define SCTLR_ELx_ENDA	 (BIT(27))
> +#define SCTLR_ELx_EE     (BIT(25))
> +#define SCTLR_ELx_EIS	 (BIT(22))
> +#define SCTLR_ELx_IESB	 (BIT(21))
> +#define SCTLR_ELx_TSCXT	 (BIT(20))
> +#define SCTLR_ELx_WXN	 (BIT(19))
> +#define SCTLR_ELx_ENDB	 (BIT(13))
> +#define SCTLR_ELx_I	 (BIT(12))
> +#define SCTLR_ELx_EOS	 (BIT(11))
> +#define SCTLR_ELx_SA	 (BIT(3))
> +#define SCTLR_ELx_C	 (BIT(2))
> +#define SCTLR_ELx_A	 (BIT(1))
> +#define SCTLR_ELx_M	 (BIT(0))
>  
>  /* SCTLR_EL2 specific flags. */
>  #define SCTLR_EL2_RES1	((BIT(4))  | (BIT(5))  | (BIT(11)) | (BIT(16)) | \
> @@ -686,22 +691,24 @@
>  
>  #define SCTLR_EL1_BT1		(BIT(36))
>  #define SCTLR_EL1_BT0		(BIT(35))
> +#define SCTLR_EL1_LSMAOE	(BIT(29))
> +#define SCTLR_EL1_nTLSMD	(BIT(28))
>  #define SCTLR_EL1_UCI		(BIT(26))
>  #define SCTLR_EL1_E0E		(BIT(24))
>  #define SCTLR_EL1_SPAN		(BIT(23))
> +#define SCTLR_EL1_EIS		(BIT(22))
> +#define SCTLR_EL1_TSCXT		(BIT(20))
>  #define SCTLR_EL1_nTWE		(BIT(18))
>  #define SCTLR_EL1_nTWI		(BIT(16))
>  #define SCTLR_EL1_UCT		(BIT(15))
>  #define SCTLR_EL1_DZE		(BIT(14))
> +#define SCTLR_EL1_EOS		(BIT(11))
>  #define SCTLR_EL1_UMA		(BIT(9))
>  #define SCTLR_EL1_SED		(BIT(8))
>  #define SCTLR_EL1_ITD		(BIT(7))
>  #define SCTLR_EL1_CP15BEN	(BIT(5))
>  #define SCTLR_EL1_SA0		(BIT(4))
>  
> -#define SCTLR_EL1_RES1	((BIT(11)) | (BIT(20)) | (BIT(22)) | (BIT(28)) | \
> -			 (BIT(29)))
> -
>  #ifdef CONFIG_CPU_BIG_ENDIAN
>  #define ENDIAN_SET_EL1		(SCTLR_EL1_E0E | SCTLR_ELx_EE)
>  #else
> @@ -709,13 +716,17 @@
>  #endif
>  
>  #define INIT_SCTLR_EL1_MMU_OFF \
> -	(ENDIAN_SET_EL1 | SCTLR_EL1_RES1)
> +	(ENDIAN_SET_EL1 | SCTLR_EL1_LSMAOE | SCTLR_EL1_nTLSMD | \
> +	 SCTLR_EL1_EIS  | SCTLR_EL1_TSCXT  | SCTLR_EL1_EOS)
>  
>  #define INIT_SCTLR_EL1_MMU_ON \
> -	(SCTLR_ELx_M    | SCTLR_ELx_C    | SCTLR_ELx_SA   | SCTLR_EL1_SA0   | \
> -	 SCTLR_EL1_SED  | SCTLR_ELx_I    | SCTLR_EL1_DZE  | SCTLR_EL1_UCT   | \
> -	 SCTLR_EL1_nTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN | SCTLR_ELx_ITFSB | \
> -	 ENDIAN_SET_EL1 | SCTLR_EL1_UCI  | SCTLR_EL1_EPAN | SCTLR_EL1_RES1)
> +	(SCTLR_ELx_M      | SCTLR_ELx_C      | SCTLR_ELx_SA    | \
> +	 SCTLR_EL1_SA0    | SCTLR_EL1_SED    | SCTLR_ELx_I     | \
> +	 SCTLR_EL1_DZE    | SCTLR_EL1_UCT    | SCTLR_EL1_nTWE  | \
> +	 SCTLR_ELx_IESB   | SCTLR_EL1_SPAN   | SCTLR_ELx_ITFSB | \
> +	 ENDIAN_SET_EL1   | SCTLR_EL1_UCI    | SCTLR_EL1_EPAN  | \
> +	 SCTLR_EL1_LSMAOE | SCTLR_EL1_nTLSMD | SCTLR_EL1_EIS   | \
> +	 SCTLR_EL1_TSCXT  | SCTLR_EL1_EOS)
>  
>  /* MAIR_ELx memory attributes (used by Linux) */
>  #define MAIR_ATTR_DEVICE_nGnRnE		UL(0x00)
> -- 
> 2.30.2
> 



More information about the linux-arm-kernel mailing list