[libvirt] USB pass-through only works after many disconnects at the beginning

Hi, I want to pass through a USB device to a KVM guest (Windows 2000). My host OS is a standard Fedora 10, 64 bit. However, the device is only passed to the guest when I use qemu monitor directly and only after several tries... The device has no Linux drivers ('AVM GmbH ISDN-Controller FRITZ!Card v2.0') so I think I don't have to tell the kernel not to use it. I have KVM 74 and tried initially with libvirt 0.5.1 so from what I read this should be ok. At first I added this to my domain xml via virsh: <hostdev mode='subsystem' type='usb'> <source> <vendor id='0x....'/> <product id='0x....'/> </source> </hostdev> However, the device did not turn up in the guest. Therefore I updated libvirt/-python 0.6.1 and python-virtinst from updates-testing and recompiled virt-manager 0.7 from F11 because I read that virt-manager 0.7 had some support for USB pass-through. Now I had some new UI, but it turned out that using that did not produce better results... After that I called qemu-kvm directly with '-usb -usbdevice host:...:...'. qemu produced this output on my terminal: husb: open device 2.9 husb: config #1 need -1 husb: 1 interfaces claimed for configuration -1 husb: grabbed usb device 2.9 husb: config #1 need 1 USBDEVFS_DISCONNECT: No such device husb: device 2.9 disconnected When I used qemu monitor to re-attach the device, something liek that happened (re-attached multiple times): husb: open device 2.11 husb: config #1 need -1 husb: 1 interfaces claimed for configuration -1 husb: grabbed usb device 2.11 husb: config #1 need 1 husb: 1 interfaces claimed for configuration 1 husb: config #1 need 1 USBDEVFS_DISCONNECT: No such device husb: config #1 need 1 USBDEVFS_DISCONNECT: No such device husb: config #1 need 1 USBDEVFS_DISCONNECT: No such device husb: device 2.11 disconnected ... Eventually (after several tries), the device was attached and no more disconnects happened. After that I could use the device as expected. However plain qemu is not what I would like to have. I read about 'virsh attach-device' so I tried to use my usb hostdev snippet but to no avail (even after 10s of tries). So how can I use USB pass through? Could this be Windows-related? Judging from all the other threads (like [1]) it should be really easy to use. fs [1] https://www.redhat.com/archives/libvir-list/2009-February/msg00387.html

On Sun, May 03, 2009 at 09:21:20PM +0200, Felix Schwarz wrote:
So how can I use USB pass through? Could this be Windows-related? Judging from all the other threads (like [1]) it should be really easy to use. Yes, it usually is. I had problems with older KVM as well. Try updating to 84 or 85. Cheers, -- Guido

Guido Günther schrieb:
On Sun, May 03, 2009 at 09:21:20PM +0200, Felix Schwarz wrote:
So how can I use USB pass through? Could this be Windows-related? Judging from all the other threads (like [1]) it should be really easy to use. Yes, it usually is. I had problems with older KVM as well. Try updating to 84 or 85.
Ah, thanks. Is there a kind of tutorial how to update kvm in Fedora manually? Is it as easy as recompiling the qemu package in F11 and installing the produced binaries? Or do I need to update my kernel (currently .27) as well? fs

On Sun, May 03, 2009 at 09:21:20PM +0200, Felix Schwarz wrote:
Hi,
I want to pass through a USB device to a KVM guest (Windows 2000). My host OS is a standard Fedora 10, 64 bit. However, the device is only passed to the guest when I use qemu monitor directly and only after several tries... The device has no Linux drivers ('AVM GmbH ISDN-Controller FRITZ!Card v2.0') so I think I don't have to tell the kernel not to use it.
I have KVM 74 and tried initially with libvirt 0.5.1 so from what I read this should be ok.
At first I added this to my domain xml via virsh: <hostdev mode='subsystem' type='usb'> <source> <vendor id='0x....'/> <product id='0x....'/> </source> </hostdev>
However, the device did not turn up in the guest.
That should be what you need from a libvirt POV, so I'm afraid you're probably hitting problems at the QEMU level instead.
So how can I use USB pass through? Could this be Windows-related? Judging from all the other threads (like [1]) it should be really easy to use.
I think best bet is to try updating to a newer KVM build - you ought to be able to pull in the 'qemu-system-x86' RPM from Fedora 11 into a F10 host without too many deps. That would let you see if newer KVM userspace fixed it (no need to update kernel - USB passthrough is purely a userspace issue) Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange schrieb:
I think best bet is to try updating to a newer KVM build - you ought to be able to pull in the 'qemu-system-x86' RPM from Fedora 11 into a F10 host without too many deps.
Unfortunately, this did not work as well and in addition running the VM was painfully slow (as if hardware acceleration was not used). In the syslog I found these messages: May 5 23:01:46 ws2 kernel: kvm: 7133: cpu0 unhandled wrmsr: 0xc0010117 data 0 May 5 23:01:46 ws2 kernel: kvm: 7133: cpu0 unhandled rdmsr: 0xc0010117 May 5 23:01:46 ws2 kernel: kvm: 7133: cpu0 unhandled rdmsr: 0xc0010117 So probably I need a newer kernel as well. But anyway even with the newer qemu from F11, I saw the same symptoms (disconnect, device not visible in guest). I guess I have to wait for F11 and check again. fs Btw: I took RPMs from F11 because compiling the src.rpms from F11 did not work out on F10 (see attachment for error messages). make[1]: Entering directory `/builddir/build/BUILD/qemu-kvm-0.10/qemu/sparc32plus-linux-user' install -m 755 qemu-sparc32plus "/builddir/build/BUILDROOT/qemu-0.10-15.fc10.x86_64/usr/bin" make[1]: Leaving directory `/builddir/build/BUILD/qemu-kvm-0.10/qemu/sparc32plus-linux-user' + chmod -x '/builddir/build/BUILDROOT/qemu-0.10-15.fc10.x86_64/usr/share/man/man1/*' chmod: cannot access `/builddir/build/BUILDROOT/qemu-0.10-15.fc10.x86_64/usr/share/man/man1/*': No such file or directory
participants (3)
-
Daniel P. Berrange
-
Felix Schwarz
-
Guido Günther