diff --git a/libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch b/libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch new file mode 100644 index 0000000..014d168 --- /dev/null +++ b/libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch @@ -0,0 +1,422 @@ +From f4dffda866c49db8cd905d7fb4d35a70c996fa89 Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 17 Feb 2025 16:30:07 +0000 +Subject: [PATCH] conf: introduce support for multiple ACPI tables +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently we parse + + + + ...path...
+
+
+ +into a flat 'char *slic_table' field which is rather an anti-pattern +as it has special cased a single attribute type. + +This rewrites the internal design to permit multiple table types to +be parsed, should we add more in future. Each type is currently +permitted to only appear once. + +Reviewed-by: Michal Privoznik +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 55f48d38522a4657815668dae9ed9184c8870766) +Resolves: https://issues.redhat.com/browse/RHEL-81041 +--- + src/conf/domain_conf.c | 92 +++++++++++++++++++++++---------- + src/conf/domain_conf.h | 21 +++++++- + src/libvirt_private.syms | 2 + + src/libxl/libxl_conf.c | 5 +- + src/libxl/xen_xl.c | 15 ++++-- + src/qemu/qemu_command.c | 13 +++-- + src/security/security_dac.c | 18 ++++--- + src/security/security_selinux.c | 16 +++--- + src/security/virt-aa-helper.c | 5 +- + 9 files changed, 134 insertions(+), 53 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 095b9bbaa2..b0628da279 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -1456,6 +1456,11 @@ VIR_ENUM_IMPL(virDomainOsDefFirmwareFeature, + "secure-boot", + ); + ++VIR_ENUM_IMPL(virDomainOsACPITable, ++ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST, ++ "slic", ++); ++ + VIR_ENUM_IMPL(virDomainCFPC, + VIR_DOMAIN_CFPC_LAST, + "none", +@@ -3890,6 +3895,15 @@ virDomainSecDefFree(virDomainSecDef *def) + g_free(def); + } + ++void virDomainOSACPITableDefFree(virDomainOSACPITableDef *def) ++{ ++ if (!def) ++ return; ++ g_free(def->path); ++ g_free(def); ++} ++ ++ + static void + virDomainOSDefClear(virDomainOSDef *os) + { +@@ -3915,7 +3929,9 @@ virDomainOSDefClear(virDomainOSDef *os) + g_free(os->cmdline); + g_free(os->dtb); + g_free(os->root); +- g_free(os->slic_table); ++ for (i = 0; i < os->nacpiTables; i++) ++ virDomainOSACPITableDefFree(os->acpiTables[i]); ++ g_free(os->acpiTables); + virDomainLoaderDefFree(os->loader); + g_free(os->bootloader); + g_free(os->bootloaderArgs); +@@ -17849,40 +17865,57 @@ virDomainDefParseBootAcpiOptions(virDomainDef *def, + int n; + g_autofree xmlNodePtr *nodes = NULL; + g_autofree char *tmp = NULL; ++ size_t ntables = 0; ++ virDomainOSACPITableDef **tables = NULL; ++ size_t i; + + if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0) + return -1; + +- if (n > 1) { +- virReportError(VIR_ERR_XML_ERROR, "%s", +- _("Only one acpi table is supported")); +- return -1; +- } ++ if (n == 0) ++ return 0; + +- if (n == 1) { +- tmp = virXMLPropString(nodes[0], "type"); ++ tables = g_new0(virDomainOSACPITableDef *, n); ++ for (i = 0; i < n; i++) { ++ g_autofree char *path = virXMLNodeContentString(nodes[i]); ++ virDomainOsACPITable type; ++ size_t j; + +- if (!tmp) { +- virReportError(VIR_ERR_XML_ERROR, "%s", +- _("Missing acpi table type")); +- return -1; ++ if (!path) ++ goto error; ++ ++ if (virXMLPropEnum(nodes[i], "type", ++ virDomainOsACPITableTypeFromString, ++ VIR_XML_PROP_REQUIRED, ++ &type) < 0) ++ goto error; ++ ++ for (j = 0; j < i; j++) { ++ if (tables[j]->type == type) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("ACPI table type '%1$s' may only appear once"), ++ virDomainOsACPITableTypeToString(type)); ++ goto error; ++ } + } + +- if (STREQ_NULLABLE(tmp, "slic")) { +- VIR_FREE(tmp); +- if (!(tmp = virXMLNodeContentString(nodes[0]))) +- return -1; +- +- def->os.slic_table = virFileSanitizePath(tmp); +- } else { +- virReportError(VIR_ERR_XML_ERROR, +- _("Unknown acpi table type: %1$s"), +- tmp); +- return -1; +- } ++ tables[ntables] = g_new0(virDomainOSACPITableDef, 1); ++ tables[ntables]->type = type; ++ tables[ntables]->path = virFileSanitizePath(path); ++ ntables++; + } + ++ def->os.nacpiTables = ntables; ++ def->os.acpiTables = tables; ++ + return 0; ++ ++ error: ++ for (i = 0; i < ntables; i++) { ++ virDomainOSACPITableDefFree(tables[i]); ++ } ++ g_free(tables); ++ return -1; + } + + +@@ -28447,11 +28480,16 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def, + def->os.dtb); + virBufferEscapeString(buf, "%s\n", + def->os.root); +- if (def->os.slic_table) { ++ ++ if (def->os.nacpiTables) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); +- virBufferEscapeString(buf, "%s
\n", +- def->os.slic_table); ++ for (i = 0; i < def->os.nacpiTables; i++) { ++ virBufferAsprintf(buf, "", ++ virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type)); ++ virBufferEscapeString(buf, "%s
\n", ++ def->os.acpiTables[i]->path); ++ } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "
\n"); + } +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 2d38e8fa51..f52b80caec 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2462,6 +2462,24 @@ typedef enum { + + VIR_ENUM_DECL(virDomainOsDefFirmwareFeature); + ++typedef enum { ++ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC, ++ ++ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST ++} virDomainOsACPITable; ++ ++VIR_ENUM_DECL(virDomainOsACPITable); ++ ++struct _virDomainOSACPITableDef { ++ virDomainOsACPITable type; ++ char *path; ++}; ++ ++typedef struct _virDomainOSACPITableDef virDomainOSACPITableDef; ++void virDomainOSACPITableDefFree(virDomainOSACPITableDef *def); ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainOSACPITableDef, virDomainOSACPITableDefFree); ++ ++ + struct _virDomainOSDef { + int type; + virDomainOsDefFirmware firmware; +@@ -2484,7 +2502,8 @@ struct _virDomainOSDef { + char *cmdline; + char *dtb; + char *root; +- char *slic_table; ++ size_t nacpiTables; ++ virDomainOSACPITableDef **acpiTables; + virDomainLoaderDef *loader; + char *bootloader; + char *bootloaderArgs; +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 727ab52cfe..be313ad67b 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -609,6 +609,8 @@ virDomainObjTaint; + virDomainObjUpdateModificationImpact; + virDomainObjWait; + virDomainObjWaitUntil; ++virDomainOsACPITableTypeFromString; ++virDomainOsACPITableTypeToString; + virDomainOsDefFirmwareTypeFromString; + virDomainOsDefFirmwareTypeToString; + virDomainOSTypeFromString; +diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c +index c404226e43..7d845b97ec 100644 +--- a/src/libxl/libxl_conf.c ++++ b/src/libxl/libxl_conf.c +@@ -582,8 +582,9 @@ libxlMakeDomBuildInfo(virDomainDef *def, + VIR_TRISTATE_SWITCH_ON); + #endif + +- /* copy SLIC table path to acpi_firmware */ +- b_info->u.hvm.acpi_firmware = g_strdup(def->os.slic_table); ++ /* copy the table path to acpi_firmware */ ++ if (def->os.nacpiTables) ++ b_info->u.hvm.acpi_firmware = g_strdup(def->os.acpiTables[0]->path); + + if (def->nsounds > 0) { + /* +diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c +index 53f6871efc..062b753cea 100644 +--- a/src/libxl/xen_xl.c ++++ b/src/libxl/xen_xl.c +@@ -106,6 +106,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps) + g_autofree char *bios = NULL; + g_autofree char *bios_path = NULL; + g_autofree char *boot = NULL; ++ g_autofree char *slic = NULL; + int val = 0; + + if (xenConfigGetString(conf, "bios", &bios, NULL) < 0) +@@ -133,8 +134,15 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps) + } + } + +- if (xenConfigCopyStringOpt(conf, "acpi_firmware", &def->os.slic_table) < 0) ++ if (xenConfigCopyStringOpt(conf, "acpi_firmware", &slic) < 0) + return -1; ++ if (slic != NULL) { ++ def->os.nacpiTables = 1; ++ def->os.acpiTables = g_new0(virDomainOSACPITableDef *, 1); ++ def->os.acpiTables[0] = g_new0(virDomainOSACPITableDef, 1); ++ def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC; ++ def->os.acpiTables[0]->path = g_steal_pointer(&slic); ++ } + + if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0) + return -1; +@@ -1134,8 +1142,9 @@ xenFormatXLOS(virConf *conf, virDomainDef *def) + return -1; + } + +- if (def->os.slic_table && +- xenConfigSetString(conf, "acpi_firmware", def->os.slic_table) < 0) ++ if (def->os.nacpiTables && ++ xenConfigSetString(conf, "acpi_firmware", ++ def->os.acpiTables[0]->path) < 0) + return -1; + + if (def->os.kernel && +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 24dac0ce0f..756dd2168b 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -127,6 +127,11 @@ VIR_ENUM_IMPL(qemuNumaPolicy, + "restrictive", + ); + ++VIR_ENUM_DECL(qemuACPITableSIG); ++VIR_ENUM_IMPL(qemuACPITableSIG, ++ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST, ++ "SLIC"); ++ + + const char * + qemuAudioDriverTypeToString(virDomainAudioType type) +@@ -5968,6 +5973,7 @@ qemuBuildBootCommandLine(virCommand *cmd, + { + g_auto(virBuffer) boot_buf = VIR_BUFFER_INITIALIZER; + g_autofree char *boot_opts_str = NULL; ++ size_t i; + + if (def->os.bootmenu) { + if (def->os.bootmenu == VIR_TRISTATE_BOOL_YES) +@@ -6001,11 +6007,12 @@ qemuBuildBootCommandLine(virCommand *cmd, + virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL); + if (def->os.dtb) + virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL); +- if (def->os.slic_table) { ++ for (i = 0; i < def->os.nacpiTables; i++) { + g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; + virCommandAddArg(cmd, "-acpitable"); +- virBufferAddLit(&buf, "sig=SLIC,file="); +- virQEMUBuildBufferEscapeComma(&buf, def->os.slic_table); ++ virBufferAsprintf(&buf, "sig=%s,file=", ++ qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type)); ++ virQEMUBuildBufferEscapeComma(&buf, def->os.acpiTables[i]->path); + virCommandAddArgBuffer(cmd, &buf); + } + +diff --git a/src/security/security_dac.c b/src/security/security_dac.c +index 0505f4e4a3..b4d61bc576 100644 +--- a/src/security/security_dac.c ++++ b/src/security/security_dac.c +@@ -2050,9 +2050,10 @@ virSecurityDACRestoreAllLabel(virSecurityManager *mgr, + virSecurityDACRestoreFileLabel(mgr, def->os.dtb) < 0) + rc = -1; + +- if (def->os.slic_table && +- virSecurityDACRestoreFileLabel(mgr, def->os.slic_table) < 0) +- rc = -1; ++ for (i = 0; i < def->os.nacpiTables; i++) { ++ if (virSecurityDACRestoreFileLabel(mgr, def->os.acpiTables[i]->path) < 0) ++ rc = -1; ++ } + + if (def->pstore && + virSecurityDACRestoreFileLabel(mgr, def->pstore->path) < 0) +@@ -2300,11 +2301,12 @@ virSecurityDACSetAllLabel(virSecurityManager *mgr, + user, group, true) < 0) + return -1; + +- if (def->os.slic_table && +- virSecurityDACSetOwnership(mgr, NULL, +- def->os.slic_table, +- user, group, true) < 0) +- return -1; ++ for (i = 0; i < def->os.nacpiTables; i++) { ++ if (virSecurityDACSetOwnership(mgr, NULL, ++ def->os.acpiTables[i]->path, ++ user, group, true) < 0) ++ return -1; ++ } + + if (def->pstore && + virSecurityDACSetOwnership(mgr, NULL, +diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c +index cdc32d9b34..b8659e33d6 100644 +--- a/src/security/security_selinux.c ++++ b/src/security/security_selinux.c +@@ -3013,9 +3013,10 @@ virSecuritySELinuxRestoreAllLabel(virSecurityManager *mgr, + virSecuritySELinuxRestoreFileLabel(mgr, def->os.dtb, true) < 0) + rc = -1; + +- if (def->os.slic_table && +- virSecuritySELinuxRestoreFileLabel(mgr, def->os.slic_table, true) < 0) +- rc = -1; ++ for (i = 0; i < def->os.nacpiTables; i++) { ++ if (virSecuritySELinuxRestoreFileLabel(mgr, def->os.acpiTables[i]->path, true) < 0) ++ rc = -1; ++ } + + if (def->pstore && + virSecuritySELinuxRestoreFileLabel(mgr, def->pstore->path, true) < 0) +@@ -3443,10 +3444,11 @@ virSecuritySELinuxSetAllLabel(virSecurityManager *mgr, + data->content_context, true) < 0) + return -1; + +- if (def->os.slic_table && +- virSecuritySELinuxSetFilecon(mgr, def->os.slic_table, +- data->content_context, true) < 0) +- return -1; ++ for (i = 0; i < def->os.nacpiTables; i++) { ++ if (virSecuritySELinuxSetFilecon(mgr, def->os.acpiTables[i]->path, ++ data->content_context, true) < 0) ++ return -1; ++ } + + if (def->pstore && + virSecuritySELinuxSetFilecon(mgr, def->pstore->path, +diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c +index e82b5de2b4..e68e908994 100644 +--- a/src/security/virt-aa-helper.c ++++ b/src/security/virt-aa-helper.c +@@ -1002,9 +1002,10 @@ get_files(vahControl * ctl) + if (vah_add_file(&buf, ctl->def->os.dtb, "r") != 0) + goto cleanup; + +- if (ctl->def->os.slic_table) +- if (vah_add_file(&buf, ctl->def->os.slic_table, "r") != 0) ++ for (i = 0; i < ctl->def->os.nacpiTables; i++) { ++ if (vah_add_file(&buf, ctl->def->os.acpiTables[i]->path, "r") != 0) + goto cleanup; ++ } + + if (ctl->def->pstore) + if (vah_add_file(&buf, ctl->def->pstore->path, "rw") != 0) +-- +2.49.0 diff --git a/libvirt-conf-support-MSDM-ACPI-table-type.patch b/libvirt-conf-support-MSDM-ACPI-table-type.patch new file mode 100644 index 0000000..6edcd23 --- /dev/null +++ b/libvirt-conf-support-MSDM-ACPI-table-type.patch @@ -0,0 +1,119 @@ +From bfde8a471a604ddc3bfe7ee5baddbedc379ddf34 Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 17 Feb 2025 16:58:27 +0000 +Subject: [PATCH] conf: support MSDM ACPI table type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The MSDM ACPI table is an alternative for the SLIC table type, +sometimes used by Microsoft for Windows Licensing checks: + + https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85) + +Reviewed-by: Michal Privoznik +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 32765cd14e99411dfd14a230be86f2aecf7e9a7a) +Resolves: https://issues.redhat.com/browse/RHEL-81041 +--- + docs/formatdomain.rst | 4 ++++ + src/conf/domain_conf.c | 1 + + src/conf/domain_conf.h | 1 + + src/conf/schemas/domaincommon.rng | 1 + + src/libxl/libxl_domain.c | 1 + + src/qemu/qemu_command.c | 3 ++- + src/qemu/qemu_validate.c | 1 + + 7 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index b03b5317aa..c144851b62 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -497,6 +497,10 @@ These options apply to any form of booting of the guest OS. + software licensing information. The ACPI table signature in the + header will be forced to ``SLIC`` (:since:`Since 1.3.5 (QEMU)`, + mis-interpreted as ``rawset`` :since:`Since 5.9.0 (Xen)`). ++ * ``msdm``: a single ACPI table with header and data, providing ++ Microsoft Data Management information. The ACPI table signature ++ in the header will be forced to ``MSDM`` ++ (:since:`Since 11.2.0`). + + Each type may be used only once, except for ``raw`` which can + appear multiple times. +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 2ee0403c86..f6d3d849eb 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -1461,6 +1461,7 @@ VIR_ENUM_IMPL(virDomainOsACPITable, + "raw", + "rawset", + "slic", ++ "msdm", + ); + + VIR_ENUM_IMPL(virDomainCFPC, +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index bc3f42888e..961b7b056c 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2466,6 +2466,7 @@ typedef enum { + VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW, + VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET, + VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC, ++ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM, + + VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST + } virDomainOsACPITable; +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 99bcc90d4f..d46eb44588 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -7192,6 +7192,7 @@ + raw + rawset + slic ++ msdm + + + +diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c +index e31d92d903..c5a556ec78 100644 +--- a/src/libxl/libxl_domain.c ++++ b/src/libxl/libxl_domain.c +@@ -339,6 +339,7 @@ libxlDomainDefValidate(const virDomainDef *def, + break; + + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW: ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("ACPI table type '%1$s' is not supported"), + virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type)); +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index adf7b21b14..9fe191d3b9 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -132,7 +132,8 @@ VIR_ENUM_IMPL(qemuACPITableSIG, + VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST, + "", /* raw */ + "", /* rawset */ +- "SLIC"); ++ "SLIC", ++ ""); + + + const char * +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index b088e54dd0..378f502ea7 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -734,6 +734,7 @@ qemuValidateDomainDefBoot(const virDomainDef *def, + break; + + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET: ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("ACPI table type '%1$s' is not supported"), + virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type)); +-- +2.49.0 diff --git a/libvirt-libxl-support-rawset-ACPI-table-type.patch b/libvirt-libxl-support-rawset-ACPI-table-type.patch new file mode 100644 index 0000000..f1adca5 --- /dev/null +++ b/libvirt-libxl-support-rawset-ACPI-table-type.patch @@ -0,0 +1,85 @@ +From fb8c22b5606b2c3d0881df8df05ad1c909b247b2 Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 26 Feb 2025 19:10:42 +0000 +Subject: [PATCH] libxl: support 'rawset' ACPI table type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes representation of the 'acpi_firmware' config in the Xen +driver, which repesents a concatenation of tables of any type. + +Use of 'type=slic' is accepted on input for backwards compatibility. + +Reviewed-by: Michal Privoznik +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit dac6ecba6f75bff11fbddb2bce8ca9b576ea6a74) +Resolves: https://issues.redhat.com/browse/RHEL-81041 +--- + docs/formatdomain.rst | 2 +- + src/libxl/libxl_domain.c | 5 +++-- + src/libxl/xen_xl.c | 2 +- + tests/xlconfigdata/test-fullvirt-acpi-slic.xml | 2 +- + 4 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index ff06efb69f..b03b5317aa 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -492,7 +492,7 @@ These options apply to any form of booting of the guest OS. + signature auto-detected from header (:since:`Since 11.2.0 (QEMU)`). + * ``rawset``: concatenation of multiple ACPI tables with header + and data, each with any ACPI signature, auto-detected from header +- (:since:`Since 11.2.0`). ++ (:since:`Since 11.2.0 (Xen)`). + * ``slic``: a single ACPI table with header and data, providing + software licensing information. The ACPI table signature in the + header will be forced to ``SLIC`` (:since:`Since 1.3.5 (QEMU)`, +diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c +index e564d9e5fe..e31d92d903 100644 +--- a/src/libxl/libxl_domain.c ++++ b/src/libxl/libxl_domain.c +@@ -333,11 +333,12 @@ libxlDomainDefValidate(const virDomainDef *def, + + for (i = 0; i < def->os.nacpiTables; i++) { + switch (def->os.acpiTables[i]->type) { +- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC: ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC: /* Back compat for historical mistake, ++ * functionally the same as 'rawset' */ ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET: + break; + + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW: +- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("ACPI table type '%1$s' is not supported"), + virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type)); +diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c +index 062b753cea..9d06315661 100644 +--- a/src/libxl/xen_xl.c ++++ b/src/libxl/xen_xl.c +@@ -140,7 +140,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps) + def->os.nacpiTables = 1; + def->os.acpiTables = g_new0(virDomainOSACPITableDef *, 1); + def->os.acpiTables[0] = g_new0(virDomainOSACPITableDef, 1); +- def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC; ++ def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET; + def->os.acpiTables[0]->path = g_steal_pointer(&slic); + } + +diff --git a/tests/xlconfigdata/test-fullvirt-acpi-slic.xml b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml +index 366d877624..bf617e5e05 100644 +--- a/tests/xlconfigdata/test-fullvirt-acpi-slic.xml ++++ b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml +@@ -8,7 +8,7 @@ + hvm + /usr/lib/xen/boot/hvmloader + +- /sys/firmware/acpi/tables/SLIC
++ /sys/firmware/acpi/tables/SLIC
+
+ + +-- +2.49.0 diff --git a/libvirt-network-Free-inhibitor-in-networkStateCleanup.patch b/libvirt-network-Free-inhibitor-in-networkStateCleanup.patch new file mode 100644 index 0000000..e6883dc --- /dev/null +++ b/libvirt-network-Free-inhibitor-in-networkStateCleanup.patch @@ -0,0 +1,44 @@ +From 2ea12b6f6eed044dd7100ed19565319227f7384f Mon Sep 17 00:00:00 2001 +Message-ID: <2ea12b6f6eed044dd7100ed19565319227f7384f.1742990721.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Thu, 13 Mar 2025 13:01:19 +0100 +Subject: [PATCH] network: Free inhibitor in networkStateCleanup() + +The shutdown inhibitor is created in networkStateInitialize() but +corresponding call to virInhibitorFree() is missing in +networkStateCleanup() leading to a memleak: + +116 (72 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 1,769 of 1,998 + at 0x484CEF3: calloc (vg_replace_malloc.c:1675) + by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5) + by 0x4993B9B: virInhibitorNew (virinhibitor.c:152) + by 0x5279394: networkStateInitialize (bridge_driver.c:654) + by 0x4CC74DC: virStateInitialize (libvirt.c:665) + by 0x15B719: daemonRunStateInit (remote_daemon.c:613) + by 0x49F2B44: virThreadHelper (virthread.c:256) + by 0x5356662: start_thread (in /usr/lib64/libc.so.6) + by 0x53D7DA3: clone (in /usr/lib64/libc.so.6) + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 8701ba4feb528109da8b72fa48a8ada50a235807) +Resolves: https://issues.redhat.com/browse/RHEL-83064 +--- + src/network/bridge_driver.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c +index ce793c12ef..adcff6f34f 100644 +--- a/src/network/bridge_driver.c ++++ b/src/network/bridge_driver.c +@@ -802,6 +802,8 @@ networkStateCleanup(void) + network_driver->lockFD); + } + ++ virInhibitorFree(network_driver->inhibitor); ++ + virObjectUnref(network_driver->config); + virObjectUnref(network_driver->dnsmasqCaps); + +-- +2.49.0 diff --git a/libvirt-qemu-process-Remove-un-updated-qemuProcessStartWarnShmem.patch b/libvirt-qemu-process-Remove-un-updated-qemuProcessStartWarnShmem.patch new file mode 100644 index 0000000..c780ea6 --- /dev/null +++ b/libvirt-qemu-process-Remove-un-updated-qemuProcessStartWarnShmem.patch @@ -0,0 +1,94 @@ +From f61b747b0420d71efe33f836a1117d4741ecd716 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Peter Krempa +Date: Tue, 11 Mar 2025 09:04:18 +0100 +Subject: [PATCH] qemu: process: Remove un-updated 'qemuProcessStartWarnShmem' + +The checks in qemuProcessStartWarnShmem are no longer current. Since +previous patch made it fatal for vhost-user interfaces to be configured +without shared memory this warning code can be deleted. + +Resolves: https://issues.redhat.com/browse/RHEL-80533 +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit 080c7fd341619a3d1986a00265addaf45b63aacf) + +https://issues.redhat.com/browse/RHEL-84133 +--- + src/qemu/qemu_process.c | 54 ----------------------------------------- + 1 file changed, 54 deletions(-) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 722e982b9e..fac5678439 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -5406,56 +5406,6 @@ qemuProcessMakeDir(virQEMUDriver *driver, + } + + +-static void +-qemuProcessStartWarnShmem(virDomainObj *vm) +-{ +- size_t i; +- bool check_shmem = false; +- bool shmem = vm->def->nshmems; +- +- /* +- * For vhost-user to work, the domain has to have some type of +- * shared memory configured. We're not the proper ones to judge +- * whether shared hugepages or shm are enough and will be in the +- * future, so we'll just warn in case neither is configured. +- * Moreover failing would give the false illusion that libvirt is +- * really checking that everything works before running the domain +- * and not only we are unable to do that, but it's also not our +- * aim to do so. +- */ +- for (i = 0; i < vm->def->nnets; i++) { +- if (virDomainNetGetActualType(vm->def->nets[i]) == +- VIR_DOMAIN_NET_TYPE_VHOSTUSER) { +- check_shmem = true; +- break; +- } +- } +- +- if (!check_shmem) +- return; +- +- /* +- * This check is by no means complete. We merely check +- * whether there are *some* hugepages enabled and *some* NUMA +- * nodes with shared memory access. +- */ +- if (!shmem && vm->def->mem.nhugepages) { +- for (i = 0; i < virDomainNumaGetNodeCount(vm->def->numa); i++) { +- if (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa, i) == +- VIR_DOMAIN_MEMORY_ACCESS_SHARED) { +- shmem = true; +- break; +- } +- } +- } +- +- if (!shmem) { +- VIR_WARN("Detected vhost-user interface without any shared memory, " +- "the interface might not be operational"); +- } +-} +- +- + static int + qemuProcessStartValidateGraphics(virDomainObj *vm) + { +@@ -5690,10 +5640,6 @@ qemuProcessStartValidate(virQEMUDriver *driver, + if (qemuProcessStartValidateTSC(driver, vm) < 0) + return -1; + +- VIR_DEBUG("Checking for any possible (non-fatal) issues"); +- +- qemuProcessStartWarnShmem(vm); +- + return 0; + } + +-- +2.49.0 diff --git a/libvirt-qemu-support-MSDM-ACPI-table-type.patch b/libvirt-qemu-support-MSDM-ACPI-table-type.patch new file mode 100644 index 0000000..bf5f77e --- /dev/null +++ b/libvirt-qemu-support-MSDM-ACPI-table-type.patch @@ -0,0 +1,108 @@ +From d50549c9b0e601bc3a6ae5ee97d1ff2f75645f57 Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 17 Feb 2025 16:58:27 +0000 +Subject: [PATCH] qemu: support MSDM ACPI table type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The MSDM ACPI table is a replacement for the SLIC table type, now +sometimes used by Microsoft for Windows Licensing checks: + + https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85) + +Resolves: https://gitlab.com/libvirt/libvirt/-/issues/748 +Reviewed-by: Michal Privoznik +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 288f90feb32e38dfd246cbfb68f38caca43cef70) +Resolves: https://issues.redhat.com/browse/RHEL-81041 +--- + docs/formatdomain.rst | 2 +- + src/qemu/qemu_command.c | 2 +- + src/qemu/qemu_validate.c | 2 +- + tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args | 1 + + tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml | 1 + + tests/qemuxmlconfdata/acpi-table-many.xml | 1 + + 6 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index c144851b62..961d20a41d 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -500,7 +500,7 @@ These options apply to any form of booting of the guest OS. + * ``msdm``: a single ACPI table with header and data, providing + Microsoft Data Management information. The ACPI table signature + in the header will be forced to ``MSDM`` +- (:since:`Since 11.2.0`). ++ (:since:`Since 11.2.0 (QEMU)`). + + Each type may be used only once, except for ``raw`` which can + appear multiple times. +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 9fe191d3b9..b7d61edd19 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -133,7 +133,7 @@ VIR_ENUM_IMPL(qemuACPITableSIG, + "", /* raw */ + "", /* rawset */ + "SLIC", +- ""); ++ "MSDM"); + + + const char * +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index 378f502ea7..f814ee8c0d 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -731,10 +731,10 @@ qemuValidateDomainDefBoot(const virDomainDef *def, + switch (def->os.acpiTables[i]->type) { + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW: + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC: ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM: + break; + + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET: +- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("ACPI table type '%1$s' is not supported"), + virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type)); +diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args +index 4d5d02cb3c..2b0b433258 100644 +--- a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args ++++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args +@@ -30,6 +30,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ + -acpitable file=/var/lib/libvirt/acpi/exm2.dat \ + -acpitable file=/var/lib/libvirt/acpi/exm3.dat \ + -acpitable sig=SLIC,file=/var/lib/libvirt/acpi/slic.dat \ ++-acpitable sig=MSDM,file=/var/lib/libvirt/acpi/msdm.dat \ + -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ + -audiodev '{"id":"audio1","driver":"none"}' \ + -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml +index b7f7e18d28..084bb4cda3 100644 +--- a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml ++++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml +@@ -11,6 +11,7 @@ + /var/lib/libvirt/acpi/exm2.dat
+ /var/lib/libvirt/acpi/exm3.dat
+ /var/lib/libvirt/acpi/slic.dat
++ /var/lib/libvirt/acpi/msdm.dat
+ + + +diff --git a/tests/qemuxmlconfdata/acpi-table-many.xml b/tests/qemuxmlconfdata/acpi-table-many.xml +index cc75011990..890078d4c3 100644 +--- a/tests/qemuxmlconfdata/acpi-table-many.xml ++++ b/tests/qemuxmlconfdata/acpi-table-many.xml +@@ -12,6 +12,7 @@ + /var/lib/libvirt/acpi/exm2.dat
+ /var/lib/libvirt/acpi/exm3.dat
+ /var/lib/libvirt/acpi/slic.dat
++ /var/lib/libvirt/acpi/msdm.dat
+ + + +-- +2.49.0 diff --git a/libvirt-qemu-support-raw-ACPI-table-type.patch b/libvirt-qemu-support-raw-ACPI-table-type.patch new file mode 100644 index 0000000..650183b --- /dev/null +++ b/libvirt-qemu-support-raw-ACPI-table-type.patch @@ -0,0 +1,218 @@ +From b83e3e1644dc33a41fa4ccd62407aeca218bbd4c Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 26 Feb 2025 19:10:42 +0000 +Subject: [PATCH] qemu: support 'raw' ACPI table type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows passing a single ACPI table of any type through to QEMU with +the signture autodetected from the header. + +Reviewed-by: Michal Privoznik +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit fe0cf62e0f8a6c4bbc2f297f46761f41691e3193) +Resolves: https://issues.redhat.com/browse/RHEL-81041 +--- + docs/formatdomain.rst | 2 +- + src/qemu/qemu_command.c | 6 ++- + src/qemu/qemu_validate.c | 2 +- + .../acpi-table-many.x86_64-latest.args | 36 ++++++++++++++++ + .../acpi-table-many.x86_64-latest.xml | 41 +++++++++++++++++++ + tests/qemuxmlconfdata/acpi-table-many.xml | 33 +++++++++++++++ + tests/qemuxmlconftest.c | 1 + + 7 files changed, 117 insertions(+), 4 deletions(-) + create mode 100644 tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args + create mode 100644 tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml + create mode 100644 tests/qemuxmlconfdata/acpi-table-many.xml + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index b6e162235c..ff06efb69f 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -489,7 +489,7 @@ These options apply to any form of booting of the guest OS. + file: + + * ``raw``: a single ACPI table with header and data, with ACPI +- signature auto-detected from header (:since:`Since 11.2.0`). ++ signature auto-detected from header (:since:`Since 11.2.0 (QEMU)`). + * ``rawset``: concatenation of multiple ACPI tables with header + and data, each with any ACPI signature, auto-detected from header + (:since:`Since 11.2.0`). +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 94fb7fc4c2..adf7b21b14 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -6011,9 +6011,11 @@ qemuBuildBootCommandLine(virCommand *cmd, + virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL); + for (i = 0; i < def->os.nacpiTables; i++) { + g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; ++ const char *sig = qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type); + virCommandAddArg(cmd, "-acpitable"); +- virBufferAsprintf(&buf, "sig=%s,file=", +- qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type)); ++ if (*sig != '\0') ++ virBufferAsprintf(&buf, "sig=%s,", sig); ++ virBufferAddLit(&buf, "file="); + virQEMUBuildBufferEscapeComma(&buf, def->os.acpiTables[i]->path); + virCommandAddArgBuffer(cmd, &buf); + } +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index 8ef0257d73..b088e54dd0 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -729,10 +729,10 @@ qemuValidateDomainDefBoot(const virDomainDef *def, + + for (i = 0; i < def->os.nacpiTables; i++) { + switch (def->os.acpiTables[i]->type) { ++ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW: + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC: + break; + +- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW: + case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("ACPI table type '%1$s' is not supported"), +diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args +new file mode 100644 +index 0000000000..4d5d02cb3c +--- /dev/null ++++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args +@@ -0,0 +1,36 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ ++USER=test \ ++LOGNAME=test \ ++XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ ++XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ ++XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ ++/usr/bin/qemu-system-x86_64 \ ++-name guest=QEMUGuest1,debug-threads=on \ ++-S \ ++-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 \ ++-m size=219136k \ ++-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ ++-overcommit mem-lock=off \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ ++-display none \ ++-no-user-config \ ++-nodefaults \ ++-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ ++-mon chardev=charmonitor,id=monitor,mode=control \ ++-rtc base=utc \ ++-no-shutdown \ ++-boot strict=on \ ++-acpitable file=/var/lib/libvirt/acpi/exm1.dat \ ++-acpitable file=/var/lib/libvirt/acpi/exm2.dat \ ++-acpitable file=/var/lib/libvirt/acpi/exm3.dat \ ++-acpitable sig=SLIC,file=/var/lib/libvirt/acpi/slic.dat \ ++-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ ++-audiodev '{"id":"audio1","driver":"none"}' \ ++-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ ++-msg timestamp=on +diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml +new file mode 100644 +index 0000000000..b7f7e18d28 +--- /dev/null ++++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml +@@ -0,0 +1,41 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 1 ++ ++ hvm ++ ++ /var/lib/libvirt/acpi/exm1.dat
++ /var/lib/libvirt/acpi/exm2.dat
++ /var/lib/libvirt/acpi/exm3.dat
++ /var/lib/libvirt/acpi/slic.dat
++
++ ++
++ ++ ++ ++ ++ qemu64 ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-x86_64 ++ ++
++ ++ ++
++ ++ ++ ++ ++