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

[Xen-changelog] [xen-unstable] hap_gva_to_gfn paging support. Return PFEC_page_paged when a paged



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1261031275 0
# Node ID 1165acfea711ef33798d12fb5078e3b31faa3e44
# Parent  52a97cb711dd57d0bf4301e11ece2095ecc0a180
hap_gva_to_gfn paging support. Return PFEC_page_paged when a paged
out page is found. Ensure top-level page table page and l1 entry
are paged in. If an intermediary page table page is paged out,
propogate error to caller.

Signed-off-by: Patrick Colp <Patrick.Colp@xxxxxxxxxx>
---
 xen/arch/x86/mm/hap/guest_walk.c |   32 ++++++++++++++++++++++++++++----
 xen/include/asm-x86/processor.h  |    1 +
 2 files changed, 29 insertions(+), 4 deletions(-)

diff -r 52a97cb711dd -r 1165acfea711 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c  Thu Dec 17 06:27:55 2009 +0000
+++ b/xen/arch/x86/mm/hap/guest_walk.c  Thu Dec 17 06:27:55 2009 +0000
@@ -46,6 +46,14 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN
     /* Get the top-level table's MFN */
     cr3 = v->arch.hvm_vcpu.guest_cr[3];
     top_mfn = gfn_to_mfn(v->domain, _gfn(cr3 >> PAGE_SHIFT), &p2mt);
+    if ( p2m_is_paging(p2mt) )
+    {
+//        if ( p2m_is_paged(p2mt) )
+            p2m_mem_paging_populate(v->domain, cr3 >> PAGE_SHIFT);
+
+        pfec[0] = PFEC_page_paged;
+        return INVALID_GFN;
+    }
     if ( !p2m_is_ram(p2mt) )
     {
         pfec[0] &= ~PFEC_page_present;
@@ -62,12 +70,28 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN
     unmap_domain_page(top_map);
 
     /* Interpret the answer */
-    if ( missing == 0 ) 
-        return gfn_x(guest_l1e_get_gfn(gw.l1e));
-    
+    if ( missing == 0 )
+    {
+        gfn_t gfn = guest_l1e_get_gfn(gw.l1e);
+        gfn_to_mfn(v->domain, gfn, &p2mt);
+        if ( p2m_is_paging(p2mt) )
+        {
+//            if ( p2m_is_paged(p2mt) )
+                p2m_mem_paging_populate(v->domain, gfn_x(gfn));
+
+            pfec[0] = PFEC_page_paged;
+            return INVALID_GFN;
+        }
+
+        return gfn_x(gfn);
+    }
+
     if ( missing & _PAGE_PRESENT )
         pfec[0] &= ~PFEC_page_present;
-    
+
+    if ( missing & _PAGE_PAGED )
+        pfec[0] = PFEC_page_paged;
+
     return INVALID_GFN;
 }
 
diff -r 52a97cb711dd -r 1165acfea711 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   Thu Dec 17 06:27:55 2009 +0000
+++ b/xen/include/asm-x86/processor.h   Thu Dec 17 06:27:55 2009 +0000
@@ -132,6 +132,7 @@
 #define PFEC_user_mode      (1U<<2)
 #define PFEC_reserved_bit   (1U<<3)
 #define PFEC_insn_fetch     (1U<<4)
+#define PFEC_page_paged     (1U<<5)
 
 #ifndef __ASSEMBLY__
 

_______________________________________________
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®.