Since I keep posting it other places, but have yet to post it here, I'm including a copy of my current shell script to start qemu:
#!/bin/zsh
keyboard_id = "04d9:0169"
mouse_id = "046d:c24a"
keyboard = $( lsusb | grep " ${ keyboard_id } " | cut -d ' ' -f 2,4 | grep -Eo '[[:digit:]]+' | sed -e 's/^0*//' | xargs -n 2 | sed -e 's/ /./' )
mouse = $( lsusb | grep " ${ mouse_id } " | cut -d ' ' -f 2,4 | grep -Eo '[[:digit:]]+' | sed -e 's/^0*//' | xargs -n 2 | sed -e 's/ /./' )
if [[ -z " ${ keyboard } " || -z " ${ mouse } " ]] ; then
echo "keyboard ( ${ keyboard } ) or mouse ( ${ mouse } ) cannot be found; exiting"
exit 1
fi
for i in { 4..7} ; do
echo performance > /sys/devices/system/cpu/cpu${ i } /cpufreq/scaling_governor
#cat /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor
done
taskset -ac 4-7 qemu-system-x86_64 \
-qmp unix:/run/qmp-sock,server,nowait \
-display none \
-enable-kvm \
-M q35,accel= kvm \
-m 8192 \
-cpu host,kvm= off \
-smp 4,sockets= 1,cores= 4,threads= 1 \
-mem-path /dev/hugepages \
-rtc base = localtime,driftfix= slew \
-device ioh3420,bus= pcie.0,addr= 1c.0,multifunction= on,port= 1,chassis= 1,id= root \
-device vfio-pci,host= 02:00.0,bus= root,addr= 00.0,multifunction= on,x-vga= on -vga none \
-device vfio-pci,host= 02:00.1,bus= root,addr= 00.1 \
-usb -usbdevice host:${ keyboard } -usbdevice host:${ mouse } \
-device virtio-scsi-pci,id= scsi \
-drive if = none,file= /dev/win/cdrive,format= raw,cache= none,id= win-c -device scsi-hd,drive= win-c \
-drive if = none,format= raw,file= /dev/sr0,id= blu-ray -device scsi-block,drive= blu-ray \
-device virtio-net-pci,netdev= net0 -netdev bridge,id= net0,helper= /usr/lib/qemu/qemu-bridge-helper &
sleep 5
#cpuid=0
cpuid = 4
for threadpid in $( echo 'query-cpus' | qmp-shell /run/qmp-sock | grep '^(QEMU) {"return":' | sed -e 's/^(QEMU) //' | jq -r '.return[].thread_id' ) ; do
taskset -p -c ${ cpuid } ${ threadpid }
(( cpuid+= 1))
done
wait
for i in { 4..7} ; do
echo ondemand > /sys/devices/system/cpu/cpu${ i } /cpufreq/scaling_governor
#cat /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor
done
The only real change was to automatically search for the keyboard and mouse I want to pass through in case they get unplugged and end up at a different bus address.