From: Krishna Reddy <vdumpa@nvidia.com>
To: Ashish Mhetre <amhetre@nvidia.com>,
Thierry Reding <treding@nvidia.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Stephen Warren <swarren@nvidia.com>,
Sachin Nikam <Snikam@nvidia.com>
Cc: SW-Mobile-Linux-Upstreaming
<SW-Mobile-Linux-Upstreaming@exchange.nvidia.com>,
SW-Mobile-Memory-Core <SW-Mobile-Memory-Core@exchange.nvidia.com>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: RE: [PATCH] iommu/dma: Add support for mapping memory as device memory
Date: Tue, 4 Aug 2020 16:47:52 +0000 [thread overview]
Message-ID: <BYAPR12MB2822CC35CFA8F6B15E7514E8B34A0@BYAPR12MB2822.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1596527558-22566-1-git-send-email-amhetre@nvidia.com>
Can you explain why it is necessary? Can you also include a client driver patches that uses this new attribute?
Including the patches that uses this attribute would make it easy to upstream.
-KR
-----Original Message-----
From: Ashish Mhetre <amhetre@nvidia.com>
Sent: Tuesday, August 4, 2020 12:53 AM
To: Krishna Reddy <vdumpa@nvidia.com>; Thierry Reding <treding@nvidia.com>; Jonathan Hunter <jonathanh@nvidia.com>; Stephen Warren <swarren@nvidia.com>; Sachin Nikam <Snikam@nvidia.com>
Cc: SW-Mobile-Linux-Upstreaming <SW-Mobile-Linux-Upstreaming@exchange.nvidia.com>; SW-Mobile-Memory-Core <SW-Mobile-Memory-Core@exchange.nvidia.com>; linux-tegra@vger.kernel.org; Ashish Mhetre <amhetre@nvidia.com>
Subject: [PATCH] iommu/dma: Add support for mapping memory as device memory
Add DMA_ATTRS_DEVICE_MAP attribute to support mapping memory as device memory.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/iommu/dma-iommu.c | 3 +++
include/linux/dma-mapping.h | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 65ac889..0e411ef 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -388,6 +388,9 @@ static int dma_info_to_prot(enum dma_data_direction dir, bool coherent,
if (attrs & DMA_ATTR_PRIVILEGED)
prot |= IOMMU_PRIV;
+ if (attrs & DMA_ATTR_DEVICE_MAP)
+ prot |= IOMMU_MMIO;
+
switch (dir) {
case DMA_BIDIRECTIONAL:
return prot | IOMMU_READ | IOMMU_WRITE; diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 330ad58..b0cb1b3 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -68,6 +68,12 @@
#define DMA_ATTR_PRIVILEGED (1UL << 9)
/*
+ * DMA_ATTR_DEVICE_MAP: This specifies DMA-mapping subsystem to map
+memory
+ * as device memory.
+ */
+#define DMA_ATTR_DEVICE_MAP (1UL << 10)
+
+/*
* A dma_addr_t can hold any valid DMA or bus address for the platform.
* It can be given to a device to use as a DMA source or target. A CPU cannot
* reference a dma_addr_t directly because there may be translation between
--
2.7.4
prev parent reply other threads:[~2020-08-04 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-04 7:52 [PATCH] iommu/dma: Add support for mapping memory as device memory Ashish Mhetre
2020-08-04 8:56 ` Mikko Perttunen
2020-08-04 16:47 ` Krishna Reddy [this message]
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=BYAPR12MB2822CC35CFA8F6B15E7514E8B34A0@BYAPR12MB2822.namprd12.prod.outlook.com \
--to=vdumpa@nvidia.com \
--cc=SW-Mobile-Linux-Upstreaming@exchange.nvidia.com \
--cc=SW-Mobile-Memory-Core@exchange.nvidia.com \
--cc=Snikam@nvidia.com \
--cc=amhetre@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@nvidia.com \
--cc=treding@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).