The checks are now in a dedicated qemuProcessVerifyKVMFeatures function. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_process.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 48820a204..df9489f3e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3779,6 +3779,28 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, } +static int +qemuProcessVerifyKVMFeatures(virDomainDefPtr def, + virCPUDataPtr cpu) +{ + int rc = 0; + + if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] != VIR_TRISTATE_SWITCH_ON) + return 0; + + rc = virCPUDataCheckFeature(cpu, VIR_CPU_x86_KVM_PV_UNHALT); + + if (rc <= 0) { + if (rc == 0) + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support paravirtual spinlocks")); + return -1; + } + + return 0; +} + + static bool qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -3808,15 +3830,8 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, goto cleanup; } - if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON) { - if (!virCPUDataCheckFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support paravirtual spinlocks")); - goto cleanup; - } - } - - if (qemuProcessVerifyHypervFeatures(def, guestcpu) < 0) + if (qemuProcessVerifyKVMFeatures(def, guestcpu) < 0 || + qemuProcessVerifyHypervFeatures(def, guestcpu) < 0) goto cleanup; if (def->cpu) { -- 2.12.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list