diff mbox series

[kvm-unit-tests,v1,1/2] arm64: Replace the SCTLR_EL1 filed definition by _BITUL()

Message ID 20230719031926.752931-2-shahuang@redhat.com (mailing list archive)
State New, archived
Headers show
Series arm64: Define name for the original RES1 bit but now functinal bit | expand

Commit Message

Shaoqin Huang July 19, 2023, 3:19 a.m. UTC
Currently the SCTLR_EL1_* is defined by (1 << x), all of them can be
replaced by the _BITUL() macro to make the format consistent with the
SCTLR_EL1_RES1 definition.

Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
---
 lib/arm64/asm/sysreg.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Eric Auger July 19, 2023, 5:46 p.m. UTC | #1
Hi Shaoqin,

On 7/19/23 05:19, Shaoqin Huang wrote:
> Currently the SCTLR_EL1_* is defined by (1 << x), all of them can be
> replaced by the _BITUL() macro to make the format consistent with the
> SCTLR_EL1_RES1 definition.

I would rephrase the commit title into arm64: Use _BITUL() to define
SCTLR_EL1 bit fields

Besides, since SCTLR_EL1 is 64b shouldn't we have _BITULL() everywhere
instead?

Eric
>
> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>  lib/arm64/asm/sysreg.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h
> index 18c4ed3..c7f529d 100644
> --- a/lib/arm64/asm/sysreg.h
> +++ b/lib/arm64/asm/sysreg.h
> @@ -80,14 +80,14 @@ 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_EE		_BITUL(25)
> +#define SCTLR_EL1_WXN		_BITUL(19)
> +#define SCTLR_EL1_I		_BITUL(12)
> +#define SCTLR_EL1_SA0		_BITUL(4)
> +#define SCTLR_EL1_SA		_BITUL(3)
> +#define SCTLR_EL1_C		_BITUL(2)
> +#define SCTLR_EL1_A		_BITUL(1)
> +#define SCTLR_EL1_M		_BITUL(0)
>  
>  #define SCTLR_EL1_RES1	(_BITUL(7) | _BITUL(8) | _BITUL(11) | _BITUL(20) | \
>  			 _BITUL(22) | _BITUL(23) | _BITUL(28) | _BITUL(29))
Shaoqin Huang July 20, 2023, 11:50 a.m. UTC | #2
Hi Eric,

On 7/20/23 01:46, Eric Auger wrote:
> Hi Shaoqin,
> 
> On 7/19/23 05:19, Shaoqin Huang wrote:
>> Currently the SCTLR_EL1_* is defined by (1 << x), all of them can be
>> replaced by the _BITUL() macro to make the format consistent with the
>> SCTLR_EL1_RES1 definition.
> 
> I would rephrase the commit title into arm64: Use _BITUL() to define
> SCTLR_EL1 bit fields
> 
This would be good. I will change the title to it.

> Besides, since SCTLR_EL1 is 64b shouldn't we have _BITULL() everywhere
> instead?
Yeah. Although the _BITUL() can cover the 64 bit value, it would be 
clear to use the _BITULL(), let me change it in next version.

Thanks,
Shaoqin
> 
> Eric
>>
>> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
>> ---
>>   lib/arm64/asm/sysreg.h | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h
>> index 18c4ed3..c7f529d 100644
>> --- a/lib/arm64/asm/sysreg.h
>> +++ b/lib/arm64/asm/sysreg.h
>> @@ -80,14 +80,14 @@ 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_EE		_BITUL(25)
>> +#define SCTLR_EL1_WXN		_BITUL(19)
>> +#define SCTLR_EL1_I		_BITUL(12)
>> +#define SCTLR_EL1_SA0		_BITUL(4)
>> +#define SCTLR_EL1_SA		_BITUL(3)
>> +#define SCTLR_EL1_C		_BITUL(2)
>> +#define SCTLR_EL1_A		_BITUL(1)
>> +#define SCTLR_EL1_M		_BITUL(0)
>>   
>>   #define SCTLR_EL1_RES1	(_BITUL(7) | _BITUL(8) | _BITUL(11) | _BITUL(20) | \
>>   			 _BITUL(22) | _BITUL(23) | _BITUL(28) | _BITUL(29))
>
diff mbox series

Patch

diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h
index 18c4ed3..c7f529d 100644
--- a/lib/arm64/asm/sysreg.h
+++ b/lib/arm64/asm/sysreg.h
@@ -80,14 +80,14 @@  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_EE		_BITUL(25)
+#define SCTLR_EL1_WXN		_BITUL(19)
+#define SCTLR_EL1_I		_BITUL(12)
+#define SCTLR_EL1_SA0		_BITUL(4)
+#define SCTLR_EL1_SA		_BITUL(3)
+#define SCTLR_EL1_C		_BITUL(2)
+#define SCTLR_EL1_A		_BITUL(1)
+#define SCTLR_EL1_M		_BITUL(0)
 
 #define SCTLR_EL1_RES1	(_BITUL(7) | _BITUL(8) | _BITUL(11) | _BITUL(20) | \
 			 _BITUL(22) | _BITUL(23) | _BITUL(28) | _BITUL(29))