[vfio-users] Small patch for those that have nVidia cards and want to easily use LibVirt.

Jukka Helinko j at logicerror.net
Fri Mar 18 22:49:39 UTC 2016


On 17.03.2016 19:48, Alex Williamson wrote:
> <qemu:arg> is inherently evil.  You end up specifying two -cpu
> args, the one libvirt generates and the one you specific in the
> qemucommand (which is opaque to libvirt) and you hope that qemu
> selects the one you want.  Using virt-manager to fiddle with cpu
> options might become meaningless, we don't know whether qemu merges
> all cpu options together or only takes the last (we could look, but
> it's probably unexpected and therefore undefined and could change
> at any release).
> 

I was actually wondering this myself yesterday. How multiple -cpus
would be interpreted (didn't go as far as to look at the code).

Main goal was to convince nvidia drivers to not code 43, with hv_*
options. Ended up adding few sed lines to the emulator startup script
and removing the qemu args from xml.

"
#!/bin/sh
exec /usr/bin/qemu-system-x86_64 \
 `echo "\$@" | \
 sed 's/Haswell-noTSX/host,kvm=off/g' | \
 sed 's/05:00.0/05:00.0,x-vga=on/g' | \
 sed 's/hv_time/hv_time,hv_vendor_id=KeenlyKVM/g
"

At first it was just 's/Haswell-noTSX/Haswell-noTSX,kvm=off/g' | \..,
but apparently Starcraft 2 didn't like that at all. So had to change
it to host to stop it from restarting the VM (probably bluescreen).

Should the nvidia not code 43 just with hv_vendor_id or do I still
need the kvm=off? Because if I remove the kvm=off option, I'll get the
code 43. Is there something else I should change in the xml config?

End result is that, there's only one -cpu argument passed to qemu, but
I'm not not sure if 'host' makes sense with all the other cpu options.
At least with these options nvidia doesn't code 43 with my setup, and
Windows sees that it is running in a virtual machine (and hopefully
behaves accordingly). Whether this makes any difference in performance
is at the moment a mystery.


/J




More information about the vfio-users mailing list