Guest User

qemu-kvm passthrough

a guest
Mar 29th, 2010
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.38 KB | None | 0 0
  1. --------
  2.  
  3. qemu-kvm complete command line:
  4.  
  5. qemu-kvm -usbdevice tablet -net nic,macaddr=52:54:00:00:00:01,model=virtio -net tap,ifname=tap0 -vnc :1 -smp 2 -m 2048 -cdrom /data/server/Linux/mythbuntu-9.10-desktop-amd64.iso -drive file=/data/virtualization/01_Mythbuntu.img,if=virtio,boot=on -boot c -localtime -daemonize -pcidevice host=02:01.0 -pcidevice host=02:01.1 -pcidevice host=02:01.2 -pcidevice host=02:01.3 -monitor unix:/var/run/kvm/01.socket,server,nowait -k da
  6. --------
  7.  
  8. uname -a on host
  9.  
  10. Linux mediaserver 2.6.32-ARCH #1 SMP PREEMPT Fri Mar 26 02:03:53 CET 2010 x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux
  11.  
  12. Exact kernel version is 2.6.32.10.
  13.  
  14. --------
  15.  
  16. lspci -v on host, only for the USB PCI card:
  17.  
  18. 02:01.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10 [OHCI])
  19. Subsystem: ALi Corporation ASRock 939Dual-SATA2 Motherboard
  20. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 18
  21. Memory at e9400000 (32-bit, non-prefetchable) [size=4K]
  22. Capabilities: [60] Power Management version 2
  23. Kernel driver in use: pci-stub
  24. Kernel modules: ohci-hcd
  25.  
  26. 02:01.1 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10 [OHCI])
  27. Subsystem: ALi Corporation ASRock 939Dual-SATA2 Motherboard
  28. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 16
  29. Memory at e9401000 (32-bit, non-prefetchable) [size=4K]
  30. Capabilities: [60] Power Management version 2
  31. Kernel driver in use: pci-stub
  32. Kernel modules: ohci-hcd
  33.  
  34. 02:01.2 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10 [OHCI])
  35. Subsystem: ALi Corporation ASRock 939Dual-SATA2 Motherboard
  36. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 20
  37. Memory at e9402000 (32-bit, non-prefetchable) [size=4K]
  38. Capabilities: [60] Power Management version 2
  39. Kernel driver in use: pci-stub
  40. Kernel modules: ohci-hcd
  41.  
  42. 02:01.3 USB Controller: ALi Corporation USB 2.0 Controller (rev 01) (prog-if 20 [EHCI])
  43. Subsystem: Device 2020:8888
  44. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 19
  45. Memory at e9403000 (32-bit, non-prefetchable) [size=256]
  46. Capabilities: [50] Power Management version 2
  47. Capabilities: [58] Debug port: BAR=1 offset=0090
  48. Kernel driver in use: pci-stub
  49. Kernel modules: ehci-hcd
  50. --------
  51.  
  52. Commands on host used to prepare PCI USB card:
  53.  
  54. echo "10b9 5237" > /sys/bus/pci/drivers/pci-stub/new_id
  55. echo "0000:02:01.0" > /sys/bus/pci/drivers/ohci_hcd/unbind
  56. echo "0000:02:01.1" > /sys/bus/pci/drivers/ohci_hcd/unbind
  57. echo "0000:02:01.2" > /sys/bus/pci/drivers/ohci_hcd/unbind
  58. echo "0000:02:01.0" > /sys/bus/pci/drivers/pci-stub/bind
  59. echo "0000:02:01.1" > /sys/bus/pci/drivers/pci-stub/bind
  60. echo "0000:02:01.2" > /sys/bus/pci/drivers/pci-stub/bind
  61. echo "10b9 5237" > /sys/bus/pci/drivers/pci-stub/remove_id
  62.  
  63. echo "10b9 5239" > /sys/bus/pci/drivers/pci-stub/new_id
  64. echo "0000:02:01.3" > /sys/bus/pci/drivers/ehci_hcd/unbind
  65. echo "0000:02:01.3" > /sys/bus/pci/drivers/pci-stub/bind
  66. echo "10b9 5239" > /sys/bus/pci/drivers/pci-stub/remove_id
  67. --------
  68.  
  69. Starting qemu-kvm 0.12.3 (fails):
  70.  
  71. device: 02:01.0: driver="pci-assign" host="02:01.0"
  72. device: 02:01.1: driver="pci-assign" host="02:01.1"
  73. device: 02:01.2: driver="pci-assign" host="02:01.2"
  74. device: 02:01.3: driver="pci-assign" host="02:01.3"
  75. Unable to assign device: PCI region 0 at address 0xe9403000 has size 0x100, which is not a multiple of 4K
  76. Error initializing device pci-assign
  77. --------
  78.  
  79. Starting qemu-kvm git (succeeds):
  80.  
  81. device: 02:01.0: driver="pci-assign" host="02:01.0"
  82. device: 02:01.1: driver="pci-assign" host="02:01.1"
  83. device: 02:01.2: driver="pci-assign" host="02:01.2"
  84. device: 02:01.3: driver="pci-assign" host="02:01.3"
  85. PCI region 0 at address 0xe9403000 has size 0x100, which is not a multiple of 4K. You might experience some performance hit due to that.
  86. --------
  87.  
  88. lspci -v in guest with qemu-kvm git (seems fine?):
  89.  
  90. 00:05.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10)
  91. Subsystem: ALi Corporation USB 1.1 Controller
  92. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 10
  93. Memory at f2041000 (32-bit, non-prefetchable) [size=4K]
  94. Kernel driver in use: ohci_hcd
  95.  
  96. 00:06.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10)
  97. Subsystem: ALi Corporation USB 1.1 Controller
  98. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 11
  99. Memory at f2042000 (32-bit, non-prefetchable) [size=4K]
  100. Kernel driver in use: ohci_hcd
  101.  
  102. 00:07.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03) (prog-if 10)
  103. Subsystem: ALi Corporation USB 1.1 Controller
  104. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 10
  105. Memory at f2043000 (32-bit, non-prefetchable) [size=4K]
  106. Kernel driver in use: ohci_hcd
  107.  
  108. 00:08.0 USB Controller: ALi Corporation USB 2.0 Controller (rev 01) (prog-if 20)
  109. Subsystem: Device 2020:8888
  110. Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 11
  111. Memory at f2044000 (32-bit, non-prefetchable) [size=256]
  112. Kernel driver in use: ehci_hcd
  113.  
  114. --------
  115.  
  116. dmesg in guest when inserting a DVB-T USB tuner into the PCI USB card:
  117.  
  118. [ 190.900076] usb 1-6: new high speed USB device using ehci_hcd and address 2
  119. [ 191.223314] usb 1-6: configuration #1 chosen from 1 choice
  120. [ 191.505921] dvb-usb: found a 'Intel CE9500 reference design' in warm state.
  121. [ 191.523481] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
  122. [ 191.537924] DVB: registering new adapter (Intel CE9500 reference design)
  123. [ 191.647202] DVB: registering adapter 0 frontend 0 (Zarlink ZL10353 DVB-T)...
  124. [ 191.716542] MXL5005S: Attached at address 0xc6
  125. [ 191.719948] dvb-usb: Intel CE9500 reference design successfully initialized and connected.
  126. [ 191.719989] usbcore: registered new interface driver dvb_usb_ce6230
  127.  
  128. So far, so good...I'm actually able to scan and find channels with this USB tuner, but once I try to actually watch a channel, it'll only give me garbage, eg. artifacts. Probably at the same time the following message is written to the host:
  129.  
  130. irq 19: nobody cared (try booting with the "irqpoll" option)
  131. Pid: 0, comm: swapper Not tainted 2.6.32-ARCH #1
  132. Call Trace:
  133. <IRQ> [<ffffffff810ab7ee>] ? __report_bad_irq+0x1e/0x90
  134. [<ffffffff810ab9eb>] ? note_interrupt+0x18b/0x1d0
  135. [<ffffffff810ac2fd>] ? handle_fasteoi_irq+0xcd/0xf0
  136. [<ffffffff810153e5>] ? handle_irq+0x15/0x20
  137. [<ffffffff81014902>] ? do_IRQ+0x62/0xe0
  138. [<ffffffff81012a53>] ? ret_from_intr+0x0/0x11
  139. <EOI> [<ffffffff81033d22>] ? native_safe_halt+0x2/0x10
  140. [<ffffffffa01d2233>] ? acpi_idle_enter_c1+0x9b/0x112 [processor]
  141. [<ffffffff81285342>] ? menu_select+0x102/0x290
  142. [<ffffffff8128422f>] ? cpuidle_idle_call+0x9f/0x170
  143. [<ffffffff81011202>] ? cpu_idle+0xb2/0x110
  144. [<ffffffff81516d33>] ? start_kernel+0x3c6/0x3d1
  145. [<ffffffff81516430>] ? x86_64_start_kernel+0xfd/0x10c
  146. handlers:
  147. [<ffffffffa009a7f0>] (usb_hcd_irq+0x0/0x80 [usbcore])
  148. Disabling IRQ #19
  149.  
  150. ...after which the PCI USB card stops working in the guest. Is this issue related to the issue the other person had? I'm more than willing to help out with testing, if you or another developer are interested in fixing this passthrough support.
  151.  
  152. Thanks :)
  153.  
  154. Best Regards
  155. Kenni Lund
Add Comment
Please, Sign In to add comment