Need help in debugging PCI Passthrough


#1

Hi All.

I was wondering if anyone has gotten this setup to work, if so PLEASE HELP!.
Im getting errrors when trying to feed the HVR-4000 PCI card to the mythtv
guest system.

Here are my logs:

dmesg | grep IOMMU:
0.000000] Intel-IOMMU: disable GFX device mapping
0.028479] IOMMU fed90000: ver 1:0 cap c9008020e30272 ecap 1000
0.028486] IOMMU fed91000: ver 1:0 cap c0000020630272 ecap 1000
0.028492] IOMMU fed92000: ver 1:0 cap c0000020630272 ecap 1000
0.028497] IOMMU fed93000: ver 1:0 cap c9008020630272 ecap 1000
0.342618] IOMMU 0xfed92000: using Register based invalidation
0.342620] IOMMU 0xfed90000: using Register based invalidation
0.342621] IOMMU 0xfed93000: using Register based invalidation
0.342625] IOMMU: Setting RMRR:
0.342635] IOMMU: Setting identity map for device 0000:00:1d.0
[0xcdbf0000 - 0xcdc00000]
0.342660] IOMMU: Setting identity map for device 0000:00:1d.1
[0xcdbf0000 - 0xcdc00000]
0.342683] IOMMU: Setting identity map for device 0000:00:1d.2
[0xcdbf0000 - 0xcdc00000]
0.342702] IOMMU: Setting identity map for device 0000:00:1d.7
[0xcdbf0000 - 0xcdc00000]
0.342721] IOMMU: Setting identity map for device 0000:00:1a.0
[0xcdbf0000 - 0xcdc00000]
0.342741] IOMMU: Setting identity map for device 0000:00:1a.1
[0xcdbf0000 - 0xcdc00000]
0.342762] IOMMU: Setting identity map for device 0000:00:1a.2
[0xcdbf0000 - 0xcdc00000]
0.342782] IOMMU: Setting identity map for device 0000:00:1a.7
[0xcdbf0000 - 0xcdc00000]
0.342796] IOMMU: Prepare 0-16MiB unity mapping for LPC
0.342804] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 -
0x1000000]

dmesg | grep DMAR
0.000000] ACPI: DMAR 00000000cdbe9b00 00120 (v01 IntelR AWRDACPI
322E3030 DRWA 00000002)
0.028472] DMAR: Host address width 36
0.028474] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
0.028481] DMAR: DRHD base: 0x000000fed91000 flags: 0x0
0.028488] DMAR: DRHD base: 0x000000fed92000 flags: 0x0
0.028494] DMAR: DRHD base: 0x000000fed93000 flags: 0x1
0.028499] DMAR: RMRR base: 0x000000cdbf0000 end: 0x000000cdbfffff
0.028501] DMAR: RMRR base: 0x000000cdd00000 end: 0x000000cfffffff

This should be fine I think. The system should be ready for PCI Passthrough.

This is my /proc/interrupts:
CPU0 CPU1
0: 26 1 IO-APIC-edge timer
1: 2 0 IO-APIC-edge i8042
6: 1 2 IO-APIC-edge floppy
8: 1 0 IO-APIC-edge rtc0
9: 0 0 IO-APIC-fasteoi acpi
16: 31 30 IO-APIC-fasteoi uhci_hcd:usb3, pata_jmicron
18: 1 1 IO-APIC-fasteoi ehci_hcd:usb1, uhci_hcd:usb5,
uhci_hcd:usb8
19: 1258 3001 IO-APIC-fasteoi ata_piix, ata_piix,
uhci_hcd:usb7, eth1
21: 113 103 IO-APIC-fasteoi uhci_hcd:usb4
22: 73 73 IO-APIC-fasteoi HDA Intel
23: 0 0 IO-APIC-fasteoi ehci_hcd:usb2, uhci_hcd:usb6
24: 8935 0 HPET_MSI-edge hpet2
25: 0 6991 HPET_MSI-edge hpet3
28: 0 0 DMAR_MSI-edge dmar2
29: 0 0 DMAR_MSI-edge dmar0
30: 0 0 DMAR_MSI-edge dmar3
32: 6244 17 PCI-MSI-edge i915
NMI: 0 0 Non-maskable interrupts
LOC: 21 4 Local timer interrupts
SPU: 0 0 Spurious interrupts
PMI: 0 0 Performance monitoring interrupts
PND: 0 0 Performance pending work
RES: 62816 62240 Rescheduling interrupts
CAL: 22 64 Function call interrupts
TLB: 6506 6429 TLB shootdowns
TRM: 0 0 Thermal event interrupts
THR: 0 0 Threshold APIC interrupts
MCE: 0 0 Machine check exceptions
MCP: 3 3 Machine check polls
ERR: 1
MIS: 0

As you can see, nothing on IRQ 12. It is not shown because none of the tuner
modules are loaded. It uses IRQ 12, see below:

02:00.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3
PCI Video and Audio Decoder (rev 05)
Subsystem: Hauppauge computer works Inc. Device 6902
Flags: bus master, medium devsel, latency 32, IRQ 12
Memory at f1000000 (32-bit, non-prefetchable) [size=16]
Capabilities:
Kernel modules: cx8800

02:00.1 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI
Video and Audio Decoder [Audio Port] (rev 05)
Subsystem: Hauppauge computer works Inc. Device 6902
Flags: bus master, medium devsel, latency 32, IRQ 12
Memory at f2000000 (32-bit, non-prefetchable) [size=16]
Capabilities:
Kernel modules: cx88-alsa

02:00.2 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI
Video and Audio Decoder [MPEG Port] (rev 05)
Subsystem: Hauppauge computer works Inc. Device 6902
Flags: bus master, medium devsel, latency 32, IRQ 12
Memory at f3000000 (32-bit, non-prefetchable) [size=16]
Capabilities:
Kernel modules: cx8802

02:00.4 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI
Video and Audio Decoder [IR Port] (rev 05)
Subsystem: Hauppauge computer works Inc. Device 6902
Flags: bus master, medium devsel, latency 32, IRQ 12
Memory at f4000000 (32-bit, non-prefetchable) [size=16]
Capabilities:

When the modules were loaded for the card, the card was given IRQ 20, and
this was what it showed:
PCI INT A -> GSI 20 (level, low) -> IRQ 20

This makes me wonder, if its the PCI INT A, that cant be shared? When I run
a dmesg | grep “INT A” now i get:
0.337870] pci 0000:00:1c.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
0.358063] pata_acpi 0000:01:00.0: PCI INT A -> GSI 16 (level, low) ->
IRQ 16
0.358086] pata_acpi 0000:01:00.0: PCI INT A disabled
0.380221] ehci_hcd 0000:00:1d.7: PCI INT A -> GSI 23 (level, low) ->
IRQ 23
0.400228] uhci_hcd 0000:00:1a.0: PCI INT A -> GSI 16 (level, low) ->
IRQ 16
0.400742] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 23 (level, low) ->
IRQ 23
7.898290] r8169 0000:02:01.0: PCI INT A -> GSI 19 (level, low) -> IRQ
19
7.951792] pata_jmicron 0000:01:00.0: PCI INT A -> GSI 16 (level, low)
-> IRQ 16
7.975156] i915 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
8.252234] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) ->
IRQ 22

There is a lot of PCI INT A’s, and if its them that cant be shared im lost!
The GSI 12 or GSI 20 is not used, so this is not a issue.

The last thing to show is the lspci -t:
-[0000:00]-±00.0
±02.0
±02.1
±03.0
±03.2
±03.3
±1a.0
±1a.1
±1a.2
±1a.7
±1b.0
±1c.0-[0000:01]----00.0
±1d.0
±1d.1
±1d.2
±1d.7
±1e.0-[0000:02]–±00.0
| ±00.1
| ±00.2
| ±00.4
| -01.0
±1f.0
±1f.2
±1f.3
-1f.5
I dont know how to read this log?

However when I then do the kvm stuff:

lspci -n
02:00.0 0400: 14f1:8800 (rev 05)
02:00.1 0480: 14f1:8811 (rev 05)
02:00.2 0480: 14f1:8802 (rev 05)
02:00.4 0480: 14f1:8804 (rev 05)

echo “14f1 8800” > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:02:00.0 > /sys/bus/pci/devices/0000:02:00.0/driver/unbind
echo 0000:02:00.0 > /sys/bus/pci/drivers/pci-stub/bind

echo “14f1 8811” > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:02:00.1 > /sys/bus/pci/devices/0000:02:00.1/driver/unbind
echo 0000:02:00.1 > /sys/bus/pci/drivers/pci-stub/bind

echo “14f1 8802” > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:02:00.2 > /sys/bus/pci/devices/0000:02:00.2/driver/unbind
echo 0000:02:00.2 > /sys/bus/pci/drivers/pci-stub/bind

echo “14f1 8804” > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:02:00.4 > /sys/bus/pci/devices/0000:02:00.4/driver/unbind
echo 0000:02:00.4 > /sys/bus/pci/drivers/pci-stub/bind

, this is the dmesg right after:
1113.446450] pci-stub 0000:02:00.0: claimed by stub
1113.446652] pci-stub 0000:02:00.0: claimed by stub
1113.446740] pci-stub 0000:02:00.1: claimed by stub
1113.446912] pci-stub 0000:02:00.1: claimed by stub
1113.446997] pci-stub 0000:02:00.2: claimed by stub
1113.447168] pci-stub 0000:02:00.2: claimed by stub
1113.447254] pci-stub 0000:02:00.4: claimed by stub
1113.447429] pci-stub 0000:02:00.4: claimed by stub

Every thing seems fine I think.

However, now only thing left is to start the virtual mythbuntu with the pci
card attached:
sudo qemu-system-x86_64 -m 512 -boot c -net none -hda
/home/administrator/VirtualMachines/mythbuntu.img -pcidevice host=02:00.0
-pcidevice host=02:00.1 -pcidevice host=02:00.2 -pcidevice host=02:00.4

This starts the up the machine, but in the terminal this error appears a
lot of times:
Failed to assign irq for “02:00.2”: Input/output error
Perhaps you are assigning a device that shares an IRQ with another device?
Failed to assign irq for “02:00.1”: Input/output error
Perhaps you are assigning a device that shares an IRQ with another device?
Failed to assign irq for “02:00.0”: Input/output error
Perhaps you are assigning a device that shares an IRQ with another device?

What I dont understand is why is this error happening, because I dont think
the IRQ is shared, but I honestly dont know…

Can someone see any problems from what I posted???

Regards
Ole[/size][/size][/size][/size]