debuggers.hg
changeset 17286:70f9a2110421
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>
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>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Mar 19 10:22:49 2008 +0000 (2008-03-19) |
parents | b8e3dbca1677 |
children | 26a7a2d154e1 |
files | xen/drivers/passthrough/vtd/dmar.h xen/drivers/passthrough/vtd/iommu.c xen/drivers/passthrough/vtd/utils.c |
line diff
1.1 --- a/xen/drivers/passthrough/vtd/dmar.h Wed Mar 19 10:21:01 2008 +0000 1.2 +++ b/xen/drivers/passthrough/vtd/dmar.h Wed Mar 19 10:22:49 2008 +0000 1.3 @@ -100,5 +100,6 @@ struct acpi_rmrr_unit * acpi_find_matche 1.4 1.5 int vtd_hw_check(void); 1.6 void disable_pmr(struct iommu *iommu); 1.7 +int is_usb_device(struct pci_dev *pdev); 1.8 1.9 #endif // _DMAR_H_
2.1 --- a/xen/drivers/passthrough/vtd/iommu.c Wed Mar 19 10:21:01 2008 +0000 2.2 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed Mar 19 10:22:49 2008 +0000 2.3 @@ -2019,6 +2019,12 @@ int intel_iommu_assign_device(struct dom 2.4 for_each_rmrr_device( rmrr, pdev ) 2.5 if ( pdev->bus == bus && pdev->devfn == devfn ) 2.6 { 2.7 + /* FIXME: Because USB RMRR conflicts with guest bios region, 2.8 + * ignore USB RMRR temporarily. 2.9 + */ 2.10 + if ( is_usb_device(pdev) ) 2.11 + return 0; 2.12 + 2.13 ret = iommu_prepare_rmrr_dev(d, rmrr, pdev); 2.14 if ( ret ) 2.15 {
3.1 --- a/xen/drivers/passthrough/vtd/utils.c Wed Mar 19 10:21:01 2008 +0000 3.2 +++ b/xen/drivers/passthrough/vtd/utils.c Wed Mar 19 10:22:49 2008 +0000 3.3 @@ -30,6 +30,15 @@ 3.4 #define SEABURG 0x4000 3.5 #define C_STEP 2 3.6 3.7 +int is_usb_device(struct pci_dev *pdev) 3.8 +{ 3.9 + u8 bus = pdev->bus; 3.10 + u8 dev = PCI_SLOT(pdev->devfn); 3.11 + u8 func = PCI_FUNC(pdev->devfn); 3.12 + u16 class = read_pci_config_16(bus, dev, func, PCI_CLASS_DEVICE); 3.13 + return (class == 0xc03); 3.14 +} 3.15 + 3.16 int vtd_hw_check(void) 3.17 { 3.18 u16 vendor, device;