All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@intel.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: brouer@redhat.com, James Hogan <james.hogan@imgtec.com>,
	linux-metag@vger.kernel.org, davem@davemloft.net
Subject: [net-next PATCH RFC 11/26] arch/metag: Add option to skip DMA sync as a part of map and unmap
Date: Mon, 24 Oct 2016 08:05:24 -0400	[thread overview]
Message-ID: <20161024120524.16276.61479.stgit@ahduyck-blue-test.jf.intel.com> (raw)
In-Reply-To: <20161024115737.16276.71059.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: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
 arch/metag/kernel/dma.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index 0db31e2..91968d9 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -484,8 +484,9 @@ static dma_addr_t metag_dma_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction, unsigned long attrs)
 {
-	dma_sync_for_device((void *)(page_to_phys(page) + offset), size,
-			    direction);
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_sync_for_device((void *)(page_to_phys(page) + offset),
+				    size, direction);
 	return page_to_phys(page) + offset;
 }
 
@@ -493,7 +494,8 @@ static void metag_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
 		size_t size, enum dma_data_direction direction,
 		unsigned long attrs)
 {
-	dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
 }
 
 static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist,
@@ -507,6 +509,10 @@ static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist,
 		BUG_ON(!sg_page(sg));
 
 		sg->dma_address = sg_phys(sg);
+
+		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+			continue;
+
 		dma_sync_for_device(sg_virt(sg), sg->length, direction);
 	}
 
@@ -525,6 +531,10 @@ static void metag_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
 		BUG_ON(!sg_page(sg));
 
 		sg->dma_address = sg_phys(sg);
+
+		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+			continue;
+
 		dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
 	}
 }

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Duyck <alexander.h.duyck@intel.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: brouer@redhat.com, James Hogan <james.hogan@imgtec.com>,
	linux-metag@vger.kernel.org, davem@davemloft.net
Subject: [net-next PATCH RFC 11/26] arch/metag: Add option to skip DMA sync as a part of map and unmap
Date: Mon, 24 Oct 2016 08:05:24 -0400	[thread overview]
Message-ID: <20161024120524.16276.61479.stgit@ahduyck-blue-test.jf.intel.com> (raw)
In-Reply-To: <20161024115737.16276.71059.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: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
 arch/metag/kernel/dma.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index 0db31e2..91968d9 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -484,8 +484,9 @@ static dma_addr_t metag_dma_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction, unsigned long attrs)
 {
-	dma_sync_for_device((void *)(page_to_phys(page) + offset), size,
-			    direction);
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_sync_for_device((void *)(page_to_phys(page) + offset),
+				    size, direction);
 	return page_to_phys(page) + offset;
 }
 
@@ -493,7 +494,8 @@ static void metag_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
 		size_t size, enum dma_data_direction direction,
 		unsigned long attrs)
 {
-	dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
 }
 
 static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist,
@@ -507,6 +509,10 @@ static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist,
 		BUG_ON(!sg_page(sg));
 
 		sg->dma_address = sg_phys(sg);
+
+		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+			continue;
+
 		dma_sync_for_device(sg_virt(sg), sg->length, direction);
 	}
 
@@ -525,6 +531,10 @@ static void metag_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
 		BUG_ON(!sg_page(sg));
 
 		sg->dma_address = sg_phys(sg);
+
+		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+			continue;
+
 		dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
 	}
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2016-10-24 18:06 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 12:04 [net-next PATCH RFC 00/26] Add support for DMA writable pages being writable by the network stack Alexander Duyck
2016-10-24 12:04 ` Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 01/26] swiotlb: Drop unused function swiotlb_map_sg Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 18:10   ` Konrad Rzeszutek Wilk
2016-10-24 18:10     ` Konrad Rzeszutek Wilk
2016-10-24 12:04 ` [net-next PATCH RFC 02/26] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 18:09   ` Konrad Rzeszutek Wilk
2016-10-24 18:09     ` Konrad Rzeszutek Wilk
2016-10-24 19:16     ` Alexander Duyck
2016-10-24 19:16       ` Alexander Duyck
2016-10-25  1:22       ` Konrad Rzeszutek Wilk
2016-10-24 12:04 ` [net-next PATCH RFC 03/26] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 04/26] arch/arm: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-31 10:20   ` Russell King - ARM Linux
2016-10-31 10:20     ` Russell King - ARM Linux
2016-10-31 15:26     ` Alexander Duyck
2016-10-31 15:26       ` Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 05/26] arch/avr32: Add option to skip sync on DMA map Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 18:27   ` Hans-Christian Noren Egtvedt
2016-10-24 18:27     ` Hans-Christian Noren Egtvedt
2016-10-24 12:04 ` [net-next PATCH RFC 06/26] arch/blackfin: " Alexander Duyck
2016-10-24 12:04   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 07/26] arch/c6x: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-28 14:59   ` Mark Salter
2016-10-28 14:59     ` Mark Salter
2016-10-24 12:05 ` [net-next PATCH RFC 08/26] arch/frv: Add option to skip sync on DMA map Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 09/26] arch/hexagon: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 10/26] arch/m68k: " Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` Alexander Duyck [this message]
2016-10-24 12:05   ` [net-next PATCH RFC 11/26] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 12/26] arch/microblaze: " Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 13/26] arch/mips: " Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 14/26] arch/nios2: " Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 15/26] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 16/26] arch/parisc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 17/26] arch/powerpc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:05   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 18/26] arch/sh: " Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 19/26] arch/sparc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 18:27   ` David Miller
2016-10-24 18:27     ` David Miller
2016-10-24 18:27     ` David Miller
2016-10-24 19:24     ` Alexander Duyck
2016-10-24 19:24       ` Alexander Duyck
2016-10-24 19:24       ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 20/26] arch/tile: " Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 21/26] arch/xtensa: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 22/26] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 23/26] mm: Add support for releasing multiple instances of a page Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 24/26] igb: Update driver to make use of DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 25/26] igb: Update code to better handle incrementing page count Alexander Duyck
2016-10-24 12:06   ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 26/26] igb: Revert "igb: Revert support for build_skb in igb" Alexander Duyck
2016-10-24 12:06   ` 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=20161024120524.16276.61479.stgit@ahduyck-blue-test.jf.intel.com \
    --to=alexander.h.duyck@intel.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-metag@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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 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.