diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 58d4951..576b28d 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1514,6 +1514,13 @@ void p2m_mem_access_emulate_check(struct vcpu *v,
     }
 }

+void p2m_altp2m_check(struct vcpu *v, const vm_event_response_t *rsp)
+{
+    if ( (rsp->flags & VM_EVENT_FLAG_ALTERNATE_P2M) &&

Please keep the check for (rsp->flags & VM_EVENT_FLAG_ALTERNATE_P2M) in common/vm_event.c. With that you also only have to pass the altp2m_idx here.
 
+         altp2m_active(v->domain) )
+        p2m_switch_vcpu_altp2m_by_id(v, rsp->altp2m_idx);
+}
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 120a78a..57095d8 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -399,6 +399,9 @@ void vm_event_resume(struct domain *d, struct vm_event_domain *ved)

         };

+        /* Check for altp2m switch */
+        p2m_altp2m_check(v, &rsp);

See my comment above.

Thanks,
Tamas