Skip to content

Commit

Permalink
iommu/amd: Set global dma_ops if swiotlb is disabled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joerg Roedel committed Jul 30, 2015
1 parent 3230232 commit 5271782
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5271782

Please sign in to comment.