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

[Xen-changelog] [xen-unstable] x86: Handle p2m_ram_ro with HAP



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1217502660 -3600
# Node ID a09df7d4e94eaf6554e97faa0cbcc733dd90581d
# Parent  532094aefa5d5e21c52624af5d35621713e8454d
x86: Handle p2m_ram_ro with HAP

I realized that I had failed to cover the hardware assisted paging
case in my earlier p2m_ram_ro patches. This should fix it.

Signed-off-by: Trolle Selander <trolle.selander@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c |    7 +++++--
 xen/arch/x86/hvm/vmx/vmx.c |    2 +-
 xen/include/asm-x86/p2m.h  |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff -r 532094aefa5d -r a09df7d4e94e xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Jul 31 11:55:19 2008 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Jul 31 12:11:00 2008 +0100
@@ -874,9 +874,12 @@ static void svm_do_nested_pgfault(paddr_
     mfn_t mfn;
     unsigned long gfn = gpa >> PAGE_SHIFT;
 
-    /* If this GFN is emulated MMIO, pass the fault to the mmio handler */
+    /*
+     * If this GFN is emulated MMIO or marked as read-only, pass the fault
+     * to the mmio handler.
+     */
     mfn = gfn_to_mfn_current(gfn, &p2mt);
-    if ( p2mt == p2m_mmio_dm )
+    if ( (p2mt == p2m_mmio_dm) || (p2mt == p2m_ram_ro) )
     {
         if ( !handle_mmio() )
             hvm_inject_exception(TRAP_gp_fault, 0, 0);
diff -r 532094aefa5d -r a09df7d4e94e xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Thu Jul 31 11:55:19 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Jul 31 12:11:00 2008 +0100
@@ -1971,7 +1971,7 @@ static void ept_handle_violation(unsigne
     }
 
     mfn = gfn_to_mfn(d, gfn, &t);
-    if ( p2m_is_ram(t) && paging_mode_log_dirty(d) )
+    if ( (t != p2m_ram_ro) && p2m_is_ram(t) && paging_mode_log_dirty(d) )
     {
         paging_mark_dirty(d, mfn_x(mfn));
         p2m_change_type(d, gfn, p2m_ram_logdirty, p2m_ram_rw);
diff -r 532094aefa5d -r a09df7d4e94e xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h Thu Jul 31 11:55:19 2008 +0100
+++ b/xen/include/asm-x86/p2m.h Thu Jul 31 12:11:00 2008 +0100
@@ -61,7 +61,7 @@ typedef enum {
     p2m_invalid = 0,            /* Nothing mapped here */
     p2m_ram_rw = 1,             /* Normal read/write guest RAM */
     p2m_ram_logdirty = 2,       /* Temporarily read-only for log-dirty */
-    p2m_ram_ro = 3,             /* Read-only; writes go to the device model */
+    p2m_ram_ro = 3,             /* Read-only; writes are silently dropped */
     p2m_mmio_dm = 4,            /* Reads and write go to the device model */
     p2m_mmio_direct = 5,        /* Read/write mapping of genuine MMIO area */
 } p2m_type_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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