[fedora-virt] USB devices get reset a few seconds after attaching them to guest and then get binded to host

Stewart Adam maillist at diffingo.com
Fri Jan 3 00:39:44 UTC 2014


On 2013-12-30 11:33 AM, Richard W.M. Jones wrote:
> On Mon, Dec 30, 2013 at 11:03:23AM -0500, Stewart Adam wrote:
>> I'm using libvirt & virt-manager as well as 'virsh attach-device'
>> from the command line, so if I am not mistaken this is QEMU's host
>> USB passthrough.
>
> Once you get back to using just USB passthrough it's helpful to dump
> out the entire domain XML, ie:
>
> sudo virsh dumpxml the_guest
>
> Also the full qemu command line.  Look for a file called
> /var/log/libvirt/qemu/the_guest.log or $HOME/.cache/libvirt/qemu/log/the_guest.log.
>
> In both cases send the complete XML and complete command line to the
> list.
>
> Rich.
>
Hi Rich,

Included below is the information requested. The command-line options are 
not typical of a VM generated using virt-manager since I am running VFIO 
with VGA passthrough, so I had to customize the QEMU arguments a bit as well 
as use Q35 machine type.

###
### Domain XML dump
###

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
   <name>windows7</name>
   <uuid>07478ac0-6a99-11e3-8266-00259086c7d9</uuid>
   <memory unit='KiB'>6291456</memory>
   <currentMemory unit='KiB'>6291456</currentMemory>
   <memoryBacking>
     <nosharepages/>
     <locked/>
   </memoryBacking>
   <vcpu placement='static'>6</vcpu>
   <cputune>
     <vcpupin vcpu='0' cpuset='1,5'/>
     <vcpupin vcpu='1' cpuset='2,6'/>
     <vcpupin vcpu='2' cpuset='3,7'/>
     <vcpupin vcpu='3' cpuset='1,5'/>
     <vcpupin vcpu='4' cpuset='2,6'/>
     <vcpupin vcpu='5' cpuset='3,7'/>
   </cputune>
   <resource>
     <partition>/machine</partition>
   </resource>
   <os>
     <type arch='x86_64' machine='pc-q35-1.5'>hvm</type>
     <boot dev='hd'/>
     <smbios mode='host'/>
   </os>
   <features>
     <acpi/>
     <apic/>
   </features>
   <cpu mode='custom' match='exact'>
     <model fallback='allow'>Haswell</model>
     <vendor>Intel</vendor>
     <topology sockets='1' cores='3' threads='2'/>
     <feature policy='require' name='abm'/>
     <feature policy='require' name='pdpe1gb'/>
     <feature policy='require' name='rdrand'/>
     <feature policy='require' name='f16c'/>
     <feature policy='require' name='osxsave'/>
     <feature policy='require' name='pdcm'/>
     <feature policy='require' name='xtpr'/>
     <feature policy='require' name='tm2'/>
     <feature policy='require' name='est'/>
     <feature policy='require' name='smx'/>
     <feature policy='require' name='vmx'/>
     <feature policy='require' name='ds_cpl'/>
     <feature policy='require' name='monitor'/>
     <feature policy='require' name='dtes64'/>
     <feature policy='require' name='pbe'/>
     <feature policy='require' name='tm'/>
     <feature policy='require' name='ht'/>
     <feature policy='require' name='ss'/>
     <feature policy='require' name='acpi'/>
     <feature policy='require' name='ds'/>
     <feature policy='require' name='vme'/>
   </cpu>
   <clock offset='localtime'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-kvm</emulator>
     <disk type='block' device='cdrom'>
       <driver name='qemu' type='raw'/>
       <target dev='sdb' bus='sata'/>
       <readonly/>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </disk>
     <disk type='block' device='disk'>
       <driver name='qemu' type='raw' cache='none' io='native'/>
       <source dev='/dev/fedora/windows'/>
       <target dev='vda' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x03' 
function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/data/vm/windows-storage.img'/>
       <target dev='vdb' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x04' 
function='0x0'/>
     </disk>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' 
function='0x2'/>
     </controller>
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' 
function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
       <address type='pci' domain='0x0000' bus='0x01' slot='0x01' 
function='0x0'/>
     </controller>
     <controller type='usb' index='0' model='ich9-ehci1'>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x01' 
function='0x7'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci1'>
       <master startport='0'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x01' 
function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci2'>
       <master startport='2'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x01' 
function='0x1'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci3'>
       <master startport='4'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x01' 
function='0x2'/>
     </controller>
     <interface type='network'>
       <mac address='52:54:00:e3:f9:47'/>
       <source network='default'/>
       <model type='rtl8139'/>
       <rom bar='off'/>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x02' 
function='0x0'/>
     </interface>
     <hostdev mode='subsystem' type='usb' managed='yes'>
       <source>
         <vendor id='0x046d'/>
         <product id='0xc066'/>
       </source>
     </hostdev>
     <hostdev mode='subsystem' type='usb' managed='yes'>
       <source>
         <vendor id='0x1532'/>
         <product id='0x010d'/>
       </source>
     </hostdev>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x05' 
function='0x0'/>
     </memballoon>
   </devices>
   <qemu:commandline>
     <qemu:arg value='-device'/>
     <qemu:arg 
value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
     <qemu:arg value='-device'/>
     <qemu:arg 
value='vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on'/>
     <qemu:arg value='-device'/>
     <qemu:arg value='vfio-pci,host=01:00.1,bus=pcie.0'/>
     <qemu:arg value='-device'/>
     <qemu:arg value='vfio-pci,host=00:19.0,bus=pcie.0'/>
     <qemu:arg value='-device'/>
     <qemu:arg value='vfio-pci,host=00:1b.0,bus=pcie.0'/>
     <qemu:arg value='-bios'/>
     <qemu:arg value='/usr/share/qemu/bios.bin'/>
   </qemu:commandline>
</domain>

###
### Command-line
###

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name windows7 -S -machine 
pc-q35-1.5,accel=kvm,usb=off,mem-merge=off -cpu 
Haswell,+abm,+pdpe1gb,+rdrand,+f16c,+osxsave,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme 
-m 6144 -realtime mlock=on -smp 6,sockets=1,cores=3,threads=2 -uuid 
07478ac0-6a99-11e3-8266-00259086c7d9 -smbios type=0,vendor=American 
Megatrends Inc.,version=1.1,date=08/13/2013,release=4.6 -smbios 
type=1,manufacturer=Supermicro,product=X10SAE,version=0123456789,serial=0123456789,sku=To 
be filled by O.E.M.,family=To be filled by O.E.M. -nographic -no-user-config 
-nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/windows7.monitor,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime 
-no-shutdown -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 -device 
pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 -device 
ich9-usb-ehci1,id=usb,bus=pci.2,addr=0x1.0x7 -device 
ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.2,multifunction=on,addr=0x1 
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.2,addr=0x1.0x1 
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.2,addr=0x1.0x2 
-drive if=none,media=cdrom,id=drive-sata0-0-1,readonly=on,format=raw -device 
ide-cd,bus=ide.1,drive=drive-sata0-0-1,id=sata0-0-1 -drive 
file=/dev/fedora/windows,if=none,id=drive-virtio-disk0,format=raw,cache=none,aio=native 
-device 
virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
-drive 
file=/data/vm/windows-storage.img,if=none,id=drive-virtio-disk1,format=raw 
-device 
virtio-blk-pci,scsi=off,bus=pci.2,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 
-netdev tap,fd=23,id=hostnet0 -device 
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:e3:f9:47,bus=pci.2,addr=0x2,rombar=0 
-device usb-host,hostbus=3,hostaddr=2,id=hostdev0 -device 
usb-host,hostbus=3,hostaddr=4,id=hostdev1 -device 
virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 -device 
ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on 
-device vfio-pci,host=01:00.1,bus=pcie.0 -device 
vfio-pci,host=00:19.0,bus=pcie.0 -device vfio-pci,host=00:1b.0,bus=pcie.0 
-bios /usr/share/qemu/bios.bin

Regards,
Stewart


More information about the virt mailing list