70 lines
2.5 KiB
Diff
70 lines
2.5 KiB
Diff
# HG changeset patch
|
|
# User Keir Fraser <keir.fraser@citrix.com>
|
|
# 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@intel.com>
|
|
|
|
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/dmar.h
|
|
===================================================================
|
|
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/dmar.h
|
|
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/dmar.h
|
|
@@ -95,5 +95,6 @@ struct acpi_ioapic_unit {
|
|
|
|
int vtd_hw_check(void);
|
|
void disable_pmr(struct iommu *iommu);
|
|
+int is_usb_device(struct pci_dev *pdev);
|
|
|
|
#endif // _DMAR_H_
|
|
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
|
|
===================================================================
|
|
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
|
|
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
|
|
@@ -1868,6 +1868,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 )
|
|
{
|
|
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/utils.c
|
|
===================================================================
|
|
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/utils.c
|
|
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/utils.c
|
|
@@ -38,6 +38,15 @@
|
|
#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)
|
|
{
|
|
u16 vendor, device;
|