Skip to content

Commit 9e8354b

Browse files
jgunthorpeRussell King (Oracle)
authored andcommitted
ARM: 9417/1: dma-mapping: Pass device to arm_iommu_create_mapping()
All users of ARM IOMMU mappings create them for a particular device, so change the interface to accept the device rather than forcing a vague indirection through a bus type. This prepares for making a similar change to iommu_domain_alloc() itself. Signed-off-by: Robin Murphy <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Acked-by: Jeff Johnson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent f7f8b43 commit 9e8354b

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

arch/arm/include/asm/dma-iommu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct dma_iommu_mapping {
2424
};
2525

2626
struct dma_iommu_mapping *
27-
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size);
27+
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size);
2828

2929
void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
3030

arch/arm/mm/dma-mapping.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ static const struct dma_map_ops iommu_ops = {
15321532

15331533
/**
15341534
* arm_iommu_create_mapping
1535-
* @bus: pointer to the bus holding the client device (for IOMMU calls)
1535+
* @dev: pointer to the client device (for IOMMU calls)
15361536
* @base: start address of the valid IO address space
15371537
* @size: maximum size of the valid IO address space
15381538
*
@@ -1544,7 +1544,7 @@ static const struct dma_map_ops iommu_ops = {
15441544
* arm_iommu_attach_device function.
15451545
*/
15461546
struct dma_iommu_mapping *
1547-
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
1547+
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size)
15481548
{
15491549
unsigned int bits = size >> PAGE_SHIFT;
15501550
unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long);
@@ -1585,7 +1585,7 @@ arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
15851585

15861586
spin_lock_init(&mapping->lock);
15871587

1588-
mapping->domain = iommu_domain_alloc(bus);
1588+
mapping->domain = iommu_domain_alloc(dev->bus);
15891589
if (!mapping->domain)
15901590
goto err4;
15911591

@@ -1718,7 +1718,7 @@ static void arm_setup_iommu_dma_ops(struct device *dev)
17181718
dma_base = dma_range_map_min(dev->dma_range_map);
17191719
size = dma_range_map_max(dev->dma_range_map) - dma_base;
17201720
}
1721-
mapping = arm_iommu_create_mapping(dev->bus, dma_base, size);
1721+
mapping = arm_iommu_create_mapping(dev, dma_base, size);
17221722
if (IS_ERR(mapping)) {
17231723
pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n",
17241724
size, dev_name(dev));

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
110110
void *mapping = NULL;
111111

112112
if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
113-
mapping = arm_iommu_create_mapping(&platform_bus_type,
113+
mapping = arm_iommu_create_mapping(dev,
114114
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
115115
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
116116
mapping = iommu_get_domain_for_dev(priv->dma_dev);

drivers/iommu/ipmmu-vmsa.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,7 @@ static int ipmmu_init_arm_mapping(struct device *dev)
804804
if (!mmu->mapping) {
805805
struct dma_iommu_mapping *mapping;
806806

807-
mapping = arm_iommu_create_mapping(&platform_bus_type,
808-
SZ_1G, SZ_2G);
807+
mapping = arm_iommu_create_mapping(dev, SZ_1G, SZ_2G);
809808
if (IS_ERR(mapping)) {
810809
dev_err(mmu->dev, "failed to create ARM IOMMU mapping\n");
811810
ret = PTR_ERR(mapping);

drivers/iommu/mtk_iommu_v1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ static int mtk_iommu_v1_create_mapping(struct device *dev,
433433
mtk_mapping = data->mapping;
434434
if (!mtk_mapping) {
435435
/* MTK iommu support 4GB iova address space. */
436-
mtk_mapping = arm_iommu_create_mapping(&platform_bus_type,
437-
0, 1ULL << 32);
436+
mtk_mapping = arm_iommu_create_mapping(dev, 0, 1ULL << 32);
438437
if (IS_ERR(mtk_mapping))
439438
return PTR_ERR(mtk_mapping);
440439

drivers/media/platform/ti/omap3isp/isp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,7 @@ static int isp_attach_iommu(struct isp_device *isp)
19651965
* Create the ARM mapping, used by the ARM DMA mapping core to allocate
19661966
* VAs. This will allocate a corresponding IOMMU domain.
19671967
*/
1968-
mapping = arm_iommu_create_mapping(&platform_bus_type, SZ_1G, SZ_2G);
1968+
mapping = arm_iommu_create_mapping(isp->dev, SZ_1G, SZ_2G);
19691969
if (IS_ERR(mapping)) {
19701970
dev_err(isp->dev, "failed to create ARM IOMMU mapping\n");
19711971
return PTR_ERR(mapping);

0 commit comments

Comments
 (0)