Skip to contentSkip to conversation

xtensa build failures in -next due to DMA API changes

DISCUSSION Guenter Roeck 5 participants 10 messages Aug 25, 2015 – Sep 1, 2015 Tensilica Xtensa port (xtensa)

lore
Share & tools
lore
#0 lore raw

Hi,

xtensa builds fail in -next (again) as follows.

In file included from include/linux/dma-mapping.h:86:0,

                 from include/asm-generic/pci-dma-compat.h:7,
		 from ./arch/xtensa/include/asm/pci.h:59,
		from include/linux/pci.h:1492,
		from arch/xtensa/kernel/platform.c:16:

./arch/xtensa/include/asm/dma-mapping.h:40:21:
error: redefinition of ‘dma_alloc_attrs’

In file included from ./arch/xtensa/include/asm/dma-mapping.h:33:0,

                 from include/linux/dma-mapping.h:86,
		 from include/asm-generic/pci-dma-compat.h:7,
		from ./arch/xtensa/include/asm/pci.h:59,
		from include/linux/pci.h:1492,
		from arch/xtensa/kernel/platform.c:16:

include/asm-generic/dma-mapping-common.h:245:21:
note: previous definition of ‘dma_alloc_attrs’ was here

and many similar errors; it looks like all dma attribute functions have been redefined.

The problem seems to have been introduced with changes made by Christoph Hellwig, coming in through Andrew's tree. Copying them here for comments.

Guenter

#1 lore raw

Hi Guenter,

Quoted 2 lines

The problem seems to have been introduced with changes made by Christoph Hellwig, coming in through Andrew's tree. Copying them here for comments.

xtensa doesn't use the generic dma map implementation, so it shouldn't include dma-mapping-common.h anywhere, and in my tree it doesn't.

Can you do a git-grep for dma-mapping-common.h on the tree that you see this error on? Nothing but arch/*/include/asm/dma-mapping.h should include it. In my tree it's all fine:

Documentation/DMA-API-HOWTO.txt: can use include/linux/asm-generic/dma-mapping-common.h. It's a
arch/alpha/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/arm/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/arm64/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/h8300/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/hexagon/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/ia64/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/microblaze/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/mips/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/openrisc/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/powerpc/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/s390/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/sh/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/sparc/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/tile/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/unicore32/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h> arch/x86/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

#2 lore raw

Hi Christoph,

Quoted 5 lines · Christoph Hellwig

Hi Guenter,

Quoted 2 lines

The problem seems to have been introduced with changes made by Christoph Hellwig, coming in through Andrew's tree. Copying them here for comments.

Quoted 7 lines

xtensa doesn't use the generic dma map implementation, so it shouldn't include dma-mapping-common.h anywhere, and in my tree it doesn't.

Can you do a git-grep for dma-mapping-common.h on the tree that you see this error on? Nothing but arch/*/include/asm/dma-mapping.h should include it. In my tree it's all fine:

I also see

arch/xtensa/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

It looks like there is a conflict with "xtensa: reimplement DMA API using common helpers" by Max Filippov, which added the include. This patch is in -next.

Guenter

#9 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · On Tue, 25 Aug 2015 22:15:32 +0200 Christoph Hellwig <[email protected]> wrote:
Quoted 2 lines

The problem seems to have been introduced with changes made by Christoph Hellwig, coming in through Andrew's tree. Copying them here for comments.

xtensa doesn't use the generic dma map implementation, so it shouldn't include dma-mapping-common.h anywhere, and in my tree it doesn't.

Can you do a git-grep for dma-mapping-common.h on the tree that you see this error on? Nothing but arch/*/include/asm/dma-mapping.h should include it.

This patch is in linux-next:

commit c75959a6da19df2700556dc76861442e9716317d

Author:     Max Filippov <[email protected]>
AuthorDate: Mon May 25 06:55:05 2015 +0300
Commit:     Max Filippov <[email protected]>
CommitDate: Mon Aug 17 07:31:00 2015 +0300

xtensa: reimplement DMA API using common helpers

- keep existing functionality: don't handle attributes, don't support high memory;
- implement scatterlist primitives (map/unmap/sync);
- enable DMA API debug.

arch/xtensa/Kconfig +2 -0
index e5b872b..6ce10f9 100644
@@ -14,6 +14,8 @@ config XTENSA
 	select GENERIC_IRQ_SHOW
 	select GENERIC_PCI_IOMAP
 	select GENERIC_SCHED_CLOCK
+	select HAVE_DMA_API_DEBUG
+	select HAVE_DMA_ATTRS
 	select HAVE_FUNCTION_TRACER
 	select HAVE_IRQ_TIME_ACCOUNTING
 	select HAVE_OPROFILE
arch/xtensa/include/asm/Kbuild +0 -1
index 14d15bf..d870a59 100644
@@ -2,7 +2,6 @@ generic-y += bitsperlong.h
 generic-y += bug.h
 generic-y += clkdev.h
 generic-y += cputime.h
-generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
 generic-y += errno.h
arch/xtensa/include/asm/device.h new file +19 -0
new file mode 100644
index 0000000..fe1f5c8
@@ -0,0 +1,19 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ */
+#ifndef _ASM_XTENSA_DEVICE_H
+#define _ASM_XTENSA_DEVICE_H
+
+struct dma_map_ops;
+
+struct dev_archdata {
+	/* DMA operations on that device */
+	struct dma_map_ops *dma_ops;
+};
+
+struct pdev_archdata {
+};
+
+#endif /* _ASM_XTENSA_DEVICE_H */
arch/xtensa/include/asm/dma-mapping.h +39 -147

231 lines not on this page · raw message

arch/xtensa/kernel/pci-dma.c +173 -30

242 lines not on this page · raw message

#3 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

I also see

arch/xtensa/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

It looks like there is a conflict with "xtensa: reimplement DMA API using common helpers" by Max Filippov, which added the include. This patch is in -next.

Oh. That one clashes badly with my whole series, basically each of my patches will need the same work done for the other architectures applied to xtensa as well.

In terms of effort it might be a better idea to rebase the patch from Max on top of the series, as it will become a lot simpler that way.

maintainer
#4 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 6 lines · Guenter Roeck

I also see

arch/xtensa/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

It looks like there is a conflict with "xtensa: reimplement DMA API using common helpers" by Max Filippov, which added the include. This patch is in -next.

Quoted 6 lines

Oh. That one clashes badly with my whole series, basically each of my patches will need the same work done for the other architectures applied to xtensa as well.

In terms of effort it might be a better idea to rebase the patch from Max on top of the series, as it will become a lot simpler that way.

Looks like I just need to remove now redundant function definitions from xtensa/include/asm/dma-mapping.h. A patch that removes these functions is attached, but I'm not sure where it should go. To the Andrew's tree? Or should the xtensa tree merge Christoph's series and apply it on top?

Signature · 2 lines
Thanks.
-- Max

From 8707a6bd9f9bb4e40dc981be104e2eaa7b6355a6 Mon Sep 17 00:00:00 2001
From: Max Filippov <[email protected]>
Date: Wed, 26 Aug 2015 08:42:18 +0300
Subject: [PATCH] xtensa: remove duplicate definitions from dma-mapping.h

DMA API reimplementation for xtensa conflicts with dma-mapping consolidation series from Christoph Hellwig: now both xtensa dma-mapping.h and dma-mapping-common.h define many dma_* functions.

Remove extra definitions from xtensa-specific dma-mapping.h

---
 arch/xtensa/include/asm/dma-mapping.h | 60 -----------------------------------
 1 file changed, 60 deletions(-)
arch/xtensa/include/asm/dma-mapping.h +0 -60
index f01cb30..4427f38 100644
@@ -32,66 +32,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 
 #include <asm-generic/dma-mapping-common.h>
 
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
-#define dma_free_noncoherent(d, s, v, h) dma_free_attrs(d, s, v, h, NULL)
-#define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
-#define dma_free_coherent(d, s, c, h) dma_free_attrs(d, s, c, h, NULL)
-
-static inline void *dma_alloc_attrs(struct device *dev, size_t size,
-				    dma_addr_t *dma_handle, gfp_t gfp,
-				    struct dma_attrs *attrs)
-{
-	void *ret;
-	struct dma_map_ops *ops = get_dma_ops(dev);
-
-	if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
-		return ret;
-
-	ret = ops->alloc(dev, size, dma_handle, gfp, attrs);
-	debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
-
-	return ret;
-}
-
-static inline void dma_free_attrs(struct device *dev, size_t size,
-				  void *vaddr, dma_addr_t dma_handle,
-				  struct dma_attrs *attrs)
-{
-	struct dma_map_ops *ops = get_dma_ops(dev);
-
-	if (dma_release_from_coherent(dev, get_order(size), vaddr))
-		return;
-
-	ops->free(dev, size, vaddr, dma_handle, attrs);
-	debug_dma_free_coherent(dev, size, vaddr, dma_handle);
-}
-
-static inline int
-dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	struct dma_map_ops *ops = get_dma_ops(dev);
-
-	debug_dma_mapping_error(dev, dma_addr);
-	return ops->mapping_error(dev, dma_addr);
-}
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-	return 1;
-}
-
-static inline int
-dma_set_mask(struct device *dev, u64 mask)
-{
-	if(!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
-
-	return 0;
-}
-
 void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 		    enum dma_data_direction direction);
 
Signature · 1 line
1.8.1.4
#5 lore raw
Quoted 13 lines · On Wed, 26 Aug 2015 10:53:25 +0300 Max Filippov <[email protected]> wrote:
Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Guenter Roeck

I also see

arch/xtensa/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

It looks like there is a conflict with "xtensa: reimplement DMA API using common helpers" by Max Filippov, which added the include. This patch is in -next.

Oh. That one clashes badly with my whole series, basically each of my patches will need the same work done for the other architectures applied to xtensa as well.

Quoted 8 lines
Quoted 2 lines

In terms of effort it might be a better idea to rebase the patch from Max on top of the series, as it will become a lot simpler that way.

Looks like I just need to remove now redundant function definitions from xtensa/include/asm/dma-mapping.h. A patch that removes these functions is attached, but I'm not sure where it should go. To the Andrew's tree? Or should the xtensa tree merge Christoph's series and apply it on top?

I can add it to Christoph's patch series. This means that I won't be merging Christoph's patches until you've sent your queue in to Linus, so please don't leave it too late in the merge window.

#7 lore raw
In reply to Max Filippov
Quoted 5 lines · Max Filippov

Looks like I just need to remove now redundant function definitions from xtensa/include/asm/dma-mapping.h. A patch that removes these functions is attached, but I'm not sure where it should go. To the Andrew's tree? Or should the xtensa tree merge Christoph's series and apply it on top?

This looks fine to me. Thanks for converting xtensa to the generic DMA code!

maintainer
#6 lore raw
In reply to Andrew Morton

I'll send the pull request as soon as possible.

Quoted 28 lines · Andrew Morton
Quoted 13 lines · On Wed, 26 Aug 2015 10:53:25 +0300 Max Filippov <[email protected]> wrote:
Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Guenter Roeck

I also see

arch/xtensa/include/asm/dma-mapping.h:#include <asm-generic/dma-mapping-common.h>

It looks like there is a conflict with "xtensa: reimplement DMA API using common helpers" by Max Filippov, which added the include. This patch is in -next.

Oh. That one clashes badly with my whole series, basically each of my patches will need the same work done for the other architectures applied to xtensa as well.

Quoted 8 lines
Quoted 2 lines

In terms of effort it might be a better idea to rebase the patch from Max on top of the series, as it will become a lot simpler that way.

Looks like I just need to remove now redundant function definitions from xtensa/include/asm/dma-mapping.h. A patch that removes these functions is attached, but I'm not sure where it should go. To the Andrew's tree? Or should the xtensa tree merge Christoph's series and apply it on top?

I can add it to Christoph's patch series. This means that I won't be merging Christoph's patches until you've sent your queue in to Linus, so please don't leave it too late in the merge window.

maintainer
#8 lore raw
In reply to Christoph Hellwig

Hi Andrew,

Linus has merged the Xtensa patches, so you should be ready to go.

Thanks,
-Chris

Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Max Filippov

Looks like I just need to remove now redundant function definitions from xtensa/include/asm/dma-mapping.h. A patch that removes these functions is attached, but I'm not sure where it should go. To the Andrew's tree? Or should the xtensa tree merge Christoph's series and apply it on top?

This looks fine to me. Thanks for converting xtensa to the generic DMA code!