From 02a412de18479449c87ed7a332e3fe33d2eff3a4 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Wed, 27 Apr 2022 18:47:53 -0500 Subject: [PATCH 010/117] riscv: mm: Use IOMMU for DMA when available Signed-off-by: Samuel Holland --- arch/riscv/mm/dma-noncoherent.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/riscv/mm/dma-noncoherent.c +++ b/arch/riscv/mm/dma-noncoherent.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -70,6 +71,9 @@ void arch_setup_dma_ops(struct device *d dev_driver_string(dev), dev_name(dev)); dev->dma_coherent = coherent; + + if (iommu) + iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); } void riscv_noncoherent_supported(void)