This allows passing a single ACPI table of any type through to QEMU with the signture autodetected from the header. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- 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 d3add663e2..895f74a42a 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 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <acpi> + <table type='raw'>/var/lib/libvirt/acpi/exm1.dat</table> + <table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table> + <table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table> + <table type='slic'>/var/lib/libvirt/acpi/slic.dat</table> + </acpi> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='piix3-uhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/acpi-table-many.xml b/tests/qemuxmlconfdata/acpi-table-many.xml new file mode 100644 index 0000000000..cc75011990 --- /dev/null +++ b/tests/qemuxmlconfdata/acpi-table-many.xml @@ -0,0 +1,33 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + <acpi> + <table type='raw'>/var/lib/libvirt/acpi/exm1.dat</table> + <table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table> + <table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table> + <table type='slic'>/var/lib/libvirt/acpi/slic.dat</table> + </acpi> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 8632434760..2013b9be2f 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -2774,6 +2774,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-too-long-port-path-invalid"); DO_TEST_CAPS_LATEST("acpi-table"); + DO_TEST_CAPS_LATEST("acpi-table-many"); DO_TEST_CAPS_LATEST("intel-iommu"); DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); -- 2.47.1