From: Alexander Duyck <alexander.h.duyck@intel.com>
To: linux-mm@kvack.org, akpm@linux-foundation.org
Cc: netdev@vger.kernel.org, Michal Simek <monstr@monstr.eu>,
linux-kernel@vger.kernel.org
Subject: [mm PATCH v3 10/23] arch/microblaze: Add option to skip DMA sync as a part of map and unmap
Date: Thu, 10 Nov 2016 06:35:08 -0500 [thread overview]
Message-ID: <20161110113508.76501.77583.stgit@ahduyck-blue-test.jf.intel.com> (raw)
In-Reply-To: <20161110113027.76501.63030.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
via a sync_for_cpu or sync_for_device call.
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
arch/microblaze/kernel/dma.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index ec04dc1..818daf2 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -61,6 +61,10 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
/* FIXME this part of code is untested */
for_each_sg(sgl, sg, nents, i) {
sg->dma_address = sg_phys(sg);
+
+ if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+ continue;
+
__dma_sync(page_to_phys(sg_page(sg)) + sg->offset,
sg->length, direction);
}
@@ -80,7 +84,8 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
enum dma_data_direction direction,
unsigned long attrs)
{
- __dma_sync(page_to_phys(page) + offset, size, direction);
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ __dma_sync(page_to_phys(page) + offset, size, direction);
return page_to_phys(page) + offset;
}
@@ -95,7 +100,8 @@ static inline void dma_direct_unmap_page(struct device *dev,
* phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
* dma_address is physical address
*/
- __dma_sync(dma_address, size, direction);
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ __dma_sync(dma_address, size, direction);
}
static inline void
next prev parent reply other threads:[~2016-11-10 17:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 11:34 [mm PATCH v3 00/23] Add support for DMA writable pages being writable by the network stack Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 01/23] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 02/23] arch/arm: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 03/23] arch/avr32: Add option to skip sync on DMA map Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 04/23] arch/blackfin: " Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 05/23] arch/c6x: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 06/23] arch/frv: Add option to skip sync on DMA map Alexander Duyck
2016-11-10 11:34 ` [mm PATCH v3 07/23] arch/hexagon: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-10 18:40 ` Richard Kuo
2016-11-10 11:34 ` [mm PATCH v3 08/23] arch/m68k: " Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 09/23] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-10 11:35 ` Alexander Duyck [this message]
2016-11-10 11:35 ` [mm PATCH v3 11/23] arch/mips: " Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 12/23] arch/nios2: " Alexander Duyck
2016-11-11 10:58 ` Tobias Klauser
2016-11-10 11:35 ` [mm PATCH v3 13/23] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 14/23] arch/parisc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 15/23] arch/powerpc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 16/23] arch/sh: " Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 17/23] arch/sparc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-13 17:27 ` David Miller
2016-11-10 11:35 ` [mm PATCH v3 18/23] arch/tile: " Alexander Duyck
2016-11-10 11:35 ` [mm PATCH v3 19/23] arch/xtensa: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-10 11:36 ` [mm PATCH v3 20/23] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck
2016-11-10 11:36 ` [mm PATCH v3 21/23] mm: Add support for releasing multiple instances of a page Alexander Duyck
2016-11-18 23:27 ` Andrew Morton
2016-11-21 16:21 ` Alexander Duyck
2016-11-22 6:28 ` Andrew Morton
2016-11-10 11:36 ` [mm PATCH v3 22/23] igb: Update driver to make use of DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-11-10 11:36 ` [mm PATCH v3 23/23] igb: Update code to better handle incrementing page count Alexander Duyck
2016-11-18 16:10 ` [mm PATCH v3 00/23] Add support for DMA writable pages being writable by the network stack Alexander Duyck
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=20161110113508.76501.77583.stgit@ahduyck-blue-test.jf.intel.com \
--to=alexander.h.duyck@intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=monstr@monstr.eu \
--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).