linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cx231xx: DMA problem on ARM
@ 2011-09-21 11:56 Thomas Petazzoni
  2011-09-21 12:04 ` Devin Heitmueller
  0 siblings, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2011-09-21 11:56 UTC (permalink / raw)
  To: linux-media, srinivasa.deevi; +Cc: Maxime Ripard

Hello,

On an x86 platform, we have managed to use a Hauppauge USB Live 2
capture device with the cx231xx on a 3.0 kernel with the patch at [1].
Things work nicely.

However, using a similar 3.0 kernel with the exact same device on an
ARM platform (BeagleBoard-XM), starting a V4L application to capture
the video immediately triggers the following BUG_ON in
arch/arm/mm/dma-mapping.c:

429 void ___dma_single_cpu_to_dev(const void *kaddr, size_t size,
430         enum dma_data_direction dir)
431 {
432         unsigned long paddr;
433 
434         BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1));

This problem looks similar to the problem fixed on the gspca driver by:

commit 882787ff8fdeb0be790547ee9b22b281095e95da
Author: Jason Wang <jason77.wang@gmail.com>
Date:   Fri Sep 3 06:57:19 2010 -0300

    V4L/DVB: gspca - main: Fix a crash of some webcams on ARM arch
    
    When plugging some webcams on ARM, the system crashes.
    This is because we alloc buffer for an urb through usb_buffer_alloc,
    the alloced buffer is already in DMA coherent region, so we should
    set the flag of this urb to URB_NO_TRANSFER_DMA_MAP, otherwise when
    we submit this urb, the hcd core will handle this address as an
    non-DMA address and call dma_map_single/sg to map it. On arm
    architecture, dma_map_single a DMA coherent address will be catched
    by a BUG_ON().
    
    Signed-off-by: Jason Wang <jason77.wang@gmail.com>
    Signed-off-by: Jean-François Moine <moinejf@free.fr>
    Cc: stable@kernel.org
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

I guess the cx231xx driver is trying to DMA-map buffers whose location
is not appropriate for DMA-mapping, because they are already in an DMA
coherent region. Is the fix just to add the same
URB_NO_TRANSFER_DMA_MAP to the urb->transfer_flags ? Or is it something
completely different ?

Thanks!

Thomas

[1]
https://github.com/torvalds/linux/commit/992299e84a4891275ea5924e30b66ce39a701e5e#drivers/media/video/cx231xx
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

end of thread, other threads:[~2011-09-26 20:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21 11:56 cx231xx: DMA problem on ARM Thomas Petazzoni
2011-09-21 12:04 ` Devin Heitmueller
2011-09-21 19:17   ` Thomas Petazzoni
2011-09-22 14:45   ` Thomas Petazzoni
2011-09-22 15:09     ` Devin Heitmueller
2011-09-22 15:29       ` Thomas Petazzoni
2011-09-23 12:04         ` Thomas Petazzoni
2011-09-23 12:26           ` Sri Deevi
2011-09-24 18:04             ` Thomas Petazzoni
2011-09-24  2:15           ` Mauro Carvalho Chehab
2011-09-26  8:13             ` Thomas Petazzoni
2011-09-26 17:32               ` Mauro Carvalho Chehab
2011-09-26 19:02                 ` Laurent Pinchart
2011-09-26 19:59                   ` Thomas Petazzoni
2011-09-26 20:03                     ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).