mirror of https://gitee.com/openkylin/libvirt.git
qemu_command: Use canonical names of CPU features
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>
This commit is contained in:
parent
6f6401fbae
commit
5030a7450b
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -206,6 +206,7 @@
|
|||
<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>
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in New Issue