The kernel command line can contain settings affecting the availability of cpu flags. Add the kernel command line to the capabilities cache. Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9558938866..21b7e8050b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -709,6 +709,7 @@ struct _virQEMUCaps { char *hostCPUSignature; char *package; char *kernelVersion; + char *kernelCmdline; virArch arch; @@ -1973,6 +1974,7 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) ret->package = g_strdup(qemuCaps->package); ret->kernelVersion = g_strdup(qemuCaps->kernelVersion); + ret->kernelCmdline = g_strdup(qemuCaps->kernelCmdline); ret->arch = qemuCaps->arch; @@ -2024,6 +2026,7 @@ void virQEMUCapsDispose(void *obj) g_free(qemuCaps->package); g_free(qemuCaps->kernelVersion); + g_free(qemuCaps->kernelCmdline); g_free(qemuCaps->binary); g_free(qemuCaps->hostCPUSignature); @@ -4321,6 +4324,12 @@ virQEMUCapsLoadCache(virArch hostArch, goto cleanup; } + if (virXPathBoolean("boolean(./kernelCmdline)", ctxt) > 0) { + qemuCaps->kernelCmdline = virXPathString("string(./kernelCmdline)", ctxt); + if (!qemuCaps->kernelCmdline) + goto cleanup; + } + if (!(str = virXPathString("string(./arch)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing arch in QEMU capabilities cache")); @@ -4636,6 +4645,10 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) virBufferAsprintf(&buf, "<kernelVersion>%s</kernelVersion>\n", qemuCaps->kernelVersion); + if (qemuCaps->kernelCmdline) + virBufferAsprintf(&buf, "<kernelCmdline>%s</kernelCmdline>\n", + qemuCaps->kernelCmdline); + virBufferAsprintf(&buf, "<arch>%s</arch>\n", virArchToString(qemuCaps->arch)); @@ -5495,6 +5508,7 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, qemuCaps->microcodeVersion = microcodeVersion; qemuCaps->kernelVersion = g_strdup(kernelVersion); + qemuCaps->kernelCmdline = NULL; qemuCaps->kvmSupportsNesting = virQEMUCapsKVMSupportsNesting(); -- 2.31.1