x86 mm: revert check in clear_mmio_p2m_entry() changed in 21940:e7afe98afd43
authorAllen Kay allen.m.kay@intel.com <Allen Kay allen.m.kay@intel.com>
Wed, 1 Sep 2010 08:48:52 +0000 (09:48 +0100)
committerAllen Kay allen.m.kay@intel.com <Allen Kay allen.m.kay@intel.com>
Wed, 1 Sep 2010 08:48:52 +0000 (09:48 +0100)
valid_mfn() cannot be used here as MMIO pages are always above max_mem.
Also added sanity checking for type == p2m_mmio_direct before clearing
page table entry.  This should fix both VT-d and SR-IOV issues reported
recently as there are no SR-IOV specific code in Xen.  As far as Xen
is concern, SR-IOV virtual function is just another PCI device.

Signed-off-by: Allen Kay allen.m.kay@intel.com
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/arch/x86/mm/p2m.c

index 6d12ec2c2a271fca49ce596bd0503fd6da52eca7..7c0373effec5b2de5925b02af83a4bc22f675862 100644 (file)
@@ -2620,7 +2620,9 @@ clear_mmio_p2m_entry(struct p2m_domain *p2m, unsigned long gfn)
         return 0;
 
     mfn = gfn_to_mfn(p2m, gfn, &t);
-    if ( !mfn_valid(mfn) )
+
+    /* Do not use mfn_valid() here as MMIO pages are always above max_page */
+    if ( (INVALID_MFN == mfn_x(mfn)) || (t != p2m_mmio_direct) )
     {
         gdprintk(XENLOG_ERR,
             "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn);