[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86/mm: Teach paging to page table-based p2m
# HG changeset patch # User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> # Date 1333018893 -3600 # Node ID d52833fd69f86226703cfbc0fc6265e9b65eb39f # Parent 6be5875ce735c581769febadf94d38f9853b3fa8 x86/mm: Teach paging to page table-based p2m The p2m-pt.c code, used by both shadow and AMD NPT modes, was not aware of paging types, and the implications those types have on p2m entries. Add support to the page table-based p2m to understand the paging types. This is a necessary step towards enabling memory paging on AMD NPT mode, but not yet the full solution. Tested not to break neither shadow mode nor "normal" (i.e. no paging) AMD NPT mode. Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> Committed-by: Tim Deegan <tim@xxxxxxx> --- diff -r 6be5875ce735 -r d52833fd69f8 xen/arch/x86/mm/p2m-pt.c --- a/xen/arch/x86/mm/p2m-pt.c Thu Mar 29 11:29:24 2012 +0100 +++ b/xen/arch/x86/mm/p2m-pt.c Thu Mar 29 12:01:33 2012 +0100 @@ -84,6 +84,9 @@ static unsigned long p2m_type_to_flags(p case p2m_invalid: case p2m_mmio_dm: case p2m_populate_on_demand: + case p2m_ram_paging_out: + case p2m_ram_paged: + case p2m_ram_paging_in: default: return flags; case p2m_ram_ro: @@ -175,7 +178,7 @@ p2m_next_level(struct p2m_domain *p2m, m shift, max)) ) return 0; - /* PoD: Not present doesn't imply empty. */ + /* PoD/paging: Not present doesn't imply empty. */ if ( !l1e_get_flags(*p2m_entry) ) { struct page_info *pg; @@ -391,7 +394,8 @@ p2m_set_entry(struct p2m_domain *p2m, un 0, L1_PAGETABLE_ENTRIES); ASSERT(p2m_entry); - if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) ) + if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) + || p2m_is_paging(p2mt) ) entry_content = p2m_l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt, mfn)); else @@ -622,11 +626,12 @@ pod_retry_l1: sizeof(l1e)); if ( ret == 0 ) { + unsigned long l1e_mfn = l1e_get_pfn(l1e); p2mt = p2m_flags_to_type(l1e_get_flags(l1e)); - ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt)); + ASSERT( mfn_valid(_mfn(l1e_mfn)) || !p2m_is_ram(p2mt) || + p2m_is_paging(p2mt) ); - if ( p2m_flags_to_type(l1e_get_flags(l1e)) - == p2m_populate_on_demand ) + if ( p2mt == p2m_populate_on_demand ) { /* The read has succeeded, so we know that the mapping * exits at this point. */ @@ -648,7 +653,7 @@ pod_retry_l1: } if ( p2m_is_valid(p2mt) || p2m_is_grant(p2mt) ) - mfn = _mfn(l1e_get_pfn(l1e)); + mfn = _mfn(l1e_mfn); else /* XXX see above */ p2mt = p2m_mmio_dm; @@ -670,6 +675,8 @@ p2m_gfn_to_mfn(struct p2m_domain *p2m, u paddr_t addr = ((paddr_t)gfn) << PAGE_SHIFT; l2_pgentry_t *l2e; l1_pgentry_t *l1e; + unsigned long l1e_flags; + p2m_type_t l1t; ASSERT(paging_mode_translate(p2m->domain)); @@ -788,10 +795,12 @@ pod_retry_l2: l1e = map_domain_page(mfn_x(mfn)); l1e += l1_table_offset(addr); pod_retry_l1: - if ( (l1e_get_flags(*l1e) & _PAGE_PRESENT) == 0 ) + l1e_flags = l1e_get_flags(*l1e); + l1t = p2m_flags_to_type(l1e_flags); + if ( ((l1e_flags & _PAGE_PRESENT) == 0) && (!p2m_is_paging(l1t)) ) { /* PoD: Try to populate */ - if ( p2m_flags_to_type(l1e_get_flags(*l1e)) == p2m_populate_on_demand ) + if ( l1t == p2m_populate_on_demand ) { if ( q & P2M_ALLOC ) { if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_4K, q) ) @@ -804,10 +813,10 @@ pod_retry_l1: return _mfn(INVALID_MFN); } mfn = _mfn(l1e_get_pfn(*l1e)); - *t = p2m_flags_to_type(l1e_get_flags(*l1e)); + *t = l1t; unmap_domain_page(l1e); - ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t)); + ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t) || p2m_is_paging(*t)); if ( page_order ) *page_order = PAGE_ORDER_4K; return (p2m_is_valid(*t) || p2m_is_grant(*t)) ? mfn : _mfn(INVALID_MFN); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |