[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <93d7de3533cfd952aecd6198b9221d7a58c0e521.1597931876.git.robin.murphy@arm.com>
Date: Thu, 20 Aug 2020 16:08:29 +0100
From: Robin Murphy <robin.murphy@....com>
To: hch@....de, joro@...tes.org, linux@...linux.org.uk
Cc: will@...nel.org, inki.dae@...sung.com, sw0312.kim@...sung.com,
kyungmin.park@...sung.com, m.szyprowski@...sung.com,
agross@...nel.org, bjorn.andersson@...aro.org,
thierry.reding@...il.com, jonathanh@...dia.com, vdumpa@...dia.com,
digetx@...il.com, matthias.bgg@...il.com, yong.wu@...iatek.com,
geert+renesas@...der.be, magnus.damm@...il.com, t-kristo@...com,
s-anna@...com, laurent.pinchart@...asonboard.com,
linux-arm-kernel@...ts.infradead.org,
iommu@...ts.linux-foundation.org,
linux-samsung-soc@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-mediatek@...ts.infradead.org,
dri-devel@...ts.freedesktop.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 10/18] iommu/msm: Add IOMMU_DOMAIN_DMA support
Now that arch/arm is wired up for default domains and iommu-dma,
implement the corresponding driver-side support for DMA domains.
Signed-off-by: Robin Murphy <robin.murphy@....com>
---
drivers/iommu/msm_iommu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 3615cd6241c4..f34efcbb0b2b 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
+#include <linux/dma-iommu.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/io-pgtable.h>
@@ -314,13 +315,16 @@ static struct iommu_domain *msm_iommu_domain_alloc(unsigned type)
{
struct msm_priv *priv;
- if (type != IOMMU_DOMAIN_UNMANAGED)
+ if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA)
return NULL;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
goto fail_nomem;
+ if (type == IOMMU_DOMAIN_DMA && iommu_get_dma_cookie(&priv->domain))
+ goto fail_nomem;
+
INIT_LIST_HEAD(&priv->list_attached);
priv->domain.geometry.aperture_start = 0;
@@ -339,6 +343,7 @@ static void msm_iommu_domain_free(struct iommu_domain *domain)
struct msm_priv *priv;
unsigned long flags;
+ iommu_put_dma_cookie(domain);
spin_lock_irqsave(&msm_iommu_lock, flags);
priv = to_msm_priv(domain);
kfree(priv);
--
2.28.0.dirty
Powered by blists - more mailing lists