]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/saa7134-fix-resource-map-sanity-check-conflict.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / saa7134-fix-resource-map-sanity-check-conflict.patch
1 Subject: [PATCH] saa7134: fix resource map sanity check conflict
2 References: bnc#446733
3 From: Suresh Siddha <suresh.b.siddha@intel.com>
4
5 Note: Patch should use pci_ioremap but this is what upstream has.
6
7 changeset: 9356:33626df3ba2c
8 user: Mauro Carvalho Chehab <mchehab@redhat.com>
9 date: Mon Oct 20 13:57:02 2008 -0700
10 files: drivers/media/video/saa7134/saa7134-core.c
11
12
13
14 Impact: driver could possibly stomp on resources outside of its scope
15
16 {mchehab@redhat.com: I got two versions of the same patch (identical,
17 except for whitespacing). One authored by Andy Burns and another
18 authored by Suresh Siddha. Due to that, I'm applying the one that has
19 less CodingStyle errors. I'm also adding both comments and the SOB's for
20 both patches, since they are both interesting}
21
22 Suresh Siddha commented:
23
24 Alexey Fisher reported:
25
26 > resource map sanity check conflict: 0xcfeff800 0xcff007ff 0xcfe00000
27 > 0xcfefffff PCI Bus 0000:01
28
29 BAR base is located in the middle of the 4K page and the hardcoded
30 size argument makes the request span two pages causing the conflict.
31
32 Fix the hard coded size argument in ioremap().
33
34 Andy Burns commented:
35
36 I have already sent this patch on the linux-dvb list, but it didn't get
37 much attention, so re-sending direct, I hope you all don't mind.
38
39 While attempting to run mythtv in a xen domU, I encountered problems
40 loading the driver for my saa7134 card, with an error from ioremap().
41
42 This error was due to the driver allocating an incorrectly sized mmio
43 area, which was trapped by xen's permission checks, but this would go
44 un-noticed on a kernel without xen.
45
46 My card has a 1K sized mmio area, I've had information that other cards
47 have 2K areas, perhaps others have different sizes, yet the driver
48 always attempts to map 4K. I realise that the granularity of mapping is
49 the page size, which typically would be 4K, but unless the card's base
50 address happens to fall on a 4K boundary (mine does not) then the
51 base+4K will end up spanning two pages, and this is when the error
52 occurs under xen.
53
54 My patch uses the pci_resource_len macro to determine the size required
55 for the user's particular card, instead of the hardcoded 4K value. I've
56 tested with a couple of printk() inside ioremap() that the start address
57 and size do get rounded to the closest page boundary.
58
59 With this patch I am able to successfully load the saa7134 driver and
60 run mythtv under xen with my card, subject to correct pollirq settings
61 in case of shared IRQ, I am still seeing occasional DMA panics, which I
62 think are related to swiotlb handling by dom0/domU, usually the panic
63 occurs when changing mux, once tuned to a mux, 12 hour continuous
64 recordings are possible without errors.
65
66 Reported-by: Alexey Fisher <bug-track@fisher-privat.net>
67
68 Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
69 Signed-off-by: Andy Burns <andy@burns.net>
70 Tested-by: Alexey Fisher <bug-track@fisher-privat.net>
71 Signed-off-by: Ingo Molnar <mingo@elte.hu>
72 Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
73 Acked-by: Brandon Philips <bphilips@suse.de>
74
75
76 ---
77 drivers/media/video/saa7134/saa7134-core.c | 3 ++-
78 1 file changed, 2 insertions(+), 1 deletion(-)
79
80 Index: linux-2.6.27-SL111_BRANCH/drivers/media/video/saa7134/saa7134-core.c
81 ===================================================================
82 --- linux-2.6.27-SL111_BRANCH.orig/drivers/media/video/saa7134/saa7134-core.c
83 +++ linux-2.6.27-SL111_BRANCH/drivers/media/video/saa7134/saa7134-core.c
84 @@ -965,7 +965,8 @@ static int __devinit saa7134_initdev(str
85 dev->name,(unsigned long long)pci_resource_start(pci_dev,0));
86 goto fail1;
87 }
88 - dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
89 + dev->lmmio = ioremap(pci_resource_start(pci_dev, 0),
90 + pci_resource_len(pci_dev, 0));
91 dev->bmmio = (__u8 __iomem *)dev->lmmio;
92 if (NULL == dev->lmmio) {
93 err = -EIO;