[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] x86/shadow: sh_validate_guest_pt_write() is HVM-only



Move the function to hvm.c, make it static, and drop its sh_ prefix.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -886,33 +886,6 @@ sh_validate_guest_entry(struct vcpu *v,
 }
 
 
-void
-sh_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn,
-                           void *entry, u32 size)
-/* This is the entry point for emulated writes to pagetables in HVM guests and
- * PV translated guests.
- */
-{
-    struct domain *d = v->domain;
-    int rc;
-
-    ASSERT(paging_locked_by_me(v->domain));
-    rc = sh_validate_guest_entry(v, gmfn, entry, size);
-    if ( rc & SHADOW_SET_FLUSH )
-        /* Need to flush TLBs to pick up shadow PT changes */
-        flush_tlb_mask(d->dirty_cpumask);
-    if ( rc & SHADOW_SET_ERROR )
-    {
-        /* This page is probably not a pagetable any more: tear it out of the
-         * shadows, along with any tables that reference it.
-         * Since the validate call above will have made a "safe" (i.e. zero)
-         * shadow entry, we can let the domain live even if we can't fully
-         * unshadow the page. */
-        sh_remove_shadows(d, gmfn, 0, 0);
-    }
-}
-
-
 /**************************************************************************/
 /* Memory management for shadow pages. */
 
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -493,6 +493,34 @@ static inline void check_for_early_unsha
 #endif
 }
 
+/* This is the entry point for emulated writes to pagetables in HVM guests */
+static void validate_guest_pt_write(struct vcpu *v, mfn_t gmfn,
+                                    void *entry, unsigned int size)
+{
+    struct domain *d = v->domain;
+    int rc;
+
+    ASSERT(paging_locked_by_me(v->domain));
+
+    rc = sh_validate_guest_entry(v, gmfn, entry, size);
+
+    if ( rc & SHADOW_SET_FLUSH )
+        /* Need to flush TLBs to pick up shadow PT changes */
+        flush_tlb_mask(d->dirty_cpumask);
+
+    if ( rc & SHADOW_SET_ERROR )
+    {
+        /*
+         * This page is probably not a pagetable any more: tear it out of the
+         * shadows, along with any tables that reference it.
+         * Since the validate call above will have made a "safe" (i.e. zero)
+         * shadow entry, we can let the domain live even if we can't fully
+         * unshadow the page.
+         */
+        sh_remove_shadows(d, gmfn, 0, 0);
+    }
+}
+
 /*
  * Tidy up after the emulated write: mark pages dirty, verify the new
  * contents, and undo the mapping.
@@ -558,9 +586,9 @@ static void sh_emulate_unmap_dest(struct
             ASSERT(b2 < bytes);
         }
         if ( likely(b1 > 0) )
-            sh_validate_guest_pt_write(v, sh_ctxt->mfn[0], addr, b1);
+            validate_guest_pt_write(v, sh_ctxt->mfn[0], addr, b1);
         if ( unlikely(b2 > 0) )
-            sh_validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2);
+            validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2);
     }
 
     paging_mark_dirty(v->domain, sh_ctxt->mfn[0]);
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -359,10 +359,6 @@ void sh_install_xen_entries_in_l4(struct
 /* Update the shadows in response to a pagetable write from Xen */
 int sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size);
 
-/* Update the shadows in response to a pagetable write from a HVM guest */
-void sh_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn,
-                                void *entry, u32 size);
-
 /* Remove all writeable mappings of a guest frame from the shadows.
  * Returns non-zero if we need to flush TLBs.
  * level and fault_addr desribe how we found this to be a pagetable;





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.