WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Intel VTD: Ignore USB RMRR for HVM guest
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 05:41:04 -0700
Delivery-date: Thu, 20 Mar 2008 05:45:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205922169 0
# Node ID 70f9a2110421cc6f4ce066eb80d4c639a28643bd
# Parent  b8e3dbca1677e3fffeb8bf8baedc895c90d4e619
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/drivers/passthrough/vtd/dmar.h  |    1 +
 xen/drivers/passthrough/vtd/iommu.c |    6 ++++++
 xen/drivers/passthrough/vtd/utils.c |    9 +++++++++
 3 files changed, 16 insertions(+)

diff -r b8e3dbca1677 -r 70f9a2110421 xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h        Wed Mar 19 10:21:01 2008 +0000
+++ b/xen/drivers/passthrough/vtd/dmar.h        Wed Mar 19 10:22:49 2008 +0000
@@ -100,5 +100,6 @@ struct acpi_rmrr_unit * acpi_find_matche
 
 int vtd_hw_check(void);
 void disable_pmr(struct iommu *iommu);
+int is_usb_device(struct pci_dev *pdev);
 
 #endif // _DMAR_H_
diff -r b8e3dbca1677 -r 70f9a2110421 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Wed Mar 19 10:21:01 2008 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c       Wed Mar 19 10:22:49 2008 +0000
@@ -2019,6 +2019,12 @@ int intel_iommu_assign_device(struct dom
     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 b8e3dbca1677 -r 70f9a2110421 xen/drivers/passthrough/vtd/utils.c
--- a/xen/drivers/passthrough/vtd/utils.c       Wed Mar 19 10:21:01 2008 +0000
+++ b/xen/drivers/passthrough/vtd/utils.c       Wed Mar 19 10:22:49 2008 +0000
@@ -29,6 +29,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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Intel VTD: Ignore USB RMRR for HVM guest, Xen patchbot-unstable <=