From: Peter Krempa Date: Mon, 6 Mar 2023 14:38:15 +0000 (+0100) Subject: qemu: validate: Fix logic for validating presence of the HPET timer X-Git-Tag: v9.2.0-rc1~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ee4809907e63e83db032b5f90261f51ec864aa9;p=thirdparty%2Flibvirt.git qemu: validate: Fix logic for validating presence of the HPET timer Commit 24cc9cda826 switched over to use -machine hpet, but one of the steps it did was to clear the QEMU_CAPS_NO_HPET capability. The validation check still uses the old capability though which means that for configs which would explicitly enable HPET we'd report an error. Since HPET is an x86(_64) platform specific device, convert the validation check to an architecture check as all supported qemu versions actually support it. Modify a test case to request HPET to catch posible future problems. Fixes: 24cc9cda826 Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 30c11a567a..93077aadfc 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -599,13 +599,13 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def, break; case VIR_DOMAIN_TIMER_NAME_HPET: - /* no hpet timer available. The only possible action - is to raise an error if present="yes" */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_HPET) && - timer->present == VIR_TRISTATE_BOOL_YES) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("hpet timer is not supported")); - return -1; + if (timer->present == VIR_TRISTATE_BOOL_YES) { + if (def->os.arch != VIR_ARCH_I686 && + def->os.arch != VIR_ARCH_X86_64) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hpet timer is not supported by this architecture")); + return -1; + } } break; diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args index d8b840f171..b59f713101 100644 --- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args +++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args @@ -23,7 +23,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-virt-manager-basic/.config \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc,driftfix=slew \ -global kvm-pit.lost_tick_policy=delay \ --no-hpet \ -no-shutdown \ -global ICH9-LPC.disable_s3=1 \ -global ICH9-LPC.disable_s4=1 \ diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args index 4d029fd55f..5a7b5d7629 100644 --- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args +++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-virt-manager-basic/.config \ -name guest=virt-manager-basic,debug-threads=on \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-virt-manager-basic/master-key.aes"}' \ --machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off,acpi=on \ +-machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=on,acpi=on \ -accel kvm \ -cpu qemu64 \ -m 4096 \ diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml index c2d82c2c47..75075d0ab4 100644 --- a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml +++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml @@ -16,7 +16,7 @@ - + destroy restart diff --git a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml index 5bb00ceb38..08be45b5a5 100644 --- a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml @@ -19,7 +19,7 @@ - + destroy restart