[PATCH 06/13] iommu: Make use of DMA quirking and ACS enabled checkfor groups

From: Alex Williamson
Date: Fri May 11 2012 - 18:56:31 EST


Incorporate DMA quirking and ACS checking into amd_iommu and
intel-iommu. Note that IOMMU groups are not yet used for
streaming DMA, so this doesn't immediately solve the problems
with broken Ricoh devices.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
---

drivers/iommu/amd_iommu.c | 3 +++
drivers/iommu/intel-iommu.c | 3 +++
drivers/pci/pci.h | 1 +
3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index b7e5ddf..a165311 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -291,6 +291,9 @@ static int iommu_init_device(struct device *dev)
dma_pdev = pci_get_slot(pdev->bus,
PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));

+ dma_pdev = pci_dma_quirk(dma_pdev);
+ dma_pdev = pci_acs_enabled(dma_pdev);
+
group = iommu_group_get(&dma_pdev->dev);
if (!group) {
group = iommu_group_alloc();
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index e63b33b..5f526c7 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4113,6 +4113,9 @@ static int intel_iommu_add_device(struct device *dev)
dma_pdev = pci_get_slot(pdev->bus,
PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));

+ dma_pdev = pci_dma_quirk(dma_pdev);
+ dma_pdev = pci_acs_enabled(dma_pdev);
+
group = iommu_group_get(&dma_pdev->dev);
if (!group) {
group = iommu_group_alloc();
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index e494347..e8f2f8f 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -310,6 +310,7 @@ static inline resource_size_t pci_resource_alignment(struct pci_dev *dev,
}

extern void pci_enable_acs(struct pci_dev *dev);
+extern struct pci_dev *pci_acs_enabled(struct pci_dev *dev);

struct pci_dev_reset_methods {
u16 vendor;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/