summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-07-28 16:58:51 +0200
committerJoerg Roedel <jroedel@suse.de>2015-07-30 10:28:48 +0200
commit52717828356b643a1650fca845b4af488a954cca (patch)
tree2d5a6e86acf90f547f0c309ff5aa0241b0ed5025 /drivers/iommu/amd_iommu.c
parentiommu/amd: Use swiotlb in passthrough mode (diff)
downloadlinux-52717828356b643a1650fca845b4af488a954cca.tar.xz
linux-52717828356b643a1650fca845b4af488a954cca.zip
iommu/amd: Set global dma_ops if swiotlb is disabled
Some AMD systems also have non-PCI devices which can do DMA. Those can't be handled by the AMD IOMMU, as the hardware can only handle PCI. These devices would end up with no dma_ops, as neither the per-device nor the global dma_ops will get set. SWIOTLB provides global dma_ops when it is active, so make sure there are global dma_ops too when swiotlb is disabled. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-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 e29baa6c64e3..fa9508bb76dd 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2853,6 +2853,15 @@ int __init amd_iommu_init_dma_ops(void)
swiotlb = iommu_pass_through ? 1 : 0;
iommu_detected = 1;
+ /*
+ * In case we don't initialize SWIOTLB (actually the common case
+ * when AMD IOMMU is enabled), make sure there are global
+ * dma_ops set as a fall-back for devices not handled by this
+ * driver (for example non-PCI devices).
+ */
+ if (!swiotlb)
+ dma_ops = &nommu_dma_ops;
+
amd_iommu_stats_init();
if (amd_iommu_unmap_flush)