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

Andrew Cooper posted 1 patch 1 day, 9 hours ago
xen/arch/x86/mm/shadow/private.h | 7 -------
xen/arch/x86/mm/shadow/types.h   | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
[PATCH] x86/shadow: Move GUEST_PTE_SIZE defines into types.h
Posted by Andrew Cooper 1 day, 9 hours ago
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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: consulting@bugseng.com <consulting@bugseng.com>
CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/arch/x86/mm/shadow/private.h | 7 -------
 xen/arch/x86/mm/shadow/types.h   | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 1ef908a380de..bc99e00100f7 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -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
  */
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index d700d8d64c8a..13d13c52c007 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -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
-- 
2.39.5


Re: [PATCH] x86/shadow: Move GUEST_PTE_SIZE defines into types.h
Posted by Stefano Stabellini 1 day, 7 hours ago
On Fri, 12 Dec 2025, Andrew Cooper wrote:
> 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>