[Xen-devel,03/20] xen/arm: processor: Use _BITUL instead of _AC(1, U) in SCTLR_ defines

Message ID 20190422164937.21350-4-julien.grall@arm.com
State New
Headers show
Series
  • xen/arm: Clean-up & fixes in boot/mm code
Related show

Commit Message

Julien Grall April 22, 2019, 4:49 p.m.
The newly introduced macro _BITUL makes the code more readable.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/include/asm-arm/processor.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Andrii Anisov May 3, 2019, 3:56 p.m. | #1
Hello Julien,

On 22.04.19 19:49, Julien Grall wrote:
> The newly introduced macro _BITUL makes the code more readable.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>   xen/include/asm-arm/processor.h | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
> index c6f56490b3..1a143fb6a3 100644
> --- a/xen/include/asm-arm/processor.h
> +++ b/xen/include/asm-arm/processor.h
> @@ -115,20 +115,20 @@
>   
>   /* Bits specific to SCTLR_EL1 for Arm32 */
>   
> -#define SCTLR_A32_EL1_V     (_AC(1,U)<<13)
> +#define SCTLR_A32_EL1_V     _BITUL(13)
>   
>   /* Common bits for SCTLR_ELx for Arm32 */
>   
> -#define SCTLR_A32_ELx_TE    (_AC(1,U)<<30)
> -#define SCTLR_A32_ELx_FI    (_AC(1,U)<<21)
> +#define SCTLR_A32_ELx_TE    _BITUL(30)
> +#define SCTLR_A32_ELx_FI    _BITUL(21)
>   
>   /* Common bits for SCTLR_ELx on all architectures */
> -#define SCTLR_Axx_ELx_EE    (_AC(1,U)<<25)
> -#define SCTLR_Axx_ELx_WXN   (_AC(1,U)<<19)
> -#define SCTLR_Axx_ELx_I     (_AC(1,U)<<12)
> -#define SCTLR_Axx_ELx_C     (_AC(1,U)<<2)
> -#define SCTLR_Axx_ELx_A     (_AC(1,U)<<1)
> -#define SCTLR_Axx_ELx_M     (_AC(1,U)<<0)
> +#define SCTLR_Axx_ELx_EE    _BITUL(25)
> +#define SCTLR_Axx_ELx_WXN   _BITUL(19)
> +#define SCTLR_Axx_ELx_I     _BITUL(12)
> +#define SCTLR_Axx_ELx_C     _BITUL(2)
> +#define SCTLR_Axx_ELx_A     _BITUL(1)
> +#define SCTLR_Axx_ELx_M     _BITUL(0)
>   
>   #define HSCTLR_BASE     _AC(0x30c51878,U)
>   
> 

Resolution of the dispute with Jan about [PATCH 01/20] is required first.
Julien Grall May 3, 2019, 4:09 p.m. | #2
On 03/05/2019 16:56, Andrii Anisov wrote:
> Hello Julien,
> 
> On 22.04.19 19:49, Julien Grall wrote:
>> The newly introduced macro _BITUL makes the code more readable.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   xen/include/asm-arm/processor.h | 18 +++++++++---------
>>   1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
>> index c6f56490b3..1a143fb6a3 100644
>> --- a/xen/include/asm-arm/processor.h
>> +++ b/xen/include/asm-arm/processor.h
>> @@ -115,20 +115,20 @@
>>   /* Bits specific to SCTLR_EL1 for Arm32 */
>> -#define SCTLR_A32_EL1_V     (_AC(1,U)<<13)
>> +#define SCTLR_A32_EL1_V     _BITUL(13)
>>   /* Common bits for SCTLR_ELx for Arm32 */
>> -#define SCTLR_A32_ELx_TE    (_AC(1,U)<<30)
>> -#define SCTLR_A32_ELx_FI    (_AC(1,U)<<21)
>> +#define SCTLR_A32_ELx_TE    _BITUL(30)
>> +#define SCTLR_A32_ELx_FI    _BITUL(21)
>>   /* Common bits for SCTLR_ELx on all architectures */
>> -#define SCTLR_Axx_ELx_EE    (_AC(1,U)<<25)
>> -#define SCTLR_Axx_ELx_WXN   (_AC(1,U)<<19)
>> -#define SCTLR_Axx_ELx_I     (_AC(1,U)<<12)
>> -#define SCTLR_Axx_ELx_C     (_AC(1,U)<<2)
>> -#define SCTLR_Axx_ELx_A     (_AC(1,U)<<1)
>> -#define SCTLR_Axx_ELx_M     (_AC(1,U)<<0)
>> +#define SCTLR_Axx_ELx_EE    _BITUL(25)
>> +#define SCTLR_Axx_ELx_WXN   _BITUL(19)
>> +#define SCTLR_Axx_ELx_I     _BITUL(12)
>> +#define SCTLR_Axx_ELx_C     _BITUL(2)
>> +#define SCTLR_Axx_ELx_A     _BITUL(1)
>> +#define SCTLR_Axx_ELx_M     _BITUL(0)
>>   #define HSCTLR_BASE     _AC(0x30c51878,U)
>>
> 
> Resolution of the dispute with Jan about [PATCH 01/20] is required first.

I don't understand what is your "second". Does it mean you are happy with the 
idea of the patch but we should agree on the naming first?

Cheers,

>
Andrii Anisov May 3, 2019, 4:12 p.m. | #3
On 03.05.19 19:09, Julien Grall wrote:
> I don't understand what is your "second". Does it mean you are happy with the idea of the patch but we should agree on the naming first?

Yes, right you are.
Sorry for the mess.

Patch

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index c6f56490b3..1a143fb6a3 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -115,20 +115,20 @@ 
 
 /* Bits specific to SCTLR_EL1 for Arm32 */
 
-#define SCTLR_A32_EL1_V     (_AC(1,U)<<13)
+#define SCTLR_A32_EL1_V     _BITUL(13)
 
 /* Common bits for SCTLR_ELx for Arm32 */
 
-#define SCTLR_A32_ELx_TE    (_AC(1,U)<<30)
-#define SCTLR_A32_ELx_FI    (_AC(1,U)<<21)
+#define SCTLR_A32_ELx_TE    _BITUL(30)
+#define SCTLR_A32_ELx_FI    _BITUL(21)
 
 /* Common bits for SCTLR_ELx on all architectures */
-#define SCTLR_Axx_ELx_EE    (_AC(1,U)<<25)
-#define SCTLR_Axx_ELx_WXN   (_AC(1,U)<<19)
-#define SCTLR_Axx_ELx_I     (_AC(1,U)<<12)
-#define SCTLR_Axx_ELx_C     (_AC(1,U)<<2)
-#define SCTLR_Axx_ELx_A     (_AC(1,U)<<1)
-#define SCTLR_Axx_ELx_M     (_AC(1,U)<<0)
+#define SCTLR_Axx_ELx_EE    _BITUL(25)
+#define SCTLR_Axx_ELx_WXN   _BITUL(19)
+#define SCTLR_Axx_ELx_I     _BITUL(12)
+#define SCTLR_Axx_ELx_C     _BITUL(2)
+#define SCTLR_Axx_ELx_A     _BITUL(1)
+#define SCTLR_Axx_ELx_M     _BITUL(0)
 
 #define HSCTLR_BASE     _AC(0x30c51878,U)