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

Jonathan Scruggs j.scruggs at gmail.com
Thu Mar 17 12:32:55 UTC 2016


Hi,

I have yet to see a way to change a feature in recent versions of Qemu that
allow you to change the name of the reported HyperV settings to the guest
OS via LibVirt XML. If you call qemu directly, this is not so much of a
challenge as you can set the variable. However, with LibVirt, you need to
jump through hoops and set a manual cpu passthrough command, but that
defeats the purpose of being easy to set cpu commands in the XML. I made
this small patch which changes the default name of the HyperV reporting so
when you set the hyperv flags, it uses this new name. You can change the
name to whatever you want. I chose the name of my motherboard. Just
remember to choose 12 characters and \0 out any remaining characters.

You need to apply this to qemu 2.5 source and recompile and reinstall the
new binary.
-------------------Patch-----------------
diff -purN a/target-i386/kvm.c b/target-i386/kvm.c
--- a/target-i386/kvm.c 2015-12-16 22:04:51.000000000 +0000
+++ b/target-i386/kvm.c 2016-03-07 09:57:44.066800289 +0000
@@ -552,7 +552,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         c = &cpuid_data.entries[cpuid_i++];
         c->function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
         if (!cpu->hyperv_vendor_id) {
-            memcpy(signature, "Microsoft Hv", 12);
+            memcpy(signature, "GIGABYTEINC\0", 12);
         } else {
             size_t len = strlen(cpu->hyperv_vendor_id);

-------------------Patch-----------------

Now you can have this in your XML.
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='4096'/>
    </hyperv>
Without the nVidia drivers erring out. :)

Hope you find this handy.

-Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20160317/a3ec675f/attachment.htm>


More information about the vfio-users mailing list