Skip to contentSkip to conversation

x86/shadow: Move GUEST_PTE_SIZE defines into types.h

PATCH In review Andrew Cooper 3 participants 3 messages Dec 12, 2025 – Dec 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/shadow: Move GUEST_PTE_SIZE defines into types.h

GUEST_PTE_SIZE are only used by multi.c, but private.h gets used by code that doesn't have GUEST_PAGING_LEVELS defined. Eclair notes that this is a violation of MISRA Rule 20.9.

Move it into types.h with the rest of the level-dependent logic lives.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: [email protected] <[email protected]>
CC: Nicola Vetrini <[email protected]>

---
 xen/arch/x86/mm/shadow/private.h | 7 -------
 xen/arch/x86/mm/shadow/types.h   | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
xen/arch/x86/mm/shadow/private.h +0 -7
index 1ef908a380de..bc99e00100f7 100644
@@ -121,13 +121,6 @@ enum {
 };
 
 
-/* Size (in bytes) of a guest PTE */
-#if GUEST_PAGING_LEVELS >= 3
-# define GUEST_PTE_SIZE 8
-#else
-# define GUEST_PTE_SIZE 4
-#endif
-
 /******************************************************************************
  * Auditing routines
  */
xen/arch/x86/mm/shadow/types.h +7 -0
index d700d8d64c8a..13d13c52c007 100644
@@ -18,6 +18,13 @@
 #define SHADOW_PAGING_LEVELS 3
 #endif
 
+/* Size (in bytes) of a guest PTE */
+#if GUEST_PAGING_LEVELS >= 3
+# define GUEST_PTE_SIZE 8
+#else
+# define GUEST_PTE_SIZE 4
+#endif
+
 /*
  * Define various types for handling pagetabels, based on these options:
  * SHADOW_PAGING_LEVELS : Number of levels of shadow pagetables
Signature · 1 line
2.39.5
#2 lore raw
In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

GUEST_PTE_SIZE are only used by multi.c, but private.h gets used by code that doesn't have GUEST_PAGING_LEVELS defined. Eclair notes that this is a violation of MISRA Rule 20.9.

Move it into types.h with the rest of the level-dependent logic lives.

No functional change.

Okay with me, yet I wonder if we shouldn't go a step further and simply drop the constant, replacing uses of it by sizeof(guest_intpte_t).

Jan