Skip to contentSkip to conversation

x86 hvm: fix up the unified HAP nested-pagefault handler.

PATCH New Tim Deegan 1 participant 1 message Dec 2, 2009

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 x86 hvm: fix up the unified HAP nested-pagefault handler.

x86 hvm: fix up the unified HAP nested-pagefault handler. A guest PFN may have been marked dirty and switched to p2m_ram_rw by another CPU between the VMEXIT and lookup in this handler, so we can't just check for p2m_ram_logdirty. Also, handle_mmio doesn't handle passthrough MMIO.

xen/arch/x86/hvm/hvm.c +3 -2
diff -r 176b4c8e2c4b xen/arch/x86/hvm/hvm.c
@@ -927,7 +927,7 @@
      * If this GFN is emulated MMIO or marked as read-only, pass the fault
      * to the mmio handler.
      */
-    if ( p2m_is_mmio(p2mt) || (p2mt == p2m_ram_ro) )
+    if ( (p2mt == p2m_mmio_dm) || (p2mt == p2m_ram_ro) )
     {
         if ( !handle_mmio() )
             hvm_inject_exception(TRAP_gp_fault, 0, 0);
@@ -935,7 +935,8 @@
     }
 
     /* Log-dirty: mark the page dirty and let the guest write it again */
-    if ( p2mt == p2m_ram_logdirty )
+    if ( paging_mode_log_dirty(current->domain)
+         && p2m_is_ram(p2mt) && (p2mt != p2m_ram_ro) )
     {
         paging_mark_dirty(current->domain, mfn_x(mfn));
         p2m_change_type(current->domain, gfn, p2m_ram_logdirty, p2m_ram_rw);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel