]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Wire up new hyperv host-model mode behavior master
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Feb 2026 09:16:34 +0000 (10:16 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 13 Feb 2026 12:32:45 +0000 (13:32 +0100)
Since some hyperv features might be already enabled/disabled when
entering qemuProcessEnableDomainFeatures() only those which are
not set in domain XML (i.e. are VIR_TRISTATE_SWITCH_ABSENT)
should be modified. Furthermore, some features are not a simple
on/off switch, but a number or a string even. Well, that doesn't
matter really as the logic for setting them is the same: only set
their value iff they are not already set.

Resolves: https://issues.redhat.com/browse/RHEL-148219
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_process.c
tests/qemuxmlconfdata/hyperv-host-model.x86_64-latest.args

index 3b3c287c30d41089efdeb9f05699ad8e140bc99c..1b7658a07939727a098adae7b1ac146c061e3768 100644 (file)
@@ -6962,7 +6962,13 @@ qemuProcessEnableDomainFeatures(virDomainObj *vm)
         if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(hv->features, i))
             continue;
 
-        vm->def->hyperv.features[i] = VIR_TRISTATE_SWITCH_ON;
+        if (vm->def->hyperv.features[i] == VIR_TRISTATE_SWITCH_ABSENT) {
+            vm->def->hyperv.features[i] = VIR_TRISTATE_SWITCH_ON;
+        } else {
+            /* if the user provided already config for this we skip the
+             * auto-population code */
+            continue;
+        }
 
         if (i == VIR_DOMAIN_HYPERV_SPINLOCKS) {
             if (hv->spinlocks != 0) {
index 58502ff51ef1caa0a4de1d989382db98a7ae59e8..d1f2326da18d5d7f55ae7f11c3224ae06791a65c 100644 (file)
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
 -machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
 -accel tcg \
--cpu 'qemu64,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0xfff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-stimer-direct=on,hv-reset=on,hv-vendor-id=Linux KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-tlbflush-direct=on,hv-tlbflush-ext=on,hv-ipi=on,hv-avic=on,hv-emsr-bitmap=on,hv-xmm-input=on' \
+-cpu 'qemu64,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2000,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-stimer-direct=on,hv-reset=on,hv-vendor-id=Linux KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-tlbflush-direct=on,hv-tlbflush-ext=on,hv-ipi=on,hv-avic=on,hv-emsr-bitmap=on' \
 -m size=219136k \
 -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
 -overcommit mem-lock=off \