[vfio-users] USB passthrough failing on ovmf

Doug Applegate doug.applegate at gmail.com
Fri Dec 4 05:21:45 UTC 2015


Hey, just recently got a setup where I'm doing GPU passthrough using
OVFM and Windows 10. Many thanks to Alex and his blog :)

I have a few little 'quirks' that are annoying that I'd like to
resolve and hoping that maybe someone had similar issues knows how to
fix it.

I've got my Windows 10 guest set up and configure USB passthrough for
my mouse and keyboard. However, I can never seem to get it to pass
through on guest startup.  It seems that it works when it first starts
to boot, but then it'll lose it as soon as windows boots.  I have to
remove the USB device and re-add it through virt-manager to get it
working again.  Is there a good way to fix this?  I'm using Fedora 23
host and selinux is set to permissive.

Here's my XML config:

<domain type='kvm'>
  <name>doug-win</name>
  <uuid>563d39d7-c5d8-4f62-b72a-6831f16f3bfc</uuid>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <hugepages/>
  </memoryBacking>
  <vcpu placement='static' cpuset='1-3,5-7' current='6'>8</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.4'>hvm</type>
    <loader readonly='yes'
type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/doug-win_VARS.fd</nvram>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <hidden state='on'/>
    </kvm>
    <vmport state='off'/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/var/lib/libvirt/images/doug-win.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/mapper/sdx'/>
      <target dev='sdb' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ae:85:ff'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
    </interface>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x045e'/>
        <product id='0x00db'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc249'/>
      </source>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
function='0x0'/>
    </memballoon>
  </devices>
</domain>

The resulting qemu cdommand:
/usr/bin/qemu-system-x86_64
-machine accel=kvm
-name doug-win
-S
-machine pc-i440fx-2.4,accel=kvm,usb=off,vmport=off
-cpu host,kvm=off
-drive file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd,if=pflash,format=raw,unit=0,readonly=on
-drive file=/var/lib/libvirt/qemu/nvram/doug-win_VARS.fd,if=pflash,format=raw,unit=1
-m 8192
-mem-prealloc
-mem-path /dev/hugepages/libvirt/qemu
-realtime mlock=off
-smp 6,maxcpus=8,sockets=1,cores=4,threads=2
-uuid 563d39d7-c5d8-4f62-b72a-6831f16f3bfc
-nographic
-no-user-config
-nodefaults
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/doug-win.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control
-rtc base=localtime,driftfix=slew
-global kvm-pit.lost_tick_policy=discard
-no-hpet
-no-shutdown
-global PIIX4_PM.disable_s3=1
-global PIIX4_PM.disable_s4=1
-boot menu=on,strict=on
-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x9.0x7
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x9
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x9.0x1
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x9.0x2
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3
-device ahci,id=sata0,bus=pci.0,addr=0x5
-drive file=/var/lib/libvirt/images/doug-win.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none,aio=native
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0
-drive file=/dev/mapper/sdx,if=none,id=drive-scsi0-0-0-1,format=raw,cache=none,aio=native
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1
-netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ae:85:ff,bus=pci.0,addr=0x2
-device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,multifunction=on,addr=0x4
-device vfio-pci,host=01:00.1,id=hostdev1,bus=pci.0,addr=0x6
-device usb-host,hostbus=1,hostaddr=14,id=hostdev2
-device usb-host,hostbus=1,hostaddr=15,id=hostdev3
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8
-msg timestamp=on




More information about the vfio-users mailing list