qemu: Prefer dashes for hyperv features

Starting with QEMU 4.1, we're using the canonical feature names on the
command line and avoid aliases to prepare for possible deprecation of
all aliases in QEMU. But we do so only for features from our CPU map,
hyperv features defined in the code were unchanged and this patch fixes
it. Some features use "hv-" prefix unconditionally because they were
introduced recently enough to always support spelling with a dash.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2019-07-25 15:36:14 +02:00
parent 0ccdd476bb
commit d99e8f01c7
5 changed files with 17 additions and 10 deletions

View File

@ -7133,7 +7133,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
!!timer->present);
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK &&
timer->present == 1) {
virBufferAddLit(&buf, ",hv_time");
virBufferAddLit(&buf, ",hv-time");
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_TSC &&
timer->frequency > 0) {
virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
@ -7151,6 +7151,11 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
}
if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
const char *hvPrefix = "hv-";
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
hvPrefix = "hv_";
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
@ -7166,19 +7171,21 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",hv_%s",
virBufferAsprintf(&buf, ",%s%s",
hvPrefix,
virDomainHypervTypeToString(i));
break;
case VIR_DOMAIN_HYPERV_SPINLOCKS:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",hv_spinlocks=0x%x",
virBufferAsprintf(&buf, ",%s=0x%x",
VIR_CPU_x86_KVM_HV_SPINLOCKS,
def->hyperv_spinlocks);
break;
case VIR_DOMAIN_HYPERV_VENDOR_ID:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
virBufferAsprintf(&buf, ",hv_vendor_id=%s",
virBufferAsprintf(&buf, ",hv-vendor-id=%s",
def->hyperv_vendor_id);
break;
@ -7191,7 +7198,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
for (i = 0; i < def->npanics; i++) {
if (def->panics[i]->model == VIR_DOMAIN_PANIC_MODEL_HYPERV) {
virBufferAddLit(&buf, ",hv_crash");
virBufferAddLit(&buf, ",hv-crash");
break;
}
}

View File

@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
-cpu qemu32,hv_time \
-cpu qemu32,hv-time \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \

View File

@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu qemu32,hv_crash \
-cpu qemu32,hv-crash \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \

View File

@ -11,8 +11,8 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
-cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=0x2fff,hv_vpindex,hv_runtime,\
hv_synic,hv_stimer,hv_reset,hv-vendor-id=KVM Hv,hv_frequencies,\
hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \
-m 214 \
-realtime mlock=off \

View File

@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu qemu32,hv_crash \
-cpu qemu32,hv-crash \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \