From: Michal Privoznik Date: Wed, 1 Oct 2025 13:50:39 +0000 (+0200) Subject: qemu_capabilities: Format and parse new hyperv domcaps members X-Git-Tag: v11.9.0-rc1~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0141f6544cda75d47eb35b95c10878793c22c187;p=thirdparty%2Flibvirt.git qemu_capabilities: Format and parse new hyperv domcaps members After previous commit the virDomainCapsFeatureHyperv struct gained new members. Since virQEMUCaps struct holds a pointer to such struct we must format and parse it to/from capabilities XML. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2ccddbfcaa..f571596b30 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4496,6 +4496,7 @@ virQEMUCapsParseHypervCapabilities(virQEMUCaps *qemuCaps, g_autoptr(virDomainCapsFeatureHyperv) hvcaps = NULL; xmlNodePtr n = NULL; g_autofree xmlNodePtr *capNodes = NULL; + int rc; int ncapNodes; size_t i; @@ -4531,6 +4532,28 @@ virQEMUCapsParseHypervCapabilities(virQEMUCaps *qemuCaps, VIR_DOMAIN_CAPS_ENUM_SET(hvcaps->features, val); } + rc = virXPathUInt("string(./hypervCapabilities/spinlocks)", + ctxt, &hvcaps->spinlocks); + if (rc == -2) + return -1; + + rc = virXPathTristateSwitch("string(./hypervCapabilities/stimer_direct)", + ctxt, &hvcaps->stimer_direct); + if (rc == -2) + return -1; + + rc = virXPathTristateSwitch("string(./hypervCapabilities/tlbflush_direct)", + ctxt, &hvcaps->tlbflush_direct); + if (rc == -2) + return -1; + + rc = virXPathTristateSwitch("string(./hypervCapabilities/tlbflush_extended)", + ctxt, &hvcaps->tlbflush_extended); + if (rc == -2) + return -1; + + hvcaps->vendor_id = virXPathString("string(./hypervCapabilities/vendor_id)", ctxt); + qemuCaps->hypervCapabilities = g_steal_pointer(&hvcaps); return 0; } @@ -5070,6 +5093,25 @@ virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qemuCaps, virBufferAsprintf(&childBuf, "\n", virDomainHypervTypeToString(i)); } + + if (hvcaps->spinlocks != 0) { + virBufferAsprintf(&childBuf, "%u\n", + hvcaps->spinlocks); + } + if (hvcaps->stimer_direct != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, "%s\n", + virTristateSwitchTypeToString(hvcaps->stimer_direct)); + } + if (hvcaps->tlbflush_direct != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, "%s\n", + virTristateSwitchTypeToString(hvcaps->tlbflush_direct)); + } + if (hvcaps->tlbflush_extended != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, "%s\n", + virTristateSwitchTypeToString(hvcaps->tlbflush_extended)); + } + virBufferEscapeString(&childBuf, "%s\n", + hvcaps->vendor_id); } return virXMLFormatElement(buf, "hypervCapabilities", &attrBuf, &childBuf);