@@ -1709,11 +1709,15 @@ void arm_iommu_detach_device(struct device *dev)
17091709}
17101710EXPORT_SYMBOL_GPL (arm_iommu_detach_device );
17111711
1712- static void arm_setup_iommu_dma_ops (struct device * dev , u64 dma_base , u64 size ,
1713- bool coherent )
1712+ static void arm_setup_iommu_dma_ops (struct device * dev )
17141713{
17151714 struct dma_iommu_mapping * mapping ;
1715+ u64 dma_base = 0 , size = 1ULL << 32 ;
17161716
1717+ if (dev -> dma_range_map ) {
1718+ dma_base = dma_range_map_min (dev -> dma_range_map );
1719+ size = dma_range_map_max (dev -> dma_range_map ) - dma_base ;
1720+ }
17171721 mapping = arm_iommu_create_mapping (dev -> bus , dma_base , size );
17181722 if (IS_ERR (mapping )) {
17191723 pr_warn ("Failed to create %llu-byte IOMMU mapping for device %s\n" ,
@@ -1744,17 +1748,15 @@ static void arm_teardown_iommu_dma_ops(struct device *dev)
17441748
17451749#else
17461750
1747- static void arm_setup_iommu_dma_ops (struct device * dev , u64 dma_base , u64 size ,
1748- bool coherent )
1751+ static void arm_setup_iommu_dma_ops (struct device * dev )
17491752{
17501753}
17511754
17521755static void arm_teardown_iommu_dma_ops (struct device * dev ) { }
17531756
17541757#endif /* CONFIG_ARM_DMA_USE_IOMMU */
17551758
1756- void arch_setup_dma_ops (struct device * dev , u64 dma_base , u64 size ,
1757- bool coherent )
1759+ void arch_setup_dma_ops (struct device * dev , bool coherent )
17581760{
17591761 /*
17601762 * Due to legacy code that sets the ->dma_coherent flag from a bus
@@ -1774,7 +1776,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
17741776 return ;
17751777
17761778 if (device_iommu_mapped (dev ))
1777- arm_setup_iommu_dma_ops (dev , dma_base , size , coherent );
1779+ arm_setup_iommu_dma_ops (dev );
17781780
17791781 xen_setup_dma_ops (dev );
17801782 dev -> archdata .dma_ops_setup = true;
0 commit comments