[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/p2m: make p2m_change_type() behavior match p2m_change_entry_type_global()'s
commit e5ae6eefdfbc1816b050d02998f69f0b78d5c814 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Mar 28 13:36:19 2014 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Mar 28 13:36:19 2014 +0100 x86/p2m: make p2m_change_type() behavior match p2m_change_entry_type_global()'s - don't reset access permissions - don't shatter super pages Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/mm/p2m.c | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index ee527da..ec08e18 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -693,8 +693,7 @@ p2m_type_t p2m_change_type(struct domain *d, unsigned long gfn, return pt; } -/* Modify the p2m type of a range of gfns from ot to nt. - * Resets the access permissions. */ +/* Modify the p2m type of a range of gfns from ot to nt. */ void p2m_change_type_range(struct domain *d, unsigned long start, unsigned long end, p2m_type_t ot, p2m_type_t nt) @@ -710,11 +709,29 @@ void p2m_change_type_range(struct domain *d, p2m_lock(p2m); p2m->defer_nested_flush = 1; - for ( gfn = start; gfn < end; gfn++ ) + for ( gfn = start; gfn < end; ) { - mfn = p2m->get_entry(p2m, gfn, &pt, &a, 0, NULL); + unsigned int order; + + mfn = p2m->get_entry(p2m, gfn, &pt, &a, 0, &order); + while ( order > PAGE_ORDER_4K ) + { + if ( pt != ot ) + break; + if ( !(gfn & ((1UL << order) - 1)) && + end > (gfn | ((1UL << order) - 1)) ) + break; + if ( order == PAGE_ORDER_1G ) + order = PAGE_ORDER_2M; + else + order = PAGE_ORDER_4K; + } if ( pt == ot ) - set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, nt, p2m->default_access); + set_p2m_entry(p2m, gfn, mfn, order, nt, a); + gfn += 1UL << order; + gfn &= -1UL << order; + if ( !gfn ) + break; } p2m->defer_nested_flush = 0; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |