0010-riscv-mm-Use-IOMMU-for-DMA-when-available.patch 850 B

123456789101112131415161718192021222324252627282930
  1. From 02a412de18479449c87ed7a332e3fe33d2eff3a4 Mon Sep 17 00:00:00 2001
  2. From: Samuel Holland <[email protected]>
  3. Date: Wed, 27 Apr 2022 18:47:53 -0500
  4. Subject: [PATCH 010/117] riscv: mm: Use IOMMU for DMA when available
  5. Signed-off-by: Samuel Holland <[email protected]>
  6. ---
  7. arch/riscv/mm/dma-noncoherent.c | 4 ++++
  8. 1 file changed, 4 insertions(+)
  9. --- a/arch/riscv/mm/dma-noncoherent.c
  10. +++ b/arch/riscv/mm/dma-noncoherent.c
  11. @@ -7,6 +7,7 @@
  12. #include <linux/dma-direct.h>
  13. #include <linux/dma-map-ops.h>
  14. +#include <linux/iommu.h>
  15. #include <linux/mm.h>
  16. #include <asm/cacheflush.h>
  17. @@ -70,6 +71,9 @@ void arch_setup_dma_ops(struct device *d
  18. dev_driver_string(dev), dev_name(dev));
  19. dev->dma_coherent = coherent;
  20. +
  21. + if (iommu)
  22. + iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1);
  23. }
  24. void riscv_noncoherent_supported(void)