Message ID | 20190812173019.11956-2-julien.grall@arm.com |
---|---|
State | New |
Headers | show |
Series | xen/arm: Rework head.S to make it more compliant with the Arm Arm | expand |
On Mon, 12 Aug 2019, Julien Grall wrote: > A follow-up patch will require to use *_table_offset() and *_MASK helpers > from assembly. This can be achieved by using _AT() macro to remove the type > when called from assembly. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v3: > - Patch added > --- > xen/include/asm-arm/lpae.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h > index c22780f8f3..4797f9cee4 100644 > --- a/xen/include/asm-arm/lpae.h > +++ b/xen/include/asm-arm/lpae.h > @@ -245,19 +245,19 @@ TABLE_OFFSET_HELPERS(64); > > #define THIRD_SHIFT (PAGE_SHIFT) > #define THIRD_ORDER (THIRD_SHIFT - PAGE_SHIFT) > -#define THIRD_SIZE ((paddr_t)1 << THIRD_SHIFT) > +#define THIRD_SIZE (_AT(paddr_t, 1) << THIRD_SHIFT) > #define THIRD_MASK (~(THIRD_SIZE - 1)) > #define SECOND_SHIFT (THIRD_SHIFT + LPAE_SHIFT) > #define SECOND_ORDER (SECOND_SHIFT - PAGE_SHIFT) > -#define SECOND_SIZE ((paddr_t)1 << SECOND_SHIFT) > +#define SECOND_SIZE (_AT(paddr_t, 1) << SECOND_SHIFT) > #define SECOND_MASK (~(SECOND_SIZE - 1)) > #define FIRST_SHIFT (SECOND_SHIFT + LPAE_SHIFT) > #define FIRST_ORDER (FIRST_SHIFT - PAGE_SHIFT) > -#define FIRST_SIZE ((paddr_t)1 << FIRST_SHIFT) > +#define FIRST_SIZE (_AT(paddr_t, 1) << FIRST_SHIFT) > #define FIRST_MASK (~(FIRST_SIZE - 1)) > #define ZEROETH_SHIFT (FIRST_SHIFT + LPAE_SHIFT) > #define ZEROETH_ORDER (ZEROETH_SHIFT - PAGE_SHIFT) > -#define ZEROETH_SIZE ((paddr_t)1 << ZEROETH_SHIFT) > +#define ZEROETH_SIZE (_AT(paddr_t, 1) << ZEROETH_SHIFT) > #define ZEROETH_MASK (~(ZEROETH_SIZE - 1)) > > /* Calculate the offsets into the pagetables for a given VA */ > @@ -266,7 +266,7 @@ TABLE_OFFSET_HELPERS(64); > #define second_linear_offset(va) ((va) >> SECOND_SHIFT) > #define third_linear_offset(va) ((va) >> THIRD_SHIFT) > > -#define TABLE_OFFSET(offs) ((unsigned int)(offs) & LPAE_ENTRY_MASK) > +#define TABLE_OFFSET(offs) (_AT(unsigned int, offs) & LPAE_ENTRY_MASK) > #define first_table_offset(va) TABLE_OFFSET(first_linear_offset(va)) > #define second_table_offset(va) TABLE_OFFSET(second_linear_offset(va)) > #define third_table_offset(va) TABLE_OFFSET(third_linear_offset(va)) > -- > 2.11.0 >
diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index c22780f8f3..4797f9cee4 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -245,19 +245,19 @@ TABLE_OFFSET_HELPERS(64); #define THIRD_SHIFT (PAGE_SHIFT) #define THIRD_ORDER (THIRD_SHIFT - PAGE_SHIFT) -#define THIRD_SIZE ((paddr_t)1 << THIRD_SHIFT) +#define THIRD_SIZE (_AT(paddr_t, 1) << THIRD_SHIFT) #define THIRD_MASK (~(THIRD_SIZE - 1)) #define SECOND_SHIFT (THIRD_SHIFT + LPAE_SHIFT) #define SECOND_ORDER (SECOND_SHIFT - PAGE_SHIFT) -#define SECOND_SIZE ((paddr_t)1 << SECOND_SHIFT) +#define SECOND_SIZE (_AT(paddr_t, 1) << SECOND_SHIFT) #define SECOND_MASK (~(SECOND_SIZE - 1)) #define FIRST_SHIFT (SECOND_SHIFT + LPAE_SHIFT) #define FIRST_ORDER (FIRST_SHIFT - PAGE_SHIFT) -#define FIRST_SIZE ((paddr_t)1 << FIRST_SHIFT) +#define FIRST_SIZE (_AT(paddr_t, 1) << FIRST_SHIFT) #define FIRST_MASK (~(FIRST_SIZE - 1)) #define ZEROETH_SHIFT (FIRST_SHIFT + LPAE_SHIFT) #define ZEROETH_ORDER (ZEROETH_SHIFT - PAGE_SHIFT) -#define ZEROETH_SIZE ((paddr_t)1 << ZEROETH_SHIFT) +#define ZEROETH_SIZE (_AT(paddr_t, 1) << ZEROETH_SHIFT) #define ZEROETH_MASK (~(ZEROETH_SIZE - 1)) /* Calculate the offsets into the pagetables for a given VA */ @@ -266,7 +266,7 @@ TABLE_OFFSET_HELPERS(64); #define second_linear_offset(va) ((va) >> SECOND_SHIFT) #define third_linear_offset(va) ((va) >> THIRD_SHIFT) -#define TABLE_OFFSET(offs) ((unsigned int)(offs) & LPAE_ENTRY_MASK) +#define TABLE_OFFSET(offs) (_AT(unsigned int, offs) & LPAE_ENTRY_MASK) #define first_table_offset(va) TABLE_OFFSET(first_linear_offset(va)) #define second_table_offset(va) TABLE_OFFSET(second_linear_offset(va)) #define third_table_offset(va) TABLE_OFFSET(third_linear_offset(va))
A follow-up patch will require to use *_table_offset() and *_MASK helpers from assembly. This can be achieved by using _AT() macro to remove the type when called from assembly. Signed-off-by: Julien Grall <julien.grall@arm.com> --- Changes in v3: - Patch added --- xen/include/asm-arm/lpae.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)