[PATCH] move PAGE_ALIGN() to common header

Jan Beulich posted 1 patch 8 months, 3 weeks ago
Failed in applying to current master (apply log)
[PATCH] move PAGE_ALIGN() to common header
Posted by Jan Beulich 8 months, 3 weeks ago
Much like we have PAGE_OFFSET() there already, there's also no reason
for each arch to define identical PAGE_ALIGN().

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/include/asm/page.h
+++ b/xen/arch/arm/include/asm/page.h
@@ -303,8 +303,6 @@ static inline int gva_to_ipa(vaddr_t va,
 
 #endif /* __ASSEMBLY__ */
 
-#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #endif /* __ARM_PAGE_H__ */
 
 /*
--- a/xen/arch/x86/include/asm/page.h
+++ b/xen/arch/x86/include/asm/page.h
@@ -404,8 +404,6 @@ static inline void invalidate_icache(voi
 
 #endif /* !__ASSEMBLY__ */
 
-#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #endif /* __X86_PAGE_H__ */
 
 /*
--- a/xen/include/xen/page-size.h
+++ b/xen/include/xen/page-size.h
@@ -10,7 +10,8 @@
  */
 #define PAGE_SIZE           (_AC(1,L) << PAGE_SHIFT)
 #define PAGE_MASK           (~(PAGE_SIZE-1))
-#define PAGE_OFFSET(ptr)   ((unsigned long)(ptr) & ~PAGE_MASK)
+#define PAGE_OFFSET(ptr)    ((unsigned long)(ptr) & ~PAGE_MASK)
+#define PAGE_ALIGN(x)       (((x) + PAGE_SIZE - 1) & PAGE_MASK)
 
 #define PADDR_MASK          ((_AC(1,ULL) << PADDR_BITS) - 1)
 #define VADDR_MASK          (~_AC(0,UL) >> (BITS_PER_LONG - VADDR_BITS))
Re: [PATCH] move PAGE_ALIGN() to common header
Posted by Julien Grall 8 months, 3 weeks ago
Hi,

On 09/08/2023 11:50, Jan Beulich wrote:
> Much like we have PAGE_OFFSET() there already, there's also no reason
> for each arch to define identical PAGE_ALIGN().
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/arm/include/asm/page.h
> +++ b/xen/arch/arm/include/asm/page.h
> @@ -303,8 +303,6 @@ static inline int gva_to_ipa(vaddr_t va,
>   
>   #endif /* __ASSEMBLY__ */
>   
> -#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
> -
>   #endif /* __ARM_PAGE_H__ */
>   
>   /*
> --- a/xen/arch/x86/include/asm/page.h
> +++ b/xen/arch/x86/include/asm/page.h
> @@ -404,8 +404,6 @@ static inline void invalidate_icache(voi
>   
>   #endif /* !__ASSEMBLY__ */
>   
> -#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
> -
>   #endif /* __X86_PAGE_H__ */
>   
>   /*
> --- a/xen/include/xen/page-size.h
> +++ b/xen/include/xen/page-size.h
> @@ -10,7 +10,8 @@
>    */
>   #define PAGE_SIZE           (_AC(1,L) << PAGE_SHIFT)
>   #define PAGE_MASK           (~(PAGE_SIZE-1))
> -#define PAGE_OFFSET(ptr)   ((unsigned long)(ptr) & ~PAGE_MASK)
> +#define PAGE_OFFSET(ptr)    ((unsigned long)(ptr) & ~PAGE_MASK)

Please mention in the commit message that you took the opportunity to 
re-indent PAGE_OFFSET(). With that:

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall