]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86/shadow: sh_validate_guest_pt_write() is HVM-only
authorJan Beulich <jbeulich@suse.com>
Tue, 12 Mar 2019 13:44:38 +0000 (14:44 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Mar 2019 13:44:38 +0000 (14:44 +0100)
Move the function to hvm.c, make it static, and drop its sh_ prefix.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/hvm.c
xen/arch/x86/mm/shadow/private.h

index 025071a1638af1fcb6ed6f60f0f26f0c4d52cbc2..2d448553886d1c8a4b05e68d534d098809d7e45f 100644 (file)
@@ -886,33 +886,6 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
 }
 
 
-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. */
 
index 8994cb9f87bf4f499dbcb35260ed81dca2d0823d..bf9fd20770f161e665417f104e3c2def2641292e 100644 (file)
@@ -493,6 +493,34 @@ static inline void check_for_early_unshadow(struct vcpu *v, mfn_t gmfn)
 #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 vcpu *v, void *addr,
             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]);
index 580ef3e29e3a54463b524bdcd2e968b265363831..5a94b20c4d24a5a0a2232ae879257e90779ed42d 100644 (file)
@@ -359,10 +359,6 @@ void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn);
 /* 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;