From: Keir Fraser Date: Wed, 2 Dec 2009 18:46:14 +0000 (+0000) Subject: x86 hvm: fix up the unified HAP nested-pagefault handler. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12974 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=40e9da38fd8c75147fb9205c6fb6cf6a597d1127;p=xen.git 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. Signed-off-by: Tim Deegan --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ca567638ae..42121fec80 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -927,7 +927,7 @@ bool_t hvm_hap_nested_page_fault(unsigned long gfn) * 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 @@ bool_t hvm_hap_nested_page_fault(unsigned long gfn) } /* 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);