From: Daniel P. Berrangé Date: Wed, 26 Feb 2025 19:10:42 +0000 (+0000) Subject: qemu: support 'raw' ACPI table type X-Git-Tag: v11.2.0-rc1~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe0cf62e0f8a6c4bbc2f297f46761f41691e3193;p=thirdparty%2Flibvirt.git qemu: support 'raw' ACPI table type 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é --- diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index e914fa8ee6..c108cc0c2a 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -495,7 +495,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 bef06049ec..5ecc50d838 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6038,9 +6038,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 de36bfc7ea..397e2073ef 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -744,10 +744,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 + +
+ + +
+ + + + +