2012-11-26 02:32:05

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the v4l-dvb tree

Hi Mauro,

After merging the v4l-dvb tree, today's linux-next build (x86_64
allmodconfig) failed like this:

ERROR: "dma_common_get_sgtable" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!

Caused by commit 9ef2cbeb8192 ("[media] v4l: vb2-dma-contig: add support
for DMABUF exporting"). dma_common_get_sgtable() is called from the
inline dma_get_sgtable_attrs() and dma_get_sgtable_attrs() is "called
from" dma_get_sgtable(). dma_common_get_sgtable() is only defined if
ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY is set which depends on
CONFIG_HAVE_GENERIC_DMA_COHERENT being set which it isn't for this build.

I have used the v4l-dvb tree form next-20121026 for today.

Please try testing your tree with an x86_64 allmodconfig build.
--
Cheers,
Stephen Rothwell [email protected]


Attachments:
(No filename) (814.00 B)
(No filename) (836.00 B)
Download all attachments

2012-11-26 12:10:34

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the v4l-dvb tree

Hi Stephen,

Em Mon, 26 Nov 2012 13:31:53 +1100
Stephen Rothwell <[email protected]> escreveu:

> Hi Mauro,
>
> After merging the v4l-dvb tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> ERROR: "dma_common_get_sgtable" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!
>
> Caused by commit 9ef2cbeb8192 ("[media] v4l: vb2-dma-contig: add support
> for DMABUF exporting"). dma_common_get_sgtable() is called from the
> inline dma_get_sgtable_attrs() and dma_get_sgtable_attrs() is "called
> from" dma_get_sgtable(). dma_common_get_sgtable() is only defined if
> ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY is set which depends on
> CONFIG_HAVE_GENERIC_DMA_COHERENT being set which it isn't for this build.
>
> I have used the v4l-dvb tree form next-20121026 for today.
>
> Please try testing your tree with an x86_64 allmodconfig build.

My tree does compile here with allmodconfig on x86_64.

A quick fix is to just disable support for DMABUF if !HAVE_GENERIC_DMA_COHERENT.

Regards,
Mauro

-

videobuf2-dma-contig: Only support if HAVE_GENERIC_DMA_COHERENT

As reported by Stephen:

> After merging the v4l-dvb tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> ERROR: "dma_common_get_sgtable" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!
>
> Caused by commit 9ef2cbeb8192 ("[media] v4l: vb2-dma-contig: add support
> for DMABUF exporting"). dma_common_get_sgtable() is called from the
> inline dma_get_sgtable_attrs() and dma_get_sgtable_attrs() is "called
> from" dma_get_sgtable(). dma_common_get_sgtable() is only defined if
> ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY is set which depends on
> CONFIG_HAVE_GENERIC_DMA_COHERENT being set which it isn't for this build.

The simplest fix is to just not support DMABUF with vb2-contig, on archs
where this symbol doesn't exist. Some latter patch can rewrite it to
support this outside -arm.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index 10beaee..5729450 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -226,6 +226,8 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
/* DMABUF ops for exporters */
/*********************************************/

+#ifdef HAVE_GENERIC_DMA_COHERENT
+
struct vb2_dc_attachment {
struct sg_table sgt;
enum dma_data_direction dir;
@@ -416,6 +418,8 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv)
return dbuf;
}

+#endif
+
/*********************************************/
/* callbacks for USERPTR buffers */
/*********************************************/
@@ -735,7 +739,9 @@ static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf,
const struct vb2_mem_ops vb2_dma_contig_memops = {
.alloc = vb2_dc_alloc,
.put = vb2_dc_put,
+#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
.get_dmabuf = vb2_dc_get_dmabuf,
+#endif
.cookie = vb2_dc_cookie,
.vaddr = vb2_dc_vaddr,
.mmap = vb2_dc_mmap,

2012-11-26 13:44:09

by Marek Szyprowski

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the v4l-dvb tree

Hi Stephen,

On 11/26/2012 3:31 AM, Stephen Rothwell wrote:
> Hi Mauro,
>
> After merging the v4l-dvb tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> ERROR: "dma_common_get_sgtable" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!
>
> Caused by commit 9ef2cbeb8192 ("[media] v4l: vb2-dma-contig: add support
> for DMABUF exporting"). dma_common_get_sgtable() is called from the
> inline dma_get_sgtable_attrs() and dma_get_sgtable_attrs() is "called
> from" dma_get_sgtable(). dma_common_get_sgtable() is only defined if
> ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY is set which depends on
> CONFIG_HAVE_GENERIC_DMA_COHERENT being set which it isn't for this build.
>
> I have used the v4l-dvb tree form next-20121026 for today.
>
> Please try testing your tree with an x86_64 allmodconfig build.

Thanks for spotting this issue. It's my fault, code for
dma_common_get_sgtable()
function was incorrectly placed under ifdefs in drivrs/base/dma-mapping.

I've posted a fix, please refer to the "dma-mapping: fix
dma_common_get_sgtable()
conditional compilation" patch, which I will push to Linus asap.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center