Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57a8a9ea authored by Patrick Daly's avatar Patrick Daly
Browse files

arm: dma-mapping: Use iommu_dma ops for arm32



Reuse the same code paths as arm64.

Change-Id: I41d89b53b77abd14d6e2ae94e31145b2c7fb37c2
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent c4c1c2cd
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/dma-direct.h>
#include <linux/dma-mapping.h>
#include <linux/dma-noncoherent.h>
#include <linux/dma-iommu.h>
#include <linux/dma-contiguous.h>
#include <linux/highmem.h>
#include <linux/memblock.h>
@@ -2489,7 +2490,8 @@ static void arm_iommu_get_dma_window(struct device *dev, u64 *dma_addr,
	*dma_size = of_read_number(ranges + naddr, nsize);
}

static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
static bool __maybe_unused
arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu)
{
	struct iommu_group *group;
@@ -2550,7 +2552,8 @@ static void arm_teardown_iommu_dma_ops(struct device *dev)
}
#else

static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
static bool __maybe_unused
arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu)
{
	return false;
@@ -2566,10 +2569,9 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
{
	const struct dma_map_ops *dma_ops;
	struct dma_iommu_mapping *mapping;

	dev->archdata.dma_coherent = coherent;
#ifdef CONFIG_SWIOTLB
#if defined(CONFIG_SWIOTLB) || defined(CONFIG_IOMMU_DMA)
	dev->dma_coherent = coherent;
#endif

@@ -2581,14 +2583,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
	if (dev->dma_ops)
		return;

	if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) {
		mapping = to_dma_iommu_mapping(dev);
		dma_ops = mapping->ops;
	} else {
		dma_ops = arm_get_dma_map_ops(coherent);
	}
	if (iommu)
		iommu_setup_dma_ops(dev, dma_base, size);

	if (!dev->dma_ops) {
		dma_ops = arm_get_dma_map_ops(coherent);
		set_dma_ops(dev, dma_ops);
	}

#ifdef CONFIG_XEN
	if (xen_initial_domain())
+0 −1
Original line number Diff line number Diff line
@@ -469,7 +469,6 @@ config ARM_SMMU
	depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
	select IOMMU_API
	select IOMMU_IO_PGTABLE_LPAE
	select ARM_DMA_USE_IOMMU if ARM
	help
	  Support for implementations of the ARM System MMU architecture
	  versions 1 and 2.