[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Revert "x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()"


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Mon, 7 Sep 2020 19:09:16 +0200
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Mon, 07 Sep 2020 17:09:34 +0000
  • Ironport-sdr: ki9GnZ++DcCqtApWT4hj5m+lXX1yHqfd7dKOsvy3lc3Da2qzi3qpo1toOl1jLiHeZsMVMB826h 3pgu0NQhG/sP2U3r5RjzAwhPwYu1QXVB3TPI7XqbrcdC++CQJZKtKS+Jb501X7A4NPNKKNzo76 Tf1DykezGNvGc7Zgyig5jU0RPBtoXYIJGpxYUtj7v4tnG2nVewcrLRgbcYx3RaSLRrQF9vi+y+ qSmBu1NKe9O3l+9XtZwQmiQjUYkBCs2nx0oasge6m5nss4RX12ToD4ZjBQjilhcGO+jBvKqqQP zHA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This reverts commit 81fd0d3ca4b2cd309403c6e8da662c325dd35750.

Original commit only takes into account the APIC access page being a
'special' page, but when running a PVH dom0 there are other pages that
also fulfill the 'special' page check but shouldn't have it's cache
type set to WB.

For example the ACPI regions are identity mapped into the guest but
are also Xen heap pages, and forcing those to WB cache type is wrong.

I've discovered this while trying to boot a PVH dom0, which fail to
boot with this commit applied.

Revert the commit while this is sorted out: either we settle that the
current code is correct, or we modify the way ACPI regions are mapped
into a PVH dom0.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Paul Durrant <paul@xxxxxxx>
---
 xen/arch/x86/hvm/mtrr.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index fb051d59c3..2bd64e8025 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -815,13 +815,23 @@ int epte_get_entry_emt(struct domain *d, unsigned long 
gfn, mfn_t mfn,
         return -1;
     }
 
+    if ( direct_mmio )
+    {
+        if ( (mfn_x(mfn) ^ mfn_x(d->arch.hvm.vmx.apic_access_mfn)) >> order )
+            return MTRR_TYPE_UNCACHABLE;
+        if ( order )
+            return -1;
+        *ipat = 1;
+        return MTRR_TYPE_WRBACK;
+    }
+
     if ( !mfn_valid(mfn) )
     {
         *ipat = 1;
         return MTRR_TYPE_UNCACHABLE;
     }
 
-    if ( !direct_mmio && !is_iommu_enabled(d) && !cache_flush_permitted(d) )
+    if ( !is_iommu_enabled(d) && !cache_flush_permitted(d) )
     {
         *ipat = 1;
         return MTRR_TYPE_WRBACK;
@@ -838,9 +848,6 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, 
mfn_t mfn,
         }
     }
 
-    if ( direct_mmio )
-        return MTRR_TYPE_UNCACHABLE;
-
     gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
     if ( gmtrr_mtype >= 0 )
     {
-- 
2.28.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.