From: Tim Deegan Date: Thu, 16 Aug 2012 13:31:09 +0000 (+0100) Subject: x86/mm: update max_mapped_pfn on MMIO mappings too. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8048 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b6f3a3cbf014b7adb992ffa697aca568ff7a7fcb;p=xen.git x86/mm: update max_mapped_pfn on MMIO mappings too. max_mapped_pfn should reflect the highest mapping we've ever seen of any type, or the tests in the lookup functions will be wrong. As it happens, the highest mapping has always been a RAM one, but this is no longer the case when we allow 64-bit BARs. Reported-by: Xudong Hao Signed-off-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index f373905dd1..49c044e59f 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -428,7 +428,7 @@ ept_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, } /* Track the highest gfn for which we have ever had a valid mapping */ - if ( mfn_valid(mfn_x(mfn)) && + if ( p2mt != p2m_invalid && (gfn + (1UL << order) - 1 > p2m->max_mapped_pfn) ) p2m->max_mapped_pfn = gfn + (1UL << order) - 1; diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index 6193e72f10..5e7035f6a9 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -454,7 +454,7 @@ p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, } /* Track the highest gfn for which we have ever had a valid mapping */ - if ( mfn_valid(mfn) + if ( p2mt != p2m_invalid && (gfn + (1UL << page_order) - 1 > p2m->max_mapped_pfn) ) p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1;