]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: validate: Fix logic for validating presence of the HPET timer
authorPeter Krempa <pkrempa@redhat.com>
Mon, 6 Mar 2023 14:38:15 +0000 (15:38 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 7 Mar 2023 11:26:32 +0000 (12:26 +0100)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
tests/qemuxml2argvdata/q35-virt-manager-basic.xml
tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml

index 30c11a567ad077466d807e2cee12bc5c8347eb84..93077aadfc8495e6cbf50a92eab317a90b7138a5 100644 (file)
@@ -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;
 
index d8b840f171405c042ad1e003515d973df5f197db..b59f71310151146e017285339dbd1e4a9ce84928 100644 (file)
@@ -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 \
index 4d029fd55fbce0dab3c4f6de9ab795388f6d3fd5..5a7b5d7629eb873befc2d23bf700febd6af0c1f3 100644 (file)
@@ -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 \
index c2d82c2c47fe9325a6893f2feba50fa8f8c2852e..75075d0ab4165fd52e451b4adef8c5738a822674 100644 (file)
@@ -16,7 +16,7 @@
   <clock offset='utc'>
     <timer name='rtc' tickpolicy='catchup'/>
     <timer name='pit' tickpolicy='delay'/>
-    <timer name='hpet' present='no'/>
+    <timer name='hpet' present='yes'/>
   </clock>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
index 5bb00ceb3823632886e39d5e6cd1cf1b8bfff876..08be45b5a57d037bf21588432a5b20eecf8620a4 100644 (file)
@@ -19,7 +19,7 @@
   <clock offset='utc'>
     <timer name='rtc' tickpolicy='catchup'/>
     <timer name='pit' tickpolicy='delay'/>
-    <timer name='hpet' present='no'/>
+    <timer name='hpet' present='yes'/>
   </clock>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>