]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_command: Use canonical names of CPU features
authorJiri Denemark <jdenemar@redhat.com>
Fri, 7 Jun 2019 13:00:28 +0000 (15:00 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 19 Jun 2019 22:22:39 +0000 (00:22 +0200)
When building QEMU command line, we should use the preferred spelling of
each CPU feature without relying on compatibility aliases (which may be
removed at some point).

The "unavailable-features" CPU property is used as a witness for the
correct names of the features in our translation table.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args
tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args
tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args
tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args
tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args

index 3af6923e6fb101b1eae2fc924aac899b7c04b028..c742838383a7d70b080d0e8ed045e15ddbf21b68 100644 (file)
@@ -532,6 +532,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "nbd-bitmap",
               "x86-max-cpu",
               "cpu-unavailable-features",
+              "canonical-cpu-features",
     );
 
 
@@ -2892,7 +2893,9 @@ virQEMUCapsCPUFeatureTranslate(virQEMUCapsPtr qemuCaps,
     if (ARCH_IS_X86(qemuCaps->arch))
         table = virQEMUCapsCPUFeaturesX86;
 
-    if (!table || !feature)
+    if (!table ||
+        !feature ||
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
         return feature;
 
     for (entry = table; entry->libvirt; entry++) {
@@ -4398,6 +4401,9 @@ virQEMUCapsInitProcessCaps(virQEMUCapsPtr qemuCaps)
      * we are able to pass the custom 'device_id' for SCSI disks and cdroms. */
     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID))
         virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV);
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES))
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES);
 }
 
 
index 61c06674270b550bb933ad5c3822a8e66b1a2d72..915ba6cb2ece256734f173c71b40876a7eb95f3a 100644 (file)
@@ -513,6 +513,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_NBD_BITMAP, /* nbd-server-add supports bitmap */
     QEMU_CAPS_X86_MAX_CPU, /* max-x86_64-cpu type exists */
     QEMU_CAPS_CPU_UNAVAILABLE_FEATURES, /* "unavailable-features" CPU property */
+    QEMU_CAPS_CANONICAL_CPU_FEATURES, /* avoid CPU feature aliases */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
index 08da30d10c8c35ec2efe6a31884fb19806419179..15f2990189658841c275f476458c49ad6b340eaf 100644 (file)
@@ -7045,6 +7045,8 @@ qemuBuildCpuFeature(virQEMUCapsPtr qemuCaps,
                     const char *name,
                     bool state)
 {
+    name = virQEMUCapsCPUFeatureToQEMU(qemuCaps, name);
+
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
         virBufferAsprintf(buf, ",%s=%s", name, state ? "on" : "off");
     else
index 24be3a546e8afed991e1f7c052e82b488b4360ce..4cc91e677ed97a700a4b95b91f808fc490090acc 100644 (file)
   <flag name='nbd-bitmap'/>
   <flag name='x86-max-cpu'/>
   <flag name='cpu-unavailable-features'/>
+  <flag name='canonical-cpu-features'/>
   <version>4000050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100759</microcodeVersion>
index 7a1546fb3681c1bc99e526b148637905e087ffd1..9322b826f41da0b7613623dc6ae086e16726694e 100644 (file)
@@ -13,9 +13,9 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
-cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,kvm_pv_eoi=on,\
-kvm_pv_unhalt=on \
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,\
+cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,\
+kvm-pv-unhalt=on \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
index caae868abf8f63951ae7e88034cec623fcdd8216..f8119317592a9a74ebf07739441e3332308c2555 100644 (file)
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu qemu32,kvm_pv_eoi=off \
+-cpu qemu32,kvm-pv-eoi=off \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
index abafafa4113cdd1a2464af00b4139d74139ca490..25c03ae4d27ce64a234fad6f40815fda045338bf 100644 (file)
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu qemu32,kvm_pv_eoi=on \
+-cpu qemu32,kvm-pv-eoi=on \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
index 23d2bcb87e73f2376717f03902b28a5109d95a44..f13573df8a2d0af90024649e9eecdbde8126af1c 100644 (file)
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu qemu32,kvmclock=off,kvm_pv_eoi=off \
+-cpu qemu32,kvmclock=off,kvm-pv-eoi=off \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
index b78533cf39882806880f1c4e0b85457a9edfb1f7..13fd7253a91041412959b53970247b42a8cb22e4 100644 (file)
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu qemu32,kvm_pv_unhalt=off \
+-cpu qemu32,kvm-pv-unhalt=off \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
index a016e800168e5292483dfd1ba42bd080802121fd..919bbd037ecb5b758522bb5c3c3c480b3c3c5cb8 100644 (file)
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
--cpu qemu32,kvm_pv_unhalt=on \
+-cpu qemu32,kvm-pv-unhalt=on \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \