[fedora-virt] USB passthrough

Mark McLoughlin markmc at redhat.com
Mon Jun 29 10:19:53 UTC 2009


At FUDCon yesterday, Paul asked me about how to get KVM USB device
passthrough working and I had to admit I'd never tried it.

So, after some poking with F-11, here's what I found:

  1) You need selinux-policy-targeted-3.6.12-55.fc11 or later

  2) Make sure the virt_use_usb SELinux boolean is enabled, which it
     should be by default:

       $> getsebool virt_use_usb
       virt_use_usb --> on
       $> setsebool -P virt_use_usb on

  3) Plug your device in, and if it's a USB mass storage device, make
     sure it's not mounted in the host

  4) In virt-manager, open the VM window, go to the details tap,
     clock 'Add hardware', select 'Phyiscal host device', choose
     'USB device', then the device you wish to passthrough

  5) Take a peek at the device in the guest XML config

       $> virsh dumpxml xp
         <hostdev mode='subsystem' type='usb' managed='yes'>
             <vendor id='0x0dda'/>
             <product id='0x0001'/>

  6) Start the guest and check whether the guest can see it. If not,
     check /var/log/libvirt/qemu/$guest.log because qemu will happily
     start up even if the device cannot be assigned.

  7) It sucks that the device has to be plugged in before you start
     the guest; qemu now has a "autoconnect" mode which probably
     makes sense for libvirt to use by default, see bug #508645


More information about the Fedora-virt mailing list