diff mbox series

move PAGE_ALIGN() to common header

Message ID a62ca6f0-765d-16bc-a5d4-e1ca9303de6a@suse.com (mailing list archive)
State New, archived
Headers show
Series move PAGE_ALIGN() to common header | expand

Commit Message

Jan Beulich Aug. 9, 2023, 10:50 a.m. UTC
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>

Comments

Julien Grall Aug. 9, 2023, 10:55 a.m. UTC | #1
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,
diff mbox series

Patch

--- 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))