x86/mm: update max_mapped_pfn on MMIO mappings too.
authorTim Deegan <tim@xen.org>
Thu, 16 Aug 2012 13:31:09 +0000 (14:31 +0100)
committerTim Deegan <tim@xen.org>
Thu, 16 Aug 2012 13:31:09 +0000 (14:31 +0100)
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>
xen/arch/x86/mm/p2m-ept.c
xen/arch/x86/mm/p2m-pt.c

index f373905dd19a7f3a9698c4e24e4e85476b2626af..49c044e59f334c65d10c2fe6650d28d83225c551 100644 (file)
@@ -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;
 
index 6193e72f10eea9339ba562d3a0fbca9fa719a725..5e7035f6a93f660039af05c115b3ff213fa69010 100644 (file)
@@ -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;