[PATCH v3 03/28] xen/altp2m: move p2m_set_suppress_ve_multi() forward

Penny Zheng posted 28 patches 2 weeks, 3 days ago
Only 27 patches received!
[PATCH v3 03/28] xen/altp2m: move p2m_set_suppress_ve_multi() forward
Posted by Penny Zheng 2 weeks, 3 days ago
The declaration of p2m_set_suppress_ve_multi() is in <asm/mem_access.h> and
hasn't been included on compiling altp2m.o when VM_EVENT=n, resulting in
undefined error.
To fix it, we could simply move p2m_set_suppress_ve_multi() forward.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v2 -> v3:
- new commit
---
 xen/arch/x86/mm/altp2m.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c
index 0261360aae..962111fbb0 100644
--- a/xen/arch/x86/mm/altp2m.c
+++ b/xen/arch/x86/mm/altp2m.c
@@ -640,23 +640,6 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn,
     return ret;
 }
 
-/*
- * Set/clear the #VE suppress bit for a page.  Only available on VMX.
- */
-int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
-                        unsigned int altp2m_idx)
-{
-    int rc;
-    struct xen_hvm_altp2m_suppress_ve_multi sve = {
-        altp2m_idx, suppress_ve, 0, 0, gfn_x(gfn), gfn_x(gfn), 0
-    };
-
-    if ( !(rc = p2m_set_suppress_ve_multi(d, &sve)) )
-        rc = sve.first_error;
-
-    return rc;
-}
-
 /*
  * Set/clear the #VE suppress bit for multiple pages.  Only available on VMX.
  */
@@ -725,6 +708,23 @@ int p2m_set_suppress_ve_multi(struct domain *d,
     return rc;
 }
 
+/*
+ * Set/clear the #VE suppress bit for a page.  Only available on VMX.
+ */
+int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
+                        unsigned int altp2m_idx)
+{
+    int rc;
+    struct xen_hvm_altp2m_suppress_ve_multi sve = {
+        altp2m_idx, suppress_ve, 0, 0, gfn_x(gfn), gfn_x(gfn), 0
+    };
+
+    if ( !(rc = p2m_set_suppress_ve_multi(d, &sve)) )
+        rc = sve.first_error;
+
+    return rc;
+}
+
 int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve,
                         unsigned int altp2m_idx)
 {
-- 
2.34.1
Re: [PATCH v3 03/28] xen/altp2m: move p2m_set_suppress_ve_multi() forward
Posted by Jan Beulich 2 days, 1 hour ago
On 13.10.2025 12:15, Penny Zheng wrote:
> The declaration of p2m_set_suppress_ve_multi() is in <asm/mem_access.h> and
> hasn't been included on compiling altp2m.o when VM_EVENT=n, resulting in
> undefined error.
> To fix it, we could simply move p2m_set_suppress_ve_multi() forward.

I don't mind the move, but a definition appearing without a prior declaration
is a Misra violation as well, iirc. So the missing #include will need adding
anyway, afaict.

Jan