render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
acda74
From a0dbc4911d7012f7ac6295998c4ea2439cf34f39 Mon Sep 17 00:00:00 2001
acda74
Message-Id: <a0dbc4911d7012f7ac6295998c4ea2439cf34f39@dist-git>
acda74
From: Peter Krempa <pkrempa@redhat.com>
acda74
Date: Mon, 6 Mar 2023 15:38:15 +0100
acda74
Subject: [PATCH] qemu: validate: Fix logic for validating presence of the HPET
acda74
 timer
acda74
MIME-Version: 1.0
acda74
Content-Type: text/plain; charset=UTF-8
acda74
Content-Transfer-Encoding: 8bit
acda74
acda74
Commit 24cc9cda826 switched over to use -machine hpet, but one of the
acda74
steps it did was to clear the QEMU_CAPS_NO_HPET capability.
acda74
acda74
The validation check still uses the old capability though which means
acda74
that for configs which would explicitly enable HPET we'd report an error.
acda74
acda74
Since HPET is an x86(_64) platform specific device, convert the
acda74
validation check to an architecture check as all supported qemu versions
acda74
actually support it.
acda74
acda74
Modify a test case to request HPET to catch posible future problems.
acda74
acda74
Fixes: 24cc9cda826
acda74
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
acda74
Reviewed-by: Ján Tomko <jtomko@redhat.com>
acda74
(cherry picked from commit 4ee4809907e63e83db032b5f90261f51ec864aa9)
acda74
https://bugzilla.redhat.com/show_bug.cgi?id=2175813
acda74
acda74
 Conflicts:
acda74
	tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
acda74
acda74
    - retirement of '-no-acpi' wasn't backported
acda74
---
acda74
 src/qemu/qemu_validate.c                           | 14 +++++++-------
acda74
 .../q35-virt-manager-basic.x86_64-4.2.0.args       |  1 -
acda74
 .../q35-virt-manager-basic.x86_64-latest.args      |  2 +-
acda74
 tests/qemuxml2argvdata/q35-virt-manager-basic.xml  |  2 +-
acda74
 .../q35-virt-manager-basic.x86_64-latest.xml       |  2 +-
acda74
 5 files changed, 10 insertions(+), 11 deletions(-)
acda74
acda74
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
acda74
index 6e04b22da4..fa088d6bcf 100644
acda74
--- a/src/qemu/qemu_validate.c
acda74
+++ b/src/qemu/qemu_validate.c
acda74
@@ -608,13 +608,13 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
acda74
             break;
acda74
 
acda74
         case VIR_DOMAIN_TIMER_NAME_HPET:
acda74
-            /* no hpet timer available. The only possible action
acda74
-              is to raise an error if present="yes" */
acda74
-            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_HPET) &&
acda74
-                timer->present == VIR_TRISTATE_BOOL_YES) {
acda74
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
acda74
-                               "%s", _("hpet timer is not supported"));
acda74
-                return -1;
acda74
+            if (timer->present == VIR_TRISTATE_BOOL_YES) {
acda74
+                if (def->os.arch != VIR_ARCH_I686 &&
acda74
+                    def->os.arch != VIR_ARCH_X86_64) {
acda74
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
acda74
+                                   _("hpet timer is not supported by this architecture"));
acda74
+                    return -1;
acda74
+                }
acda74
             }
acda74
             break;
acda74
 
acda74
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
acda74
index 14093a3f80..f09d01a7cb 100644
acda74
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
acda74
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
acda74
@@ -23,7 +23,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-virt-manager-basic/.config \
acda74
 -mon chardev=charmonitor,id=monitor,mode=control \
acda74
 -rtc base=utc,driftfix=slew \
acda74
 -global kvm-pit.lost_tick_policy=delay \
acda74
--no-hpet \
acda74
 -no-shutdown \
acda74
 -global ICH9-LPC.disable_s3=1 \
acda74
 -global ICH9-LPC.disable_s4=1 \
acda74
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
acda74
index 8446abdb6e..ecfbf3d0a5 100644
acda74
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
acda74
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
acda74
@@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-virt-manager-basic/.config \
acda74
 -name guest=virt-manager-basic,debug-threads=on \
acda74
 -S \
acda74
 -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-virt-manager-basic/master-key.aes"}' \
acda74
--machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off \
acda74
+-machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=on \
acda74
 -accel kvm \
acda74
 -cpu qemu64 \
acda74
 -m 4096 \
acda74
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
acda74
index c2d82c2c47..75075d0ab4 100644
acda74
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
acda74
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
acda74
@@ -16,7 +16,7 @@
acda74
   <clock offset='utc'>
acda74
     <timer name='rtc' tickpolicy='catchup'/>
acda74
     <timer name='pit' tickpolicy='delay'/>
acda74
-    <timer name='hpet' present='no'/>
acda74
+    <timer name='hpet' present='yes'/>
acda74
   </clock>
acda74
   <on_poweroff>destroy</on_poweroff>
acda74
   <on_reboot>restart</on_reboot>
acda74
diff --git a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
acda74
index 62289d4800..997b42370a 100644
acda74
--- a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
acda74
+++ b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
acda74
@@ -19,7 +19,7 @@
acda74
   <clock offset='utc'>
acda74
     <timer name='rtc' tickpolicy='catchup'/>
acda74
     <timer name='pit' tickpolicy='delay'/>
acda74
-    <timer name='hpet' present='no'/>
acda74
+    <timer name='hpet' present='yes'/>
acda74
   </clock>
acda74
   <on_poweroff>destroy</on_poweroff>
acda74
   <on_reboot>restart</on_reboot>
acda74
-- 
acda74
2.39.2
acda74