summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-08 09:37:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-08 09:37:23 -0700
commit181e505952c5e4b4beb287d0022ea3cd20f23e74 (patch)
treef0b3ab951cd0681ee772bc01ce6deae3983d3d1c
parent86579aa470dee9c6038ac4adf0f8c4863a215865 (diff)
parent4ed6a540fab8ea4388c1703b73ecfed68a2009d1 (diff)
downloadlinux-181e505952c5e4b4beb287d0022ea3cd20f23e74.tar.bz2
Merge git://git.infradead.org/intel-iommu
Pull Intel IOMMU fix from David Woodhouse: "This fixes an oops when attempting to enable 1:1 passthrough mode for devices on which VT-d translation was disabled anyway. It's actually a long-standing bug but recent changes (commit 18436afdc11a: "iommu/vt-d: Allow RMRR on graphics devices too") have made it much easier to trigger with 'iommu=pt intel_iommu=igfx_off' on the command line" * git://git.infradead.org/intel-iommu: iommu/vt-d: Fix passthrough mode with translation-disabled devices
-rw-r--r--drivers/iommu/intel-iommu.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 68d43beccb7e..2ffe58969944 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -696,6 +696,11 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu
return &context[devfn];
}
+static int iommu_dummy(struct device *dev)
+{
+ return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
+}
+
static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
{
struct dmar_drhd_unit *drhd = NULL;
@@ -705,6 +710,9 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
u16 segment = 0;
int i;
+ if (iommu_dummy(dev))
+ return NULL;
+
if (dev_is_pci(dev)) {
pdev = to_pci_dev(dev);
segment = pci_domain_nr(pdev->bus);
@@ -2969,11 +2977,6 @@ static inline struct dmar_domain *get_valid_domain_for_dev(struct device *dev)
return __get_valid_domain_for_dev(dev);
}
-static int iommu_dummy(struct device *dev)
-{
- return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
-}
-
/* Check if the dev needs to go through non-identity map and unmap process.*/
static int iommu_no_mapping(struct device *dev)
{