File 25756-x86-MMIO-max-mapped-pfn.patch of Package xen.openSUSE_12.1_Update
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1345123869 -3600
# Node ID 8918737c7e80fb3e5fd410c6f386cd21afa0683a
# Parent c887c30a0a35e74de786e0d240bbc51a8065a5fd
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 <xudong.hao@intel.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/hap/p2m-ept.c
+++ b/xen/arch/x86/mm/hap/p2m-ept.c
@@ -449,7 +449,7 @@ ept_set_entry(struct p2m_domain *p2m, un
}
/* 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;
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1521,7 +1521,7 @@ p2m_set_entry(struct p2m_domain *p2m, un
}
/* 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;