From: Samuel Holland <samuel@sholland.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Samuel Holland <samuel@sholland.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: [PATCH 0/5] iommu/sun50i: Allwinner D1 support
Date: Wed, 27 Apr 2022 20:03:55 -0500 [thread overview]
Message-ID: <20220428010401.11323-1-samuel@sholland.org> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel@sholland.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Samuel Holland <samuel@sholland.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: [PATCH 0/5] iommu/sun50i: Allwinner D1 support
Date: Wed, 27 Apr 2022 20:03:55 -0500 [thread overview]
Message-ID: <20220428010401.11323-1-samuel@sholland.org> (raw)
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel@sholland.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Samuel Holland <samuel@sholland.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: [PATCH 0/5] iommu/sun50i: Allwinner D1 support
Date: Wed, 27 Apr 2022 20:03:55 -0500 [thread overview]
Message-ID: <20220428010401.11323-1-samuel@sholland.org> (raw)
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel@sholland.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org
Cc: devicetree@vger.kernel.org, Heiko Stuebner <heiko@sntech.de>,
Samuel Holland <samuel@sholland.org>,
linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Chen-Yu Tsai <wens@csie.org>, Rob Herring <robh+dt@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Maxime Ripard <mripard@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/5] iommu/sun50i: Allwinner D1 support
Date: Wed, 27 Apr 2022 20:03:55 -0500 [thread overview]
Message-ID: <20220428010401.11323-1-samuel@sholland.org> (raw)
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
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2022-04-28 1:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 1:03 Samuel Holland [this message]
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 ` [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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220428010401.11323-1-samuel@sholland.org \
--to=samuel@sholland.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux-foundation.org \
--cc=jernej.skrabec@gmail.com \
--cc=joro@8bytes.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=robh+dt@kernel.org \
--cc=wens@csie.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.