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

[Xen-changelog] [xen stable-4.3] AMD/guest_iommu: properly disable guest iommu support



commit 9eb86d9513429e1a5bc30f6df77a1648bb67d73a
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Oct 17 16:06:03 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Oct 17 16:06:03 2014 +0200

    AMD/guest_iommu: properly disable guest iommu support
    
    AMD Guest IOMMU support was added to allow correct use of PASID and PRI
    hardware support with an ATS-aware guest driver.
    
    However, support cannot possibly function as guest_iommu_set_base() has no
    callers.  This means that its MMIO region's P2M pages are not set to
    p2m_mmio_dm, preventing any invocation of the MMIO read/write handlers.
    
    c/s fd186384 "x86/HVM: extend LAPIC shortcuts around P2M lookups" 
introduces a
    path (via hvm_mmio_internal()) where iommu_mmio_handler claims its MMIO 
range,
    and causes __hvm_copy() to fail with HVMCOPY_bad_gfn_to_mfn.
    
    iommu->mmio_base defaults to 0, with a range of 8 pages, and is unilaterally
    enabled in any HVM guests when the host IOMMU(s) supports any extended
    features.
    
    Unfortunately, HVMLoader's AP boot trampoline executes an `lmsw` instruction
    at linear address 0x100c which unconditionally requires emulation.  The
    instruction fetch in turn fails as __hvm_copy() fails with
    HVMCOPY_bad_gfn_to_mfn.
    
    The result is that multi-vcpu HVM guests do not work on newer AMD hardware, 
if
    IOMMU support is enabled in the BIOS.
    
    Change the default mmio_base address to ~0ULL.  This prevents
    guest_iommu_mmio_range() from actually claiming any physical range
    whatsoever, which allows the emulation of `lmsw` to succeed.
    
    Reported-by: Roberto Luongo <rluongo@xxxxxxxx>
    Suggested-by: Jan Beulich <JBeulich@xxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Tested-by: Roberto Luongo <rluongo@xxxxxxxx>
    Acked-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@xxxxxxx>
    master commit: 02e4c89b2cc3c1f19ef42ed4fcb1931d8d704bb5
    master date: 2014-10-06 11:20:12 +0200
---
 xen/drivers/passthrough/amd/iommu_guest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c 
b/xen/drivers/passthrough/amd/iommu_guest.c
index 477de20..b675a4b 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -885,6 +885,7 @@ int guest_iommu_init(struct domain* d)
     }
 
     guest_iommu_reg_init(iommu);
+    iommu->mmio_base = ~0ULL;
     iommu->domain = d;
     hd->g_iommu = iommu;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.3

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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