Skip to contentSkip to conversation

move PAGE_ALIGN() to common header

PATCH In review Jan Beulich 2 participants 2 messages Aug 9, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 move PAGE_ALIGN() to common header

Much like we have PAGE_OFFSET() there already, there's also no reason for each arch to define identical PAGE_ALIGN().

xen/arch/arm/include/asm/page.h +0 -2
@@ -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__ */
 
 /*
xen/arch/x86/include/asm/page.h +0 -2
@@ -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__ */
 
 /*
xen/include/xen/page-size.h +2 -1
@@ -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))
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 30 lines · Jan Beulich

Much like we have PAGE_OFFSET() there already, there's also no reason for each arch to define identical PAGE_ALIGN().

xen/arch/arm/include/asm/page.h +0 -2
@@ -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__ */
 
  /*
xen/arch/x86/include/asm/page.h +0 -2
@@ -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__ */
 
  /*

xen/include/xen/page-size.h line 13

Quoted 5 lines
xen/include/xen/page-size.h +1 -1
@@ -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:

Cheers,

Signature · 1 line
Julien Grall