aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2015-03-25 11:05:47 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2015-03-25 11:36:35 -0400
commit18436afdc11a00ac881990b454cfb2eae81d6003 (patch)
tree171c8f87e0be35d3de46a563b8686793e39ab3cf
parent68c1b89cf5653acd1107253e146b332420a1f4a7 (diff)
iommu/vt-d: Allow RMRR on graphics devices too
Commit c875d2c1 ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains") prevents certain options for devices with RMRRs. This even prevents those devices from getting a 1:1 mapping with 'iommu=pt', because we don't have the code to handle *preserving* the RMRR regions when moving the device between domains. There's already an exclusion for USB devices, because we know the only reason for RMRRs there is a misguided desire to keep legacy keyboard/mouse emulation running in some theoretical OS which doesn't have support for USB in its own right... but which *does* enable the IOMMU. Add an exclusion for graphics devices too, so that 'iommu=pt' works there. We should be able to successfully assign graphics devices to guests too, as long as the initial handling of stolen memory is reconfigured appropriately. This has certainly worked in the past. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Cc: stable@vger.kernel.org
-rw-r--r--drivers/iommu/intel-iommu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 40dfbc0444c0..e3276ee60340 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -50,6 +50,7 @@
50#define CONTEXT_SIZE VTD_PAGE_SIZE 50#define CONTEXT_SIZE VTD_PAGE_SIZE
51 51
52#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) 52#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
53#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
53#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) 54#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
54#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) 55#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
55 56
@@ -2561,6 +2562,10 @@ static bool device_has_rmrr(struct device *dev)
2561 * In both cases we assume that PCI USB devices with RMRRs have them largely 2562 * In both cases we assume that PCI USB devices with RMRRs have them largely
2562 * for historical reasons and that the RMRR space is not actively used post 2563 * for historical reasons and that the RMRR space is not actively used post
2563 * boot. This exclusion may change if vendors begin to abuse it. 2564 * boot. This exclusion may change if vendors begin to abuse it.
2565 *
2566 * The same exception is made for graphics devices, with the requirement that
2567 * any use of the RMRR regions will be torn down before assigning the device
2568 * to a guest.
2564 */ 2569 */
2565static bool device_is_rmrr_locked(struct device *dev) 2570static bool device_is_rmrr_locked(struct device *dev)
2566{ 2571{
@@ -2570,7 +2575,7 @@ static bool device_is_rmrr_locked(struct device *dev)
2570 if (dev_is_pci(dev)) { 2575 if (dev_is_pci(dev)) {
2571 struct pci_dev *pdev = to_pci_dev(dev); 2576 struct pci_dev *pdev = to_pci_dev(dev);
2572 2577
2573 if ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB) 2578 if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev))
2574 return false; 2579 return false;
2575 } 2580 }
2576 2581