aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-06-21 08:52:40 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-06-25 07:16:00 -0400
commitac1534a55d1e87d59a21c09c570605933b551480 (patch)
tree3aa5ff3307a98fde03f28aba24f2cb842d34cf9d /drivers/iommu
parentf2f12b6fc032c7b1419fd6db84e2868b5f05a878 (diff)
iommu/amd: Initialize dma_ops for hotplug and sriov devices
When a device is added to the system at runtime the AMD IOMMU driver initializes the necessary data structures to handle translation for it. But it forgets to change the per-device dma_ops to point to the AMD IOMMU driver. So mapping actually never happens and all DMA accesses end in an IO_PAGE_FAULT. Fix this. Reported-by: Stefan Assmann <sassmann@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a2e418cba0ff..dfe7d37c82c5 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops;
83static ATOMIC_NOTIFIER_HEAD(ppr_notifier); 83static ATOMIC_NOTIFIER_HEAD(ppr_notifier);
84int amd_iommu_max_glx_val = -1; 84int amd_iommu_max_glx_val = -1;
85 85
86static struct dma_map_ops amd_iommu_dma_ops;
87
86/* 88/*
87 * general struct to manage commands send to an IOMMU 89 * general struct to manage commands send to an IOMMU
88 */ 90 */
@@ -2267,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb,
2267 list_add_tail(&dma_domain->list, &iommu_pd_list); 2269 list_add_tail(&dma_domain->list, &iommu_pd_list);
2268 spin_unlock_irqrestore(&iommu_pd_list_lock, flags); 2270 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
2269 2271
2272 dev_data = get_dev_data(dev);
2273
2274 if (!dev_data->passthrough)
2275 dev->archdata.dma_ops = &amd_iommu_dma_ops;
2276 else
2277 dev->archdata.dma_ops = &nommu_dma_ops;
2278
2270 break; 2279 break;
2271 case BUS_NOTIFY_DEL_DEVICE: 2280 case BUS_NOTIFY_DEL_DEVICE:
2272 2281