aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 44d47ac552a9..05c101e7dcd7 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1026,9 +1026,12 @@ static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
1026 const void *dma_window = NULL; 1026 const void *dma_window = NULL;
1027 u64 dma_offset; 1027 u64 dma_offset;
1028 1028
1029 if (!dev->dma_mask || !dma_supported(dev, dma_mask)) 1029 if (!dev->dma_mask)
1030 return -EIO; 1030 return -EIO;
1031 1031
1032 if (!dev_is_pci(dev))
1033 goto check_mask;
1034
1032 pdev = to_pci_dev(dev); 1035 pdev = to_pci_dev(dev);
1033 1036
1034 /* only attempt to use a new window if 64-bit DMA is requested */ 1037 /* only attempt to use a new window if 64-bit DMA is requested */
@@ -1059,13 +1062,17 @@ static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
1059 } 1062 }
1060 } 1063 }
1061 1064
1062 /* fall-through to iommu ops */ 1065 /* fall back on iommu ops, restore table pointer with ops */
1063 if (!ddw_enabled) { 1066 if (!ddw_enabled && get_dma_ops(dev) != &dma_iommu_ops) {
1064 dev_info(dev, "Using 32-bit DMA via iommu\n"); 1067 dev_info(dev, "Restoring 32-bit DMA via iommu\n");
1065 set_dma_ops(dev, &dma_iommu_ops); 1068 set_dma_ops(dev, &dma_iommu_ops);
1066 pci_dma_dev_setup_pSeriesLP(pdev); 1069 pci_dma_dev_setup_pSeriesLP(pdev);
1067 } 1070 }
1068 1071
1072check_mask:
1073 if (!dma_supported(dev, dma_mask))
1074 return -EIO;
1075
1069 *dev->dma_mask = dma_mask; 1076 *dev->dma_mask = dma_mask;
1070 return 0; 1077 return 0;
1071} 1078}