From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linux-m68k@vger.kernel.org
Subject: Re: [PATCH/RFC 0/4] Re: dma_mmap_coherent / ARCH_HAS_DMA_MMAP_COHERENT
Date: Wed, 02 Jan 2013 15:39:55 +0100 [thread overview]
Message-ID: <50E446BB.7090609@samsung.com> (raw)
In-Reply-To: <1356722614-18224-1-git-send-email-geert@linux-m68k.org>
Hello,
On 12/28/2012 8:23 PM, Geert Uytterhoeven wrote:
> On Sun, Dec 16, 2012 at 5:03 PM, Geert Uytterhoeven <geert@linux-m68k.org>
> wrote:
> > drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
> > drivers/media/v4l2-core/videobuf2-dma-contig.c:204: error: implicit declaration of function ‘dma_mmap_coherent’
> > drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_get_base_sgt’:
> > drivers/media/v4l2-core/videobuf2-dma-contig.c:387: error: implicit declaration of function ‘dma_get_sgtable’
> > make[6]: *** [drivers/media/v4l2-core/videobuf2-dma-contig.o] Error 1
> > make[6]: Target `__build' not remade because of errors.
> > make[5]: *** [drivers/media/v4l2-core] Error 2
> >
> > Both dma_mmap_coherent() and dma_get_sgtable() are defined in
> > include/asm-generic/dma-mapping-common.h only, which is included by
> > <asm/dma-mapping.h> on alpha, arm, arm64, hexagon, ia64, microblaze, mips,
> > openrisc, powerpc, s390, sh, sparc, tile, unicore32, x86.
> > Should the remaining architectures include this, too?
> > Should it be moved to <linux/dma-mapping.h>?
>
> I came up with an RFC-solution for this in [PATCH/RFC 3/4]
> ("avr32/bfin/c6x/cris/frv/m68k/mn10300/parisc/xtensa: Add dummy get_dma_ops()")
> and [PATCH/RFC 4/4] ("common: dma-mapping: Move dma_common_*() to
> <linux/dma-mapping.h>") of this series.
>
> > Furthermore, there's ARCH_HAS_DMA_MMAP_COHERENT, which is defined
> > by powerpc only:
> > arch/powerpc/include/asm/dma-mapping.h:#define ARCH_HAS_DMA_MMAP_COHERENT
> >
> > and handled in some fishy way in sound/core/pcm_native.c:
> >
> > #ifndef ARCH_HAS_DMA_MMAP_COHERENT
> > /* This should be defined / handled globally! */
> > #ifdef CONFIG_ARM
> > #define ARCH_HAS_DMA_MMAP_COHERENT
> > #endif
> > #endif
> >
> > /*
> > * mmap the DMA buffer on RAM
> > */
> > int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
> > struct vm_area_struct *area)
> > {
> > area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
> > #ifdef ARCH_HAS_DMA_MMAP_COHERENT
> > if (!substream->ops->page &&
> > substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV)
> > return dma_mmap_coherent(substream->dma_buffer.dev.dev,
> > area,
> > substream->runtime->dma_area,
> > substream->runtime->dma_addr,
> > area->vm_end - area->vm_start);
> > #elif defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
> > if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV &&
> > !plat_device_is_coherent(substream->dma_buffer.dev.dev))
> > area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
> > #endif /* ARCH_HAS_DMA_MMAP_COHERENT */
> > /* mmap with fault handler */
> > area->vm_ops = &snd_pcm_vm_ops_data_fault;
> > return 0;
> > }
> > EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap);
> >
> > What's up here?
>
> Probably an easy solution here is to kill ARCH_HAS_DMA_MMAP_COHERENT and
> change the code to
>
> #if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
> if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV &&
> !plat_device_is_coherent(substream->dma_buffer.dev.dev))
> area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
> #else
> if (!substream->ops->page &&
> substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV)
> return dma_mmap_coherent(substream->dma_buffer.dev.dev,
> area,
> substream->runtime->dma_area,
> substream->runtime->dma_addr,
> area->vm_end - area->vm_start);
> #endif
>
> but obviously I don't like the test for CONFIG_MIPS in generic code...
I think that the best way of handling it would be to move this code to MIPS
specific dma_mmap_coherent() implementation.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
next prev parent reply other threads:[~2013-01-02 14:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-16 16:03 dma_mmap_coherent / ARCH_HAS_DMA_MMAP_COHERENT Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 0/4] " Geert Uytterhoeven
2012-12-28 19:23 ` Geert Uytterhoeven
2013-01-02 14:39 ` Marek Szyprowski [this message]
2012-12-28 19:23 ` [PATCH 1/4] m68k: Sort out !CONFIG_MMU_SUN3 vs. CONFIG_HAS_DMA Geert Uytterhoeven
2012-12-28 19:23 ` Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH 2/4] score: Remove unneeded <asm/dma-mapping.h> Geert Uytterhoeven
2012-12-28 19:23 ` Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 3/4] avr32/bfin/c6x/cris/frv/m68k/mn10300/parisc/xtensa: Add dummy get_dma_ops() Geert Uytterhoeven
2012-12-28 19:23 ` Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 4/4] common: dma-mapping: Move dma_common_*() to <linux/dma-mapping.h> Geert Uytterhoeven
2012-12-29 0:09 ` Mauro Carvalho Chehab
2012-12-29 0:09 ` Mauro Carvalho Chehab
2013-01-02 14:22 ` Marek Szyprowski
2013-01-13 10:40 ` Geert Uytterhoeven
2013-01-13 10:40 ` Geert Uytterhoeven
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=50E446BB.7090609@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=geert@linux-m68k.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-media@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