libvirt/SOURCES/libvirt-qemu-validate-Fix-logic-for-validating-presence-of-the-HPET-timer.patch

120 lines
5.2 KiB
Diff
Raw Normal View History

2023-05-09 05:17:35 +00:00
From a0dbc4911d7012f7ac6295998c4ea2439cf34f39 Mon Sep 17 00:00:00 2001
Message-Id: <a0dbc4911d7012f7ac6295998c4ea2439cf34f39@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 6 Mar 2023 15:38:15 +0100
Subject: [PATCH] qemu: validate: Fix logic for validating presence of the HPET
timer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit 4ee4809907e63e83db032b5f90261f51ec864aa9)
https://bugzilla.redhat.com/show_bug.cgi?id=2175813
Conflicts:
tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
- retirement of '-no-acpi' wasn't backported
---
src/qemu/qemu_validate.c | 14 +++++++-------
.../q35-virt-manager-basic.x86_64-4.2.0.args | 1 -
.../q35-virt-manager-basic.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/q35-virt-manager-basic.xml | 2 +-
.../q35-virt-manager-basic.x86_64-latest.xml | 2 +-
5 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 6e04b22da4..fa088d6bcf 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -608,13 +608,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 14093a3f80..f09d01a7cb 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=/tmp/lib/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 8446abdb6e..ecfbf3d0a5 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=/tmp/lib/domain--1-virt-manager-basic/.config \
-name guest=virt-manager-basic,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-virt-manager-basic/master-key.aes"}' \
--machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off \
+-machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=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 @@
<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>
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 62289d4800..997b42370a 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 @@
<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>
--
2.39.2