Skip to contentSkip to conversation

arm/altp2m: Add support for altp2m_{get,set}_altp2m

RFC PATCH New [email protected] 1 participant 1 message Apr 20

lore
Share & tools
lore
#0 lore raw

RFC PATCH v6 27/43 arm/altp2m: Add support for altp2m_{get,set}_altp2m

From: Rose Spangler <[email protected]>

This commit adds support for altp2m_get_altp2m and altp2m_set_altp2m on ARM. The x86-specific VCPU accesses have been replaced with the architecture independent functions altp2m_vcpu_idx and altp2m_set_vcpu_idx.

This is commit 4/4 of the altp2m_{get,set}_altp2m phase.

---
v6: Introduced this patch.

---
 xen/include/xen/altp2m.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
xen/include/xen/altp2m.h +4 -5
index 58e74be6deb0..f5a4d0e60562 100644
@@ -8,6 +8,7 @@
 
 #include <public/hvm/hvm_op.h>
 
+#include <asm/altp2m.h>
 #include <asm/p2m.h>
 
 #define INVALID_ALTP2M  0xffff
@@ -31,11 +32,10 @@ static inline bool altp2m_active(const struct domain *d)
     return d->altp2m_active;
 }
 
-#ifdef CONFIG_X86
 /* get current alternate p2m table */
 static inline struct p2m_domain *altp2m_get_altp2m(struct vcpu *v)
 {
-    unsigned int index = vcpu_altp2m(v).p2midx;
+    unsigned int index = altp2m_vcpu_idx(v);
 
     if ( index == INVALID_ALTP2M )
         return NULL;
@@ -52,19 +52,18 @@ static inline bool altp2m_set_altp2m(struct vcpu *v, unsigned int idx)
 
     BUG_ON(idx >= v->domain->nr_altp2m);
 
-    if ( idx == vcpu_altp2m(v).p2midx )
+    if ( idx == altp2m_vcpu_idx(v) )
         return false;
 
     orig = altp2m_get_altp2m(v);
     BUG_ON(!orig);
     atomic_dec(&orig->active_vcpus);
 
-    vcpu_altp2m(v).p2midx = idx;
+    altp2m_set_vcpu_idx(v, idx);
     atomic_inc(&v->domain->altp2m_p2m[idx]->active_vcpus);
 
     return true;
 }
-#endif
 
 int do_altp2m_op(XEN_GUEST_HANDLE_PARAM(void) arg);
 
Signature · 1 line
2.34.1