From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH v2 2/5] dma-mapping: Introduce dma_iommu_detach_device() API
Date: Wed, 25 Apr 2018 12:10:48 +0200 [thread overview]
Message-ID: <20180425101051.15349-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20180425101051.15349-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
The dma_iommu_detach_device() API can be used by drivers to forcibly
detach a device from an IOMMU that architecture code might have attached
to. This is useful for drivers that need explicit control over the IOMMU
using the IOMMU API directly.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/base/dma-mapping.c | 8 ++++++++
include/linux/dma-mapping.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index d82566d6e237..18ddf32b10c9 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -366,3 +366,11 @@ void dma_deconfigure(struct device *dev)
of_dma_deconfigure(dev);
acpi_dma_deconfigure(dev);
}
+
+void dma_iommu_detach_device(struct device *dev)
+{
+#ifdef arch_iommu_detach_device
+ arch_iommu_detach_device(dev);
+#endif
+}
+EXPORT_SYMBOL(dma_iommu_detach_device);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f8ab1c0f589e..732191a2c64e 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -671,6 +671,8 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
static inline void arch_teardown_dma_ops(struct device *dev) { }
#endif
+extern void dma_iommu_detach_device(struct device *dev);
+
static inline unsigned int dma_get_max_seg_size(struct device *dev)
{
if (dev->dma_parms && dev->dma_parms->max_segment_size)
--
2.17.0
WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/5] dma-mapping: Introduce dma_iommu_detach_device() API
Date: Wed, 25 Apr 2018 12:10:48 +0200 [thread overview]
Message-ID: <20180425101051.15349-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20180425101051.15349-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
The dma_iommu_detach_device() API can be used by drivers to forcibly
detach a device from an IOMMU that architecture code might have attached
to. This is useful for drivers that need explicit control over the IOMMU
using the IOMMU API directly.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/base/dma-mapping.c | 8 ++++++++
include/linux/dma-mapping.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index d82566d6e237..18ddf32b10c9 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -366,3 +366,11 @@ void dma_deconfigure(struct device *dev)
of_dma_deconfigure(dev);
acpi_dma_deconfigure(dev);
}
+
+void dma_iommu_detach_device(struct device *dev)
+{
+#ifdef arch_iommu_detach_device
+ arch_iommu_detach_device(dev);
+#endif
+}
+EXPORT_SYMBOL(dma_iommu_detach_device);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f8ab1c0f589e..732191a2c64e 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -671,6 +671,8 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
static inline void arch_teardown_dma_ops(struct device *dev) { }
#endif
+extern void dma_iommu_detach_device(struct device *dev);
+
static inline unsigned int dma_get_max_seg_size(struct device *dev)
{
if (dev->dma_parms && dev->dma_parms->max_segment_size)
--
2.17.0
next prev parent reply other threads:[~2018-04-25 10:10 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 10:10 [PATCH v2 1/5] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping Thierry Reding
2018-04-25 10:10 ` Thierry Reding
[not found] ` <20180425101051.15349-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-25 10:10 ` Thierry Reding [this message]
2018-04-25 10:10 ` [PATCH v2 2/5] dma-mapping: Introduce dma_iommu_detach_device() API Thierry Reding
[not found] ` <20180425101051.15349-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-25 15:19 ` Christoph Hellwig
2018-04-25 15:19 ` Christoph Hellwig
[not found] ` <20180425151934.GC16075-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2018-04-26 12:11 ` Thierry Reding
2018-04-26 12:11 ` Thierry Reding
2018-04-30 11:02 ` Thierry Reding
2018-04-30 11:02 ` Thierry Reding
2018-04-30 11:41 ` Robin Murphy
2018-04-30 11:41 ` Robin Murphy
[not found] ` <e549979d-9f53-a329-da1a-ed5139958762-5wv7dgnIgG8@public.gmane.org>
2018-04-30 12:12 ` Thierry Reding
2018-04-30 12:12 ` Thierry Reding
2018-04-30 12:49 ` Robin Murphy
2018-04-30 12:49 ` Robin Murphy
2018-04-25 10:10 ` [PATCH v2 3/5] ARM: dma-mapping: Implement arch_iommu_detach_device() Thierry Reding
2018-04-25 10:10 ` Thierry Reding
[not found] ` <20180425101051.15349-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-25 15:20 ` Christoph Hellwig
2018-04-25 15:20 ` Christoph Hellwig
[not found] ` <20180425152049.GD16075-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2018-04-26 12:14 ` Thierry Reding
2018-04-26 12:14 ` Thierry Reding
2018-04-25 10:10 ` [PATCH v2 4/5] drm/nouveau: tegra: Use dma_iommu_detach_device() Thierry Reding
2018-04-25 10:10 ` Thierry Reding
2018-04-25 10:10 ` [PATCH v2 5/5] ARM: Unconditionally enable ARM_DMA_USE_IOMMU Thierry Reding
2018-04-25 10:10 ` Thierry Reding
[not found] ` <20180425101051.15349-5-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-25 10:25 ` Russell King - ARM Linux
2018-04-25 10:25 ` Russell King - ARM Linux
2018-04-25 15:17 ` Christoph Hellwig
2018-04-25 15:17 ` Christoph Hellwig
2018-04-25 15:18 ` [PATCH v2 1/5] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping Christoph Hellwig
2018-04-25 15:18 ` Christoph Hellwig
[not found] ` <20180425151815.GB16075-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2018-04-26 12:09 ` Thierry Reding
2018-04-26 12:09 ` Thierry Reding
2018-04-25 15:28 ` Jordan Crouse
2018-04-25 15:28 ` Jordan Crouse
[not found] ` <20180425152849.GA2447-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2018-04-26 12:41 ` Thierry Reding
2018-04-26 12:41 ` Thierry Reding
2018-04-26 12:59 ` Mikko Perttunen
2018-04-26 12:59 ` Mikko Perttunen
[not found] ` <fd6e0d90-7614-296b-2927-7b2745e8fbde-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2018-04-26 13:14 ` Thierry Reding
2018-04-26 13:14 ` Thierry Reding
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=20180425101051.15349-2-thierry.reding@gmail.com \
--to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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.