From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:55 +0000 (+0000) Subject: Paging support for guest walk tables to page in l1-l3 page table pages. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12875 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1554c2b83668a3c5816f9afa67b791f69c4ea0f5;p=xen.git Paging support for guest walk tables to page in l1-l3 page table pages. A new page flag has been added to indicate that a paged out page was found while walking the page tables. The paging in code is automatically called, so the flag is only an indicator that the operation should be retried, not that the page should be paged in. Signed-off-by: Patrick Colp --- diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c index 19f239314c..b0f42f328a 100644 --- a/xen/arch/x86/mm/guest_walk.c +++ b/xen/arch/x86/mm/guest_walk.c @@ -125,6 +125,13 @@ guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, /* Map the l3 table */ gw->l3mfn = gfn_to_mfn(d, guest_l4e_get_gfn(gw->l4e), &p2mt); + if ( p2m_is_paging(p2mt) ) + { + p2m_mem_paging_populate(d, gfn_x(guest_l4e_get_gfn(gw->l4e))); + + rc = _PAGE_PAGED; + goto out; + } if ( !p2m_is_ram(p2mt) ) { rc |= _PAGE_PRESENT; @@ -154,6 +161,13 @@ guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, /* Map the l2 table */ gw->l2mfn = gfn_to_mfn(d, guest_l3e_get_gfn(gw->l3e), &p2mt); + if ( p2m_is_paging(p2mt) ) + { + p2m_mem_paging_populate(d, gfn_x(guest_l3e_get_gfn(gw->l3e))); + + rc = _PAGE_PAGED; + goto out; + } if ( !p2m_is_ram(p2mt) ) { rc |= _PAGE_PRESENT; @@ -212,6 +226,13 @@ guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, { /* Not a superpage: carry on and find the l1e. */ gw->l1mfn = gfn_to_mfn(d, guest_l2e_get_gfn(gw->l2e), &p2mt); + if ( p2m_is_paging(p2mt) ) + { + p2m_mem_paging_populate(d, gfn_x(guest_l2e_get_gfn(gw->l2e))); + + rc = _PAGE_PAGED; + goto out; + } if ( !p2m_is_ram(p2mt) ) { rc |= _PAGE_PRESENT; diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 1997863719..9802e2d495 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -311,6 +311,7 @@ void setup_idle_pagetable(void); #define _PAGE_AVAIL2 0x800U #define _PAGE_AVAIL 0xE00U #define _PAGE_PSE_PAT 0x1000U +#define _PAGE_PAGED 0x2000U /* * Debug option: Ensure that granted mappings are not implicitly unmapped.