93 lines
3.8 KiB
Diff
93 lines
3.8 KiB
Diff
From 4f855a934bc9649b96734db69197b26d9995cede Mon Sep 17 00:00:00 2001
|
|
Message-ID: <4f855a934bc9649b96734db69197b26d9995cede.1763133105.git.jdenemar@redhat.com>
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Wed, 1 Oct 2025 15:50:39 +0200
|
|
Subject: [PATCH] qemu_capabilities: Format and parse new hyperv domcaps
|
|
members
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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 <mprivozn@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
(cherry picked from commit 0141f6544cda75d47eb35b95c10878793c22c187)
|
|
Resolves: https://issues.redhat.com/browse/RHEL-122930
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
---
|
|
src/qemu/qemu_capabilities.c | 42 ++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 42 insertions(+)
|
|
|
|
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
index b54bcbd527..0452600195 100644
|
|
--- a/src/qemu/qemu_capabilities.c
|
|
+++ b/src/qemu/qemu_capabilities.c
|
|
@@ -4557,6 +4557,7 @@ virQEMUCapsParseHypervCapabilities(virQEMUCaps *qemuCaps,
|
|
g_autoptr(virDomainCapsFeatureHyperv) hvcaps = NULL;
|
|
xmlNodePtr n = NULL;
|
|
g_autofree xmlNodePtr *capNodes = NULL;
|
|
+ int rc;
|
|
int ncapNodes;
|
|
size_t i;
|
|
|
|
@@ -4592,6 +4593,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;
|
|
}
|
|
@@ -5131,6 +5154,25 @@ virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qemuCaps,
|
|
virBufferAsprintf(&childBuf, "<cap name='%s'/>\n",
|
|
virDomainHypervTypeToString(i));
|
|
}
|
|
+
|
|
+ if (hvcaps->spinlocks != 0) {
|
|
+ virBufferAsprintf(&childBuf, "<spinlocks>%u</spinlocks>\n",
|
|
+ hvcaps->spinlocks);
|
|
+ }
|
|
+ if (hvcaps->stimer_direct != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
+ virBufferAsprintf(&childBuf, "<stimer_direct>%s</stimer_direct>\n",
|
|
+ virTristateSwitchTypeToString(hvcaps->stimer_direct));
|
|
+ }
|
|
+ if (hvcaps->tlbflush_direct != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
+ virBufferAsprintf(&childBuf, "<tlbflush_direct>%s</tlbflush_direct>\n",
|
|
+ virTristateSwitchTypeToString(hvcaps->tlbflush_direct));
|
|
+ }
|
|
+ if (hvcaps->tlbflush_extended != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
+ virBufferAsprintf(&childBuf, "<tlbflush_extended>%s</tlbflush_extended>\n",
|
|
+ virTristateSwitchTypeToString(hvcaps->tlbflush_extended));
|
|
+ }
|
|
+ virBufferEscapeString(&childBuf, "<vendor_id>%s</vendor_id>\n",
|
|
+ hvcaps->vendor_id);
|
|
}
|
|
|
|
return virXMLFormatElement(buf, "hypervCapabilities", &attrBuf, &childBuf);
|
|
--
|
|
2.51.1
|