From: Alexander Duyck <alexander.h.duyck@intel.com>
To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: brouer@redhat.com, Mark Salter <msalter@redhat.com>,
davem@davemloft.net, Aurelien Jacquiot <a-jacquiot@ti.com>
Subject: [net-next PATCH 08/27] arch/c6x: Add option to skip sync on DMA map and unmap
Date: Tue, 25 Oct 2016 11:37:30 -0400 [thread overview]
Message-ID: <20161025153730.4815.48964.stgit@ahduyck-blue-test.jf.intel.com> (raw)
In-Reply-To: <20161025153220.4815.61239.stgit@ahduyck-blue-test.jf.intel.com>
This change allows us to pass DMA_ATTR_SKIP_CPU_SYNC which allows us to
avoid invoking cache line invalidation if the driver will just handle it
later via a sync_for_cpu or sync_for_device call.
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
arch/c6x/kernel/dma.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index db4a6a3..6752df3 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -42,14 +42,17 @@ static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
{
dma_addr_t handle = virt_to_phys(page_address(page) + offset);
- c6x_dma_sync(handle, size, dir);
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ c6x_dma_sync(handle, size, dir);
+
return handle;
}
static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir, unsigned long attrs)
{
- c6x_dma_sync(handle, size, dir);
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ c6x_dma_sync(handle, size, dir);
}
static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
@@ -60,7 +63,8 @@ static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
for_each_sg(sglist, sg, nents, i) {
sg->dma_address = sg_phys(sg);
- c6x_dma_sync(sg->dma_address, sg->length, dir);
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ c6x_dma_sync(sg->dma_address, sg->length, dir);
}
return nents;
@@ -72,9 +76,11 @@ static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
struct scatterlist *sg;
int i;
+ if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+ return;
+
for_each_sg(sglist, sg, nents, i)
c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-
}
static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
next prev parent reply other threads:[~2016-10-25 21:44 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 15:36 [net-next PATCH 00/27] Add support for DMA writable pages being writable by the network stack Alexander Duyck
2016-10-25 15:36 ` [net-next PATCH 01/27] swiotlb: Drop unused function swiotlb_map_sg Alexander Duyck
2016-10-25 15:36 ` [net-next PATCH 02/27] swiotlb-xen: Enforce return of DMA_ERROR_CODE in mapping function Alexander Duyck
2016-10-28 17:35 ` Konrad Rzeszutek Wilk
2016-10-25 15:37 ` [net-next PATCH 03/27] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-28 17:34 ` Konrad Rzeszutek Wilk
2016-10-28 18:09 ` Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 04/27] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck
2016-10-25 22:00 ` Vineet Gupta
2016-10-25 15:37 ` [net-next PATCH 05/27] arch/arm: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 06/27] arch/avr32: Add option to skip sync on DMA map Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 07/27] arch/blackfin: " Alexander Duyck
2016-10-25 15:37 ` Alexander Duyck [this message]
2016-10-25 15:37 ` [net-next PATCH 09/27] arch/frv: " Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 10/27] arch/hexagon: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 11/27] arch/m68k: " Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 12/27] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-25 15:37 ` [net-next PATCH 13/27] arch/microblaze: " Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 14/27] arch/mips: " Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 15/27] arch/nios2: " Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 16/27] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 17/27] arch/parisc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 18/27] arch/powerpc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 19/27] arch/sh: " Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 20/27] arch/sparc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 21/27] arch/tile: " Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 22/27] arch/xtensa: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 23/27] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck
2016-10-25 15:38 ` [net-next PATCH 24/27] mm: Add support for releasing multiple instances of a page Alexander Duyck
2016-10-25 15:39 ` [net-next PATCH 25/27] igb: Update driver to make use of DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-26 17:21 ` [Intel-wired-lan] " Jeff Kirsher
2016-10-25 15:39 ` [net-next PATCH 26/27] igb: Update code to better handle incrementing page count Alexander Duyck
2016-10-26 17:21 ` [Intel-wired-lan] " Jeff Kirsher
2016-10-25 15:39 ` [net-next PATCH 27/27] igb: Revert "igb: Revert support for build_skb in igb" Alexander Duyck
2016-10-26 17:22 ` [Intel-wired-lan] " Jeff Kirsher
2016-10-26 15:45 ` [net-next PATCH 00/27] Add support for DMA writable pages being writable by the network stack Jesper Dangaard Brouer
2016-10-28 15:48 ` Alexander Duyck
2016-10-28 17:06 ` David Miller
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=20161025153730.4815.48964.stgit@ahduyck-blue-test.jf.intel.com \
--to=alexander.h.duyck@intel.com \
--cc=a-jacquiot@ti.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=msalter@redhat.com \
--cc=netdev@vger.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 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).