All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1792523] [NEW] usb passthrough not resetting on host after vm shutdown if started with -daemonize
@ 2018-09-14  6:54 Marshall Porter
  2018-09-14 15:48 ` [Qemu-devel] [Bug 1792523] " Alex Williamson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marshall Porter @ 2018-09-14  6:54 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Below is the full Qemu command used to launch the VM. Have been using
this same setup since Qemu 2.12, plus a couple of cherry picked patch
commits fixing ide-hd and e1000e in Windows guests. Both sets of patches
have now been merged to 3.0, so decided to update to 3.0.

The VM launches and runs fine, but after shutting down, the usb devices
that are passed through from the host (keyboard, mouse) do not work
until unplugged and plugged in again. Have narrowed this down to the
-daemonize -pidfile arguments.. if those lines are removed, usb devices
work in the host again right away after VM shutdown.

CPU: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
OS: Linux dev 4.18.6-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 5 11:54:09 UTC 2018 x86_64 GNU/Linux

Thank you for looking into this!


#!/usr/bin/env bash

echo vfio-pci > /sys/bus/pci/devices/0000:04:00.0/driver_override
echo 0000:04:00.0 > /sys/bus/pci/devices/0000:04:00.0/driver/unbind
echo 0000:04:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
echo > /sys/bus/pci/devices/0000:04:00.0/driver_override

/usr/bin/qemu-system-x86_64 \
-name winnt \
-daemonize \
-pidfile /run/vms/qemu/winnt.pid \
-boot menu=on \
-drive if=pflash,format=raw,readonly,file=/opt/vms/qemu/machines/ovmf_code_patched.fd \
-drive if=pflash,format=raw,file=/opt/vms/qemu/machines/winnt/ovmf_vars_patched.fd \
-machine pc-q35-3.0,accel=kvm \
-nodefaults \
-cpu host,kvm=off,hv_vendor_id=RedHat,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff \
-accel kvm \
-smp 4,sockets=1,cores=4,threads=1 \
-m 16G \
-nic bridge,br=br0,mac=52:54:00:12:34:77,model=e1000e \
-device vfio-pci,host=01:00.0,multifunction=on \
-device vfio-pci,host=01:00.1 \
-vga none \
-display none \
-monitor none \
-blockdev raw,node-name=ide-hd.0,cache.direct=on,discard=unmap,file.driver=host_device,file.aio=native,file.filename=/dev/disk/by-id/ata-WDC_WDS500G2B0A-00SM50_181265803048 \
-device ide-hd,drive=ide-hd.0,bus=ide.0,rotation_rate=1 \
-blockdev raw,node-name=ide-hd.1,cache.direct=on,file.driver=host_device,file.aio=native,file.filename=/dev/disk/by-id/ata-TOSHIBA_HDWE160_X746K8ZTF56D-part1 \
-device ide-hd,drive=ide-hd.1,bus=ide.1 \
-device vfio-pci,host=04:00.0 \
-device qemu-xhci \
-device usb-host,vendorid=0x04d9,productid=0x0171 \
-device usb-host,vendorid=0x1532,productid=0x005c \
-device usb-host,vendorid=0x1b1c,productid=0x0c09

echo 0000:04:00.0 > /sys/bus/pci/devices/0000:04:00.0/driver/unbind
echo 0000:04:00.0 > /sys/bus/pci/drivers_probe

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1792523

Title:
  usb passthrough not resetting on host after vm shutdown if started
  with -daemonize

Status in QEMU:
  New

Bug description:
  Below is the full Qemu command used to launch the VM. Have been using
  this same setup since Qemu 2.12, plus a couple of cherry picked patch
  commits fixing ide-hd and e1000e in Windows guests. Both sets of
  patches have now been merged to 3.0, so decided to update to 3.0.

  The VM launches and runs fine, but after shutting down, the usb
  devices that are passed through from the host (keyboard, mouse) do not
  work until unplugged and plugged in again. Have narrowed this down to
  the -daemonize -pidfile arguments.. if those lines are removed, usb
  devices work in the host again right away after VM shutdown.

  CPU: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
  OS: Linux dev 4.18.6-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 5 11:54:09 UTC 2018 x86_64 GNU/Linux

  Thank you for looking into this!

  
  #!/usr/bin/env bash

  echo vfio-pci > /sys/bus/pci/devices/0000:04:00.0/driver_override
  echo 0000:04:00.0 > /sys/bus/pci/devices/0000:04:00.0/driver/unbind
  echo 0000:04:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
  echo > /sys/bus/pci/devices/0000:04:00.0/driver_override

  /usr/bin/qemu-system-x86_64 \
  -name winnt \
  -daemonize \
  -pidfile /run/vms/qemu/winnt.pid \
  -boot menu=on \
  -drive if=pflash,format=raw,readonly,file=/opt/vms/qemu/machines/ovmf_code_patched.fd \
  -drive if=pflash,format=raw,file=/opt/vms/qemu/machines/winnt/ovmf_vars_patched.fd \
  -machine pc-q35-3.0,accel=kvm \
  -nodefaults \
  -cpu host,kvm=off,hv_vendor_id=RedHat,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff \
  -accel kvm \
  -smp 4,sockets=1,cores=4,threads=1 \
  -m 16G \
  -nic bridge,br=br0,mac=52:54:00:12:34:77,model=e1000e \
  -device vfio-pci,host=01:00.0,multifunction=on \
  -device vfio-pci,host=01:00.1 \
  -vga none \
  -display none \
  -monitor none \
  -blockdev raw,node-name=ide-hd.0,cache.direct=on,discard=unmap,file.driver=host_device,file.aio=native,file.filename=/dev/disk/by-id/ata-WDC_WDS500G2B0A-00SM50_181265803048 \
  -device ide-hd,drive=ide-hd.0,bus=ide.0,rotation_rate=1 \
  -blockdev raw,node-name=ide-hd.1,cache.direct=on,file.driver=host_device,file.aio=native,file.filename=/dev/disk/by-id/ata-TOSHIBA_HDWE160_X746K8ZTF56D-part1 \
  -device ide-hd,drive=ide-hd.1,bus=ide.1 \
  -device vfio-pci,host=04:00.0 \
  -device qemu-xhci \
  -device usb-host,vendorid=0x04d9,productid=0x0171 \
  -device usb-host,vendorid=0x1532,productid=0x005c \
  -device usb-host,vendorid=0x1b1c,productid=0x0c09

  echo 0000:04:00.0 > /sys/bus/pci/devices/0000:04:00.0/driver/unbind
  echo 0000:04:00.0 > /sys/bus/pci/drivers_probe

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1792523/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-12 18:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-14  6:54 [Qemu-devel] [Bug 1792523] [NEW] usb passthrough not resetting on host after vm shutdown if started with -daemonize Marshall Porter
2018-09-14 15:48 ` [Qemu-devel] [Bug 1792523] " Alex Williamson
2018-09-14 18:26 ` Marshall Porter
2019-10-22  4:45 ` Marshall Porter
2020-11-12 18:26 ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.