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

[Xen-changelog] [xen-3.2-testing] Intel VTD: Ignore USB RMRR for HVM guest



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216376938 -3600
# Node ID d6a15d8605c36d483d6a2599c899b48c9478a75a
# Parent  f66bb3b806615efc4648e4ab3137d0462a4ffc65
Intel VTD: Ignore USB RMRR for HVM guest

USB controller RMRR (0xed000 - 0xeffff) conflicts with HVM guest bios
region. Setting identity mapping for it will cover the guest bios
region in p2m table. This causes system crash.

As VT-d spec says, USB controller RMRR is used in case of DMA
performed by a USB controller under BIOS SMM control for legacy
keyboard emulation. Whereas, current guest BIOS doesn't support
emulating stardand Keyboard/mouse, and it also doesn't support SMM
mode. Actually it is no chance to use USB controller RMRR now.

This patch ignores the USB controller RMRR for HVM guest.

Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
xen-unstable changeset 17248:70f9a2110421cc6f4ce066eb80d4c639a28643bd
xen-unstable date: Wed Mar 19 10:22:49 2008 +0000
---
 xen/arch/x86/hvm/vmx/vtd/dmar.h        |    2 ++
 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c |    6 ++++++
 xen/arch/x86/hvm/vmx/vtd/utils.c       |    9 +++++++++
 3 files changed, 17 insertions(+)

diff -r f66bb3b80661 -r d6a15d8605c3 xen/arch/x86/hvm/vmx/vtd/dmar.h
--- a/xen/arch/x86/hvm/vmx/vtd/dmar.h   Wed Jul 02 11:53:16 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vtd/dmar.h   Fri Jul 18 11:28:58 2008 +0100
@@ -94,6 +94,8 @@ struct acpi_ioapic_unit {
          ((long)(b) - (long)(a) < 0))
 
 int vtd_hw_check(void);
+int is_usb_device(struct pci_dev *pdev);
+
 void disable_pmr(struct iommu *iommu);
 
 #endif // _DMAR_H_
diff -r f66bb3b80661 -r d6a15d8605c3 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Wed Jul 02 11:53:16 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Fri Jul 18 11:28:58 2008 +0100
@@ -1872,6 +1872,12 @@ int assign_device(struct domain *d, u8 b
     for_each_rmrr_device( rmrr, pdev )
         if ( pdev->bus == bus && pdev->devfn == devfn )
         {
+            /* FIXME: Because USB RMRR conflicts with guest bios region,
+             * ignore USB RMRR temporarily.
+             */
+            if ( is_usb_device(pdev) )
+                return 0;
+
             ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
             if ( ret )
             {
diff -r f66bb3b80661 -r d6a15d8605c3 xen/arch/x86/hvm/vmx/vtd/utils.c
--- a/xen/arch/x86/hvm/vmx/vtd/utils.c  Wed Jul 02 11:53:16 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vtd/utils.c  Fri Jul 18 11:28:58 2008 +0100
@@ -37,6 +37,15 @@
 #define INTEL   0x8086
 #define SEABURG 0x4000
 #define C_STEP  2
+
+int is_usb_device(struct pci_dev *pdev)
+{
+    u8 bus = pdev->bus;
+    u8 dev = PCI_SLOT(pdev->devfn);
+    u8 func = PCI_FUNC(pdev->devfn);
+    u16 class = read_pci_config_16(bus, dev, func, PCI_CLASS_DEVICE);
+    return (class == 0xc03);
+}
 
 int vtd_hw_check(void)
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.