Commit 4720287c authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Joerg Roedel
Browse files

iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()



This is not being used to pass ops, it is just a way to tell if an
iommu driver was probed. These days this can be detected directly via
device_iommu_mapped(). Call device_iommu_mapped() in the two places that
need to check it and remove the iommu parameter everywhere.

Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: default avatarMoritz Fischer <mdf@kernel.org>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarRob Herring <robh@kernel.org>
Tested-by: default avatarHector Martin <marcan@marcan.st>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/1-v2-16e4def25ebb+820-iommu_fwspec_p1_jgg@nvidia.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 7be42333
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
 * Plug in direct dma map ops.
 */
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
			bool coherent)
{
	/*
	 * IOC hardware snoops all DMA traffic keeping the caches consistent
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
}

void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
			bool coherent)
{
	if (IS_ENABLED(CONFIG_CPU_V7M)) {
		/*
+5 −5
Original line number Diff line number Diff line
@@ -1713,7 +1713,7 @@ void arm_iommu_detach_device(struct device *dev)
EXPORT_SYMBOL_GPL(arm_iommu_detach_device);

static void arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
				    const struct iommu_ops *iommu, bool coherent)
				    bool coherent)
{
	struct dma_iommu_mapping *mapping;

@@ -1748,7 +1748,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev)
#else

static void arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
				    const struct iommu_ops *iommu, bool coherent)
				    bool coherent)
{
}

@@ -1757,7 +1757,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }
#endif	/* CONFIG_ARM_DMA_USE_IOMMU */

void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
			bool coherent)
{
	/*
	 * Due to legacy code that sets the ->dma_coherent flag from a bus
@@ -1776,8 +1776,8 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
	if (dev->dma_ops)
		return;

	if (iommu)
		arm_setup_iommu_dma_ops(dev, dma_base, size, iommu, coherent);
	if (device_iommu_mapped(dev))
		arm_setup_iommu_dma_ops(dev, dma_base, size, coherent);

	xen_setup_dma_ops(dev);
	dev->archdata.dma_ops_setup = true;
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ void arch_teardown_dma_ops(struct device *dev)
#endif

void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
			bool coherent)
{
	int cls = cache_line_size_of_cpu();

@@ -58,7 +58,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
		   ARCH_DMA_MINALIGN, cls);

	dev->dma_coherent = coherent;
	if (iommu)
	if (device_iommu_mapped(dev))
		iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1);

	xen_setup_dma_ops(dev);
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,

#ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
		const struct iommu_ops *iommu, bool coherent)
		bool coherent)
{
	dev->dma_coherent = coherent;
}
Loading