* [linux-dvb] saa7134 ioremap() problem
@ 2008-07-01 17:53 Andy Burns
2008-07-02 14:52 ` [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size Andy Burns
0 siblings, 1 reply; 9+ messages in thread
From: Andy Burns @ 2008-07-01 17:53 UTC (permalink / raw)
To: Linux DVB List
I have been using the saa7134.ko and saa7134_dvb.ko drivers for years as
part of my mythtv system, working very nicely.
Now I am trying to use xen to virtualise my mythtv-backend, with PCI
passthrough of the tuner to the virtual machine, everything hasn't gone
smoothly, but I believe I have found an issue within the driver which
would have gone un-noticed on a bare-metal machine, yet which causes a
problem under xen.
Here is what lspci -vvv shows for my card
08:01.0 Multimedia controller: Philips Semiconductors SAA7130 Video
Broadcast Decoder (rev 01)
Subsystem: Compro Technology, Inc. Videomate DVB-T200
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 64 (21000ns min, 8000ns max)
Interrupt: pin A routed to IRQ 17
Region 0: Memory at febffc00 (32-bit, non-prefetchable) [size=1K]
Capabilities: [40] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=1 PME-
Kernel modules: saa7134
Notice the MMIO area is 1K in size, but within the driver, it requests
mapping of a 4K area, rather than 1K.
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.25.y.git;a=blob;f=drivers/media/video/saa7134/saa7134-core.c;h=58ab163fdbd74e628e60655ea05c5d3bea611599;hb=HEAD#l998
Obviously the kernel will have to round the start/end addresses to the
nearest 4K boundaries as this is the granularity of page mapping, but if
the request is too large to begin with it attempts to map two pages,
straddling the card's physical address range, this works on a physical
machine, but fails under xen due to more rigourous checking/enforcement
of permissions.
I have rebuilt the driver module using 0x400 instead of 0x1000 for the
ioremap() size and the driver then loads, instead of failing (I still
have an interrupt problem but will follow that up separately).
If you'd like to follow the discussion I've been having on the xen-devel
list, Keir Fraser should be able to answer questions on why this fails
under xen far better than I can.
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00004.html
Could you comment on whether you'd accept a patch for this?
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread* [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-01 17:53 [linux-dvb] saa7134 ioremap() problem Andy Burns
@ 2008-07-02 14:52 ` Andy Burns
2008-07-02 15:12 ` Matthias Schwarzott
0 siblings, 1 reply; 9+ messages in thread
From: Andy Burns @ 2008-07-02 14:52 UTC (permalink / raw)
To: Linux DVB List
The saa7134 driver attempts to map 4K starting from the base address of
its mmio area, although lspci shows the size of the area is only 1K. The
excessive mapping goes un-noticed on bare-metal, but is detected and
denied when the card is used with pci passthrough to a xen domU. If
shared IRQ is used the "pollirq" kernel option may be required in dom0.
Signed-off-by: Andy Burns <andy@burns.net>
--- drivers/media/video/saa7134/saa7134-core.c.orig 2008-07-01
16:46:49.000000000 +0100
+++ drivers/media/video/saa7134/saa7134-core.c 2008-07-01
16:47:10.000000000 +0100
@@ -908,7 +908,7 @@
dev->name,(unsigned long
long)pci_resource_start(pci_dev,0));
goto fail1;
}
- dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
+ dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x400);
dev->bmmio = (__u8 __iomem *)dev->lmmio;
if (NULL == dev->lmmio) {
err = -EIO;
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 14:52 ` [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size Andy Burns
@ 2008-07-02 15:12 ` Matthias Schwarzott
2008-07-02 15:35 ` Andy Burns
0 siblings, 1 reply; 9+ messages in thread
From: Matthias Schwarzott @ 2008-07-02 15:12 UTC (permalink / raw)
To: linux-dvb
On Mittwoch, 2. Juli 2008, Andy Burns wrote:
> The saa7134 driver attempts to map 4K starting from the base address of
> its mmio area, although lspci shows the size of the area is only 1K. The
> excessive mapping goes un-noticed on bare-metal, but is detected and
> denied when the card is used with pci passthrough to a xen domU. If
> shared IRQ is used the "pollirq" kernel option may be required in dom0.
>
I have no real insight into the saa7134 core, but at least my card does have a
memory region of 2K.
lspci -vvnn:
00:0b.0 Multimedia controller [0480]: Philips Semiconductors SAA7133/SAA7135
Video Broadcast Decoder [1131:7133] (rev d1)
Subsystem: Avermedia Technologies Inc Device [1461:a7a1]
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 32 (63750ns min, 63750ns max)
Interrupt: pin A routed to IRQ 19
Region 0: Memory at dfffb800 (32-bit, non-prefetchable) [size=2K]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=3 PME-
Kernel driver in use: saa7134
Kernel modules: saa7134
Regards
Matthias
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 15:12 ` Matthias Schwarzott
@ 2008-07-02 15:35 ` Andy Burns
2008-07-02 15:50 ` Andy Burns
0 siblings, 1 reply; 9+ messages in thread
From: Andy Burns @ 2008-07-02 15:35 UTC (permalink / raw)
To: Linux DVB List
On 02/07/2008 16:12, Matthias Schwarzott wrote:
> I have no real insight into the saa7134 core, but at least my card does have a
> memory region of 2K.
Thanks, I only have one type of card, I'll try to investigate the best
way to programatically determine the size of the memory region and use
that instead of a hard-coded value, then resubmit a new patch.
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 15:35 ` Andy Burns
@ 2008-07-02 15:50 ` Andy Burns
2008-07-02 20:39 ` hermann pitton
0 siblings, 1 reply; 9+ messages in thread
From: Andy Burns @ 2008-07-02 15:50 UTC (permalink / raw)
To: Linux DVB List
The saa7134 driver attempts to map a fixed 4K starting from the base
address of its mmio area, regardless of the actual size of the area.
Any excessive mapping may extend past the end of a page, which goes
un-noticed on bare-metal, but is detected and denied when the card is
used with pci passthrough to a xen domU. If shared IRQ is used the
"pollirq" kernel option may be required in dom0.
Signed-off-by: Andy Burns <andy@burns.net>
---- drivers/media/video/saa7134/saa7134-core.c.orig 2008-07-01
16:46:49.000000000 +0100
+++ drivers/media/video/saa7134/saa7134-core.c 2008-07-02
16:41:37.000000000 +0100
@@ -908,7 +908,8 @@
dev->name,(unsigned long
long)pci_resource_start(pci_dev,0));
goto fail1;
}
- dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
+ dev->lmmio = ioremap(pci_resource_start(pci_dev,0),
+ pci_resource_len(pci_dev,0));
dev->bmmio = (__u8 __iomem *)dev->lmmio;
if (NULL == dev->lmmio) {
err = -EIO;
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 15:50 ` Andy Burns
@ 2008-07-02 20:39 ` hermann pitton
2008-07-02 21:00 ` Andy Burns
0 siblings, 1 reply; 9+ messages in thread
From: hermann pitton @ 2008-07-02 20:39 UTC (permalink / raw)
To: Andy Burns; +Cc: video4linux-list, Linux DVB List
Hello,
Am Mittwoch, den 02.07.2008, 16:50 +0100 schrieb Andy Burns:
> The saa7134 driver attempts to map a fixed 4K starting from the base
> address of its mmio area, regardless of the actual size of the area.
> Any excessive mapping may extend past the end of a page, which goes
> un-noticed on bare-metal, but is detected and denied when the card is
> used with pci passthrough to a xen domU. If shared IRQ is used the
> "pollirq" kernel option may be required in dom0.
just a note.
We have some recent remotes sampling from IRQs triggered by a gpio pin
without any additional IR chip.
There are some reports that "pollirq" makes them unusable, since
sensible timings are lost.
No such reports from xen stuff yet, but the same might happen with
shared IRQs and "pollirq" there too.
Cheers,
Hermann
> Signed-off-by: Andy Burns <andy@burns.net>
> ---- drivers/media/video/saa7134/saa7134-core.c.orig 2008-07-01
> 16:46:49.000000000 +0100
> +++ drivers/media/video/saa7134/saa7134-core.c 2008-07-02
> 16:41:37.000000000 +0100
> @@ -908,7 +908,8 @@
> dev->name,(unsigned long
> long)pci_resource_start(pci_dev,0));
> goto fail1;
> }
> - dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000);
> + dev->lmmio = ioremap(pci_resource_start(pci_dev,0),
> + pci_resource_len(pci_dev,0));
> dev->bmmio = (__u8 __iomem *)dev->lmmio;
> if (NULL == dev->lmmio) {
> err = -EIO;
>
>
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 20:39 ` hermann pitton
@ 2008-07-02 21:00 ` Andy Burns
2008-07-03 23:09 ` hermann pitton
0 siblings, 1 reply; 9+ messages in thread
From: Andy Burns @ 2008-07-02 21:00 UTC (permalink / raw)
To: Linux DVB List
On 02/07/2008 21:39, hermann pitton wrote:
> We have some recent remotes sampling from IRQs triggered by a gpio pin
> without any additional IR chip.
>
> There are some reports that "pollirq" makes them unusable, since
> sensible timings are lost.
Thanks for the info, not relevant for me though, the whole point of
virtualising my mythtv backend with xen is to stuff all the noisy bits
is a cupboard and have a separate frontend which does have a LiRC device.
> No such reports from xen stuff yet, but the same might happen with
> shared IRQs and "pollirq" there too.
After I'd sorted the mmio mapping issue, the driver loaded under xen,
but crashed after 40 seconds or so due to shared interrupt routing, so I
added the pollirq, I understand this might cause performance issues as
IRQs have to be delivered to multiple drivers in different xen domains,
particularly one of my PCI slots shares with a PCI-X slot which has my
8xSATA card in it, so I've avoided that slot for now, but would like to
have dual tuner again.
The driver is now working fairly well under xen, with a single tuner
mythbckend can record three concurrent streams from a mux, with under
10% CPU.
I have one remaining issue, which I will try to track down, every now
and then I seem to get a DMA error causing a kernel panic, my feeling is
it happens when retuning; perhaps some DMA transfer is in-flight when
something changes on the card and causes a problem? Or like the
ioremap() it might be something xen is more sensitive to than a
bare-metal machine.
Do I need to send my patch direct to Harmut Hackmann, or will he pick it
up from the list if he likes it?
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size
2008-07-02 21:00 ` Andy Burns
@ 2008-07-03 23:09 ` hermann pitton
0 siblings, 0 replies; 9+ messages in thread
From: hermann pitton @ 2008-07-03 23:09 UTC (permalink / raw)
To: Andy Burns, Hartmut Hackmann, Mauro Carvalho Chehab,
Gerd Hoffmann
Cc: Linux and Kernel Video, Linux DVB List
Hi,
Am Mittwoch, den 02.07.2008, 22:00 +0100 schrieb Andy Burns:
> On 02/07/2008 21:39, hermann pitton wrote:
>
> > We have some recent remotes sampling from IRQs triggered by a gpio pin
> > without any additional IR chip.
> >
> > There are some reports that "pollirq" makes them unusable, since
> > sensible timings are lost.
>
> Thanks for the info, not relevant for me though, the whole point of
> virtualising my mythtv backend with xen is to stuff all the noisy bits
> is a cupboard and have a separate frontend which does have a LiRC device.
>
> > No such reports from xen stuff yet, but the same might happen with
> > shared IRQs and "pollirq" there too.
>
> After I'd sorted the mmio mapping issue, the driver loaded under xen,
> but crashed after 40 seconds or so due to shared interrupt routing, so I
> added the pollirq, I understand this might cause performance issues as
> IRQs have to be delivered to multiple drivers in different xen domains,
> particularly one of my PCI slots shares with a PCI-X slot which has my
> 8xSATA card in it, so I've avoided that slot for now, but would like to
> have dual tuner again.
>
> The driver is now working fairly well under xen, with a single tuner
> mythbckend can record three concurrent streams from a mux, with under
> 10% CPU.
>
> I have one remaining issue, which I will try to track down, every now
> and then I seem to get a DMA error causing a kernel panic, my feeling is
> it happens when retuning; perhaps some DMA transfer is in-flight when
> something changes on the card and causes a problem? Or like the
> ioremap() it might be something xen is more sensitive to than a
> bare-metal machine.
>
> Do I need to send my patch direct to Harmut Hackmann, or will he pick it
> up from the list if he likes it?
>
that depends on the time he has, but if you think you have something
proper, always send a copy directly to Hartmut and Mauro too.
I'm not within any xen, but Gerd, the saa7134 author, is on it since
then. If you think it is xen specific, you might try to reach him too.
(kraxel@redhat.com)
Can't tell, if he has time for it currently.
Cheers,
Hermann
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* [linux-dvb] saa7134 ioremap() problem
@ 2008-09-27 13:26 Nick Fisk
0 siblings, 0 replies; 9+ messages in thread
From: Nick Fisk @ 2008-09-27 13:26 UTC (permalink / raw)
To: linux-dvb
Hi,
I also have a card based on the saa7134 chip and I am encountering the
same problem as described in this thread.
My card:-
00:01.0 Multimedia controller: Philips Semiconductors SAA7133/SAA7135
Video Broadcast Decoder (rev d1)
Subsystem: Avermedia Technologies Inc Unknown device 2c00
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Interrupt: pin A routed to IRQ 16
Region 0: Memory at febef800 (32-bit, non-prefetchable) [size=2K]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
I was wondering if this fix would be included in 2.6.27?
If there is any testing or other information that I can provide that
would help please let me know.
Nick
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-09-27 13:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-01 17:53 [linux-dvb] saa7134 ioremap() problem Andy Burns
2008-07-02 14:52 ` [linux-dvb] [PATCH] Shrink saa7134 mmio mapped size Andy Burns
2008-07-02 15:12 ` Matthias Schwarzott
2008-07-02 15:35 ` Andy Burns
2008-07-02 15:50 ` Andy Burns
2008-07-02 20:39 ` hermann pitton
2008-07-02 21:00 ` Andy Burns
2008-07-03 23:09 ` hermann pitton
-- strict thread matches above, loose matches on Subject: below --
2008-09-27 13:26 [linux-dvb] saa7134 ioremap() problem Nick Fisk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox