summaryrefslogtreecommitdiff
path: root/packages/linux/linux-omap-pm/dvb-fix-dma.diff
blob: e05473fc7fcd23f5bda6d0d450ab92f4bc4ceab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Hi,
I post this patch that fixes a kernel crash that happens when using a dvb
usb stick on a mips platform and I think even on other platforms on which
the dma access in not cache-coherent.

The problem's origin is that, inside the method usb_bulk_urb_init of file
drivers/media/dvb/dvb-usb/usb-urb.c, stream->urb_list[i]->transfer_buffer
points to a memory area that has been allocated to be dma-coherent but
stream->urb_list[i]->transfer_flags doesn't include the
URB_NO_TRANSFER_DMA_MAP flag and stream->urb_list[i]->transfer_dma is not
set.
When later on the stream->urb_list[i]->transfer_buffer pointer is used
inside function usb_hcd_submit_urb of file drivers/usb/core/hcd.c since the
flag URB_NO_TRANSFER_DMA_MAP is not set the urb->transfer_buffer pointer is
passed to the dma_map_single function that since the address is dma-coherent
returns a wrong tranfer_dma address that later on leads to the kernel crash.

The problem is solved by setting the URB_NO_TRANSFER_DMA_MAP flag and the
stream->urb_list[i]->transfer_dma address.

Perhaps to be more safe the URB_NO_TRANSFER_DMA_MAP flag can be set only
if stream->urb_list[i]->transfer_dma != 0.

I don't know if half of the fault can be of the dma_map_single function that
should anyway returns a valid address both for a not dma-coherent and a
dma-coherent address.

Just to be clear:
I've done this patch to solve my problem and I tested it only on a mips 
platform
but I think it should not cause any problems on other platforms.
I posted it here to help someone else that can have my same problem and to 
point it out
to the mantainer of this part of code.
You can use it at your own risk and I'm not resposible in any way for any 
problem or
damage that it can cause.
I'm available to discuss about it

Bye

Michele Scorcia

--------------------




--- /tmp/usb-urb.c	2008-10-08 09:53:23.000000000 +0200
+++ git/drivers/media/dvb/dvb-usb/usb-urb.c	2008-10-08 09:54:16.000000000 +0200
@@ -152,7 +152,8 @@
 				stream->props.u.bulk.buffersize,
 				usb_urb_complete, stream);
 
-		stream->urb_list[i]->transfer_flags = 0;
+		stream->urb_list[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
+		stream->urb_list[i]->transfer_dma = stream->dma_addr[i];	
 		stream->urbs_initialized++;
 	}
 	return 0;