UTM icon indicating copy to clipboard operation
UTM copied to clipboard

USB 3.2 controller in QEMU guest

Open techpro2004 opened this issue 3 years ago • 6 comments

I am in the process of adding a egpu as a usb device to a windows 11 vm on a macos host. It would be great if I could get the full bandwidth of the device passed through. This would require a usb 3.2 controller option in utm. Please add the option for a usb 3.2 controller in utm.

techpro2004 avatar Jun 27 '22 17:06 techpro2004

There are three different versions of USB 3.2 (yes the spec name is hot trash).

USB 3.2 Gen 1 (aka the old "USB 3.0", 5Gbps) is supported via an XHCI device in QEMU.

I don't believe Gen 2 (10Gbps) or Gen 3 (20Gpbs) are currently supported upstream in QEMU; UTM would be blocked on waiting for that to be added.

ideologysec avatar Jun 27 '22 23:06 ideologysec

@techpro2004 Are you certain your eGPU works with USB 3.2 or would it need Thunderbolt 3?

conath avatar Jul 04 '22 06:07 conath

I don't believe Gen 2 (10Gbps) or Gen 3 (20Gpbs) are currently supported upstream in QEMU; UTM would be blocked on waiting for that to be added.

Really? Then how are people doing this 4 years ago? https://www.reddit.com/r/VFIO/comments/am10z3/success_thunderbolt_egpu_passthrough_on_dell_9560/

Or is this host-OS specific?

Fmstrat avatar Sep 05 '22 15:09 Fmstrat

I don't believe Gen 2 (10Gbps) or Gen 3 (20Gpbs) are currently supported upstream in QEMU; UTM would be blocked on waiting for that to be added.

Really? Then how are people doing this 4 years ago? https://www.reddit.com/r/VFIO/comments/am10z3/success_thunderbolt_egpu_passthrough_on_dell_9560/

Or is this host-OS specific?

The link you shared is about a very different version of QEMU and a somewhat different use case. In the link above, someone is using the KVM backend to pass through a PCIe device. "KVM" is a "kernel virtual machine" and relies on the x86 CPU virtualization features. It is not available on Mac hosts (at least those with Apple Silicon).

On Mac, UTM uses the HVF & SPICE "backend" layers, which currently lack the features as mentioned above.

conath avatar Sep 05 '22 16:09 conath

@conath Interesting, and good to know. I've previously used QEMU to pass through PCIe and USB controllers similar to the above using a command like below, so I didn't know if it was possible to do the same with the Thunderbolt 3 controller:

	sudo qemu-system-x86_64 \
	-name $vmname,process=$vmname \
	-machine type=q35,accel=kvm \
	-cpu host,kvm=off,hv_vendor_id=1234567890ab,hv_vapic,hv_time,hv_relaxed,hv_spinlocks=0x1fff \
	-smp 6,sockets=1,cores=3,threads=2 \
	-m 8G \
	-mem-path /dev/hugepages \
	-mem-prealloc \
	-balloon none \
	-rtc clock=host,base=localtime \
	-vga none \
	-nographic \
	-serial none \
	-parallel none \
	-soundhw hda \
	-usb \
	-device usb-host,vendorid=0x045e,productid=0x02e6 \
	-device usb-host,vendorid=0x045e,productid=0x02ea \
	-device usb-host,vendorid=0x045e,productid=0x02fe \
	\
	-device usb-host,vendorid=0x0bda,productid=0x8153 \
	\
	-device usb-host,vendorid=0x0a12,productid=0x0001 \
	\
	-device usb-host,vendorid=0x0424,productid=0x274d \
	-device usb-host,vendorid=0x0bb4,productid=0x0306 \
	-device usb-host,vendorid=0x0bb4,productid=0x2744 \
	\
	-device vfio-pci,host=01:00.0,multifunction=on \
	-device vfio-pci,host=01:00.1 \
	-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
	-drive if=pflash,format=raw,file=/tmp/my_vars.fd \
	-boot order=dc \
	-drive id=disk0,if=virtio,cache=none,format=qcow2,file=/storage/KVM/Windows10/windows10vm.qcow2 \
	-drive id=disk1,if=virtio,cache=none,format=qcow2,file=/storage/KVM/Windows10/windows10vm_games.qcow2 \
	\
	-object input-linux,id=mouse1,evdev=/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse \
	-object input-linux,id=kbd,evdev=/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd,grab_all=on,repeat=on \
	\
	-netdev type=tap,id=net0,ifname=vmtap0,vhost=on \
	-device virtio-net-pci,netdev=net0,mac=00:16:3e:00:01:01

This was for a high-performance gaming use-case.

Fmstrat avatar Sep 05 '22 17:09 Fmstrat

KVM is a Linux specific thing. There’s only HVF on macOS.

osy avatar Sep 05 '22 17:09 osy