All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] iommu/sun50i: Allwinner D1 support
@ 2022-04-28  1:03 ` Samuel Holland
  0 siblings, 0 replies; 56+ messages in thread
From: Samuel Holland @ 2022-04-28  1:03 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, iommu
  Cc: Heiko Stuebner, Palmer Dabbelt, linux-riscv, Samuel Holland,
	Chen-Yu Tsai, Jernej Skrabec, Krzysztof Kozlowski, Maxime Ripard,
	Philipp Zabel, Rob Herring, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi

D1 is a RISC-V SoC from Allwinner's sunxi family. This series adds IOMMU
binding and driver support.

One piece is still missing to use the IOMMU for DMA allocations: a call
to iommu_setup_dma_ops(). On ARM64 this is handled by the architecture's
code. RISC-V does not currently select ARCH_HAS_SETUP_DMA_OPS, but it
will once Zicbom support[1] is merged.

[1]: https://lore.kernel.org/lkml/20220307224620.1933061-2-heiko@sntech.de/

So I cannot follow virtio-iommu.c and call iommu_setup_dma_ops() when
ARCH_HAS_SETUP_DMA_OPS=n. However, if I apply the following patch on top
of Heiko's non-coherent DMA series, the display engine successfully uses
the IOMMU to allocate its framebuffer:

--- a/arch/riscv/mm/dma-noncoherent.c
+++ b/arch/riscv/mm/dma-noncoherent.c
@@ -6,6 +6,7 @@
  */

 #include <linux/dma-direct.h>
+#include <linux/dma-iommu.h>
 #include <linux/dma-map-ops.h>
 #include <linux/mm.h>

@@ -53,4 +54,7 @@
 {
 	/* If a specific device is dma-coherent, set it here */
 	dev->dma_coherent = coherent;
+
+	if (iommu)
+		iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1);
 }


Samuel Holland (5):
  dt-bindings: iommu: sun50i: Add compatible for Allwinner D1
  iommu/sun50i: Support variants without an external reset
  iommu/sun50i: Ensure bypass is disabled
  iommu/sun50i: Add support for the D1 variant
  iommu/sun50i: Ensure the IOMMU can be used for DMA

 .../iommu/allwinner,sun50i-h6-iommu.yaml      | 16 +++++++++++--
 drivers/iommu/Kconfig                         |  1 +
 drivers/iommu/sun50i-iommu.c                  | 24 +++++++++++++++++--
 3 files changed, 37 insertions(+), 4 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2022-04-28 11:14 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  1:03 [PATCH 0/5] iommu/sun50i: Allwinner D1 support Samuel Holland
2022-04-28  1:03 ` Samuel Holland
2022-04-28  1:03 ` Samuel Holland
2022-04-28  1:03 ` Samuel Holland
2022-04-28  1:03 ` [PATCH 1/5] dt-bindings: iommu: sun50i: Add compatible for Allwinner D1 Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  7:19   ` Krzysztof Kozlowski
2022-04-28  7:19     ` Krzysztof Kozlowski
2022-04-28  7:19     ` Krzysztof Kozlowski
2022-04-28  7:19     ` Krzysztof Kozlowski
2022-04-28  1:03 ` [PATCH 2/5] iommu/sun50i: Support variants without an external reset Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  5:34   ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  7:43   ` Philipp Zabel
2022-04-28  7:43     ` Philipp Zabel
2022-04-28  7:43     ` Philipp Zabel
2022-04-28  7:43     ` Philipp Zabel
2022-04-28  1:03 ` [PATCH 3/5] iommu/sun50i: Ensure bypass is disabled Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  5:43   ` Jernej Škrabec
2022-04-28  5:43     ` Jernej Škrabec
2022-04-28  5:43     ` Jernej Škrabec
2022-04-28  5:43     ` Jernej Škrabec
2022-04-28  1:03 ` [PATCH 4/5] iommu/sun50i: Add support for the D1 variant Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  1:03   ` Samuel Holland
2022-04-28  5:34   ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  5:34     ` Jernej Škrabec
2022-04-28  1:04 ` [PATCH 5/5] iommu/sun50i: Ensure the IOMMU can be used for DMA Samuel Holland
2022-04-28  1:04   ` Samuel Holland
2022-04-28  1:04   ` Samuel Holland
2022-04-28  1:04   ` Samuel Holland
2022-04-28  5:35   ` Jernej Škrabec
2022-04-28  5:35     ` Jernej Škrabec
2022-04-28  5:35     ` Jernej Škrabec
2022-04-28  5:35     ` Jernej Škrabec
2022-04-28 11:12   ` Robin Murphy
2022-04-28 11:12     ` Robin Murphy
2022-04-28 11:12     ` Robin Murphy
2022-04-28 11:12     ` Robin Murphy
2022-04-28  5:45 ` [PATCH 0/5] iommu/sun50i: Allwinner D1 support Jernej Škrabec
2022-04-28  5:45   ` Jernej Škrabec
2022-04-28  5:45   ` Jernej Škrabec
2022-04-28  5:45   ` Jernej Škrabec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.