libvirt/libvirt-qemu-support-raw-ACPI-table-type.patch
Jiri Denemark 8026296455 libvirt-10.10.0-9.el9
- util: introduce object for holding a system inhibitor lock (RHEL-83064)
- src: convert drivers over to new virInhibitor APIs (RHEL-83064)
- rpc: remove logind support for virNetDaemon (RHEL-83064)
- util: fix off-by-1 in inhibitor constants (RHEL-83064)
- util: don't attempt to acquire logind inhibitor if not requested (RHEL-83064)
- network: Free inhibitor in networkStateCleanup() (RHEL-83064)
- conf: introduce support for multiple ACPI tables (RHEL-81041)
- src: validate permitted ACPI table types in libxl/qemu drivers (RHEL-81041)
- src: introduce 'raw' and 'rawset' ACPI table types (RHEL-81041)
- qemu: support 'raw' ACPI table type (RHEL-81041)
- libxl: support 'rawset' ACPI table type (RHEL-81041)
- conf: support MSDM ACPI table type (RHEL-81041)
- qemu: support MSDM ACPI table type (RHEL-81041)
- qemuxmlconftest: Include shared memory 'net-vhostuser' test cases (RHEL-84133)
- qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces (RHEL-84133)
- qemu: process: Remove un-updated 'qemuProcessStartWarnShmem' (RHEL-84133)

Resolves: RHEL-81041, RHEL-83064, RHEL-84133
2025-03-26 13:05:21 +01:00

219 lines
8.8 KiB
Diff

From b83e3e1644dc33a41fa4ccd62407aeca218bbd4c Mon Sep 17 00:00:00 2001
Message-ID: <b83e3e1644dc33a41fa4ccd62407aeca218bbd4c.1742990721.git.jdenemar@redhat.com>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
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 <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(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 @@
+<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 3947f508a2..2007944c29 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2767,6 +2767,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.49.0