]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: support 'raw' ACPI table type
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 26 Feb 2025 19:10:42 +0000 (19:10 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 7 Mar 2025 13:00:10 +0000 (13:00 +0000)
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>
docs/formatdomain.rst
src/qemu/qemu_command.c
src/qemu/qemu_validate.c
tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args [new file with mode: 0644]
tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml [new file with mode: 0644]
tests/qemuxmlconfdata/acpi-table-many.xml [new file with mode: 0644]
tests/qemuxmlconftest.c

index e914fa8ee624a8d76c2f1c5dcf55e68365f2d3d5..c108cc0c2a58afb907c55d63588eb4363fa2dcfd 100644 (file)
@@ -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`).
index bef06049ec53338586bec6e6866b073034dca2da..5ecc50d838fe85926439ea0be3d9da6550e67fd6 100644 (file)
@@ -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);
     }
index de36bfc7ea07008be88493ed2cebdf1c5a9cb89d..397e2073ef9a8d4775e2470079c8281715fe42c8 100644 (file)
@@ -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 (file)
index 0000000..4d5d02c
--- /dev/null
@@ -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 (file)
index 0000000..b7f7e18
--- /dev/null
@@ -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 (file)
index 0000000..cc75011
--- /dev/null
@@ -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>
index 37d275c83a71c706dda4ad609497e58c1248795c..e7f7e35f46842e5c478509f37c62971709ebf9c1 100644 (file)
@@ -2778,6 +2778,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");