public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* dma mapping fixes
@ 2015-11-22 16:25 Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 1/4] C6X: fix build breakage Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-22 16:25 UTC (permalink / raw)
  To: akpm; +Cc: msalter, a-jacquiot, linux-kernel, dan.carpenter, linux

Hi Andew,

below are a couple of fixes for the dma mapping series for architectures
now covered by the automatic build bot.  Thanks to Dan and Guenter for
finding these!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] C6X: fix build breakage
  2015-11-22 16:25 dma mapping fixes Christoph Hellwig
@ 2015-11-22 16:25 ` Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 2/4] arc: dma mapping fixes Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-22 16:25 UTC (permalink / raw)
  To: akpm; +Cc: msalter, a-jacquiot, linux-kernel, dan.carpenter, linux

From: Dan Carpenter <dan.carpenter@oracle.com>

There is a missing curly brace so this code doesn't build.

Fixes: 84f2f1c6ad15 ('c6x: convert to dma_map_ops')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/kernel/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index fd1d5c0..8b7db6e 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -58,7 +58,7 @@ static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
 	struct scatterlist *sg;
 	int i;
 
-	for_each_sg(sglist, sg, nents, i)
+	for_each_sg(sglist, sg, nents, i) {
 		sg->dma_address = sg_phys(sg);
 		c6x_dma_sync(sg->dma_address, sg->length, dir);
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] arc: dma mapping fixes
  2015-11-22 16:25 dma mapping fixes Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 1/4] C6X: fix build breakage Christoph Hellwig
@ 2015-11-22 16:25 ` Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 3/4] c6x: " Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-22 16:25 UTC (permalink / raw)
  To: akpm; +Cc: msalter, a-jacquiot, linux-kernel, dan.carpenter, linux

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/mm/dma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index da289cb..695029f 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -46,7 +46,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	 *   (vs. always going to memory - thus are faster)
 	 */
 	if ((is_isa_arcv2() && ioc_exists) ||
-	    dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs)
+	    dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs))
 		return paddr;
 
 	/* This is kernel Virtual address (0x7000_0000 based) */
@@ -74,7 +74,7 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 {
 	if (!(is_isa_arcv2() && ioc_exists) ||
 	    dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs))
-		iounmap((void __force __iomem *)kvaddr);
+		iounmap((void __force __iomem *)vaddr);
 
 	free_pages_exact((void *)dma_handle, size);
 }
@@ -135,7 +135,7 @@ static void arc_dma_sync_single_for_device(struct device *dev,
 	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
 }
 
-static void arm_dma_sync_sg_for_cpu(struct device *dev,
+static void arc_dma_sync_sg_for_cpu(struct device *dev,
 		struct scatterlist *sglist, int nelems,
 		enum dma_data_direction dir)
 {
@@ -171,7 +171,7 @@ struct dma_map_ops arc_dma_ops = {
 	.sync_single_for_device	= arc_dma_sync_single_for_device,
 	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
 	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_dev	= arc_dma_sync_sg_for_device,
+	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
 	.dma_supported		= arc_dma_supported,
 };
 EXPORT_SYMBOL(arc_dma_ops);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] c6x: dma mapping fixes
  2015-11-22 16:25 dma mapping fixes Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 1/4] C6X: fix build breakage Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 2/4] arc: dma mapping fixes Christoph Hellwig
@ 2015-11-22 16:25 ` Christoph Hellwig
  2015-11-22 16:25 ` [PATCH 4/4] nios2: " Christoph Hellwig
  2015-11-24  1:00 ` Mark Salter
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-22 16:25 UTC (permalink / raw)
  To: akpm; +Cc: msalter, a-jacquiot, linux-kernel, dan.carpenter, linux

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/include/asm/dma-mapping.h |  6 ++++++
 arch/c6x/kernel/dma.c              |  2 ++
 arch/c6x/mm/dma-coherent.c         | 10 ++++------
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
index b810147..6b5cd7b 100644
--- a/arch/c6x/include/asm/dma-mapping.h
+++ b/arch/c6x/include/asm/dma-mapping.h
@@ -24,4 +24,10 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 	return &c6x_dma_ops;
 }
 
+extern void coherent_mem_init(u32 start, u32 size);
+void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, struct dma_attrs *attrs);
+void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, struct dma_attrs *attrs);
+
 #endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 8b7db6e..8a80f3a 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -122,7 +122,9 @@ struct dma_map_ops c6x_dma_ops = {
 	.alloc			= c6x_dma_alloc,
 	.free			= c6x_dma_free,
 	.map_page		= c6x_dma_map_page,
+	.unmap_page		= c6x_dma_unmap_page,
 	.map_sg			= c6x_dma_map_sg,
+	.unmap_sg		= c6x_dma_unmap_sg,
 	.sync_single_for_device	= c6x_dma_sync_single_for_device,
 	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
 	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 4187e51..f7ee63a 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -73,8 +73,8 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *dma_alloc_coherent(struct device *dev, size_t size,
-			 dma_addr_t *handle, gfp_t gfp)
+void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, struct dma_attrs *attrs)
 {
 	u32 paddr;
 	int order;
@@ -94,13 +94,12 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
 
 	return phys_to_virt(paddr);
 }
-EXPORT_SYMBOL(dma_alloc_coherent);
 
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
-		       dma_addr_t dma_handle)
+void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, struct dma_attrs *attrs)
 {
 	int order;
 
@@ -111,7 +110,6 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
 
 	__free_dma_pages(virt_to_phys(vaddr), order);
 }
-EXPORT_SYMBOL(dma_free_coherent);
 
 /*
  * Initialise the coherent DMA memory allocator using the given uncached region.
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] nios2: dma mapping fixes
  2015-11-22 16:25 dma mapping fixes Christoph Hellwig
                   ` (2 preceding siblings ...)
  2015-11-22 16:25 ` [PATCH 3/4] c6x: " Christoph Hellwig
@ 2015-11-22 16:25 ` Christoph Hellwig
  2015-11-24  1:00 ` Mark Salter
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-22 16:25 UTC (permalink / raw)
  To: akpm
  Cc: msalter, a-jacquiot, linux-kernel, dan.carpenter, linux,
	Christoph Hellwig

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Christoph Hellwig <hch@lst.de
---
 arch/nios2/mm/dma-mapping.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 43c1149..90422c3 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -128,7 +128,7 @@ static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
 	__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
 }
 
-static void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
+static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
 		int nhwentries, enum dma_data_direction direction,
 		struct dma_attrs *attrs)
 {
@@ -183,13 +183,15 @@ static void nios2_dma_sync_sg_for_device(struct device *dev,
 }
 
 struct dma_map_ops nios2_dma_ops = {
-	.alloc                  = nios2_dma_alloc,
-	.free                   = nios2_dma_free,
-	.map_page               = nios2_dma_map_page,
-	.map_sg                 = nios2_dma_map_sg,
-	.sync_single_for_device = nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu    = nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu        = nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_dev        = nios2_dma_sync_sg_for_device,
+	.alloc			= nios2_dma_alloc,
+	.free			= nios2_dma_free,
+	.map_page		= nios2_dma_map_page,
+	.unmap_page		= nios2_dma_unmap_page,
+	.map_sg			= nios2_dma_map_sg,
+	.unmap_sg		= nios2_dma_unmap_sg,
+	.sync_single_for_device	= nios2_dma_sync_single_for_device,
+	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
+	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
+	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
 };
 EXPORT_SYMBOL(nios2_dma_ops);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: dma mapping fixes
  2015-11-22 16:25 dma mapping fixes Christoph Hellwig
                   ` (3 preceding siblings ...)
  2015-11-22 16:25 ` [PATCH 4/4] nios2: " Christoph Hellwig
@ 2015-11-24  1:00 ` Mark Salter
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Salter @ 2015-11-24  1:00 UTC (permalink / raw)
  To: Christoph Hellwig, akpm; +Cc: a-jacquiot, linux-kernel, dan.carpenter, linux

On Sun, 2015-11-22 at 17:25 +0100, Christoph Hellwig wrote:
> Hi Andew,
> 
> below are a couple of fixes for the dma mapping series for architectures
> now covered by the automatic build bot.  Thanks to Dan and Guenter for
> finding these!
> 
Thanks for doing this, Christoph.

For the c6x bits:

Acked-by: Mark Salter <msalter@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-24  1:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-22 16:25 dma mapping fixes Christoph Hellwig
2015-11-22 16:25 ` [PATCH 1/4] C6X: fix build breakage Christoph Hellwig
2015-11-22 16:25 ` [PATCH 2/4] arc: dma mapping fixes Christoph Hellwig
2015-11-22 16:25 ` [PATCH 3/4] c6x: " Christoph Hellwig
2015-11-22 16:25 ` [PATCH 4/4] nios2: " Christoph Hellwig
2015-11-24  1:00 ` Mark Salter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox