1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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 <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2025-02-26 19:10:42 +00:00
parent 513ef8f028
commit fe0cf62e0f
7 changed files with 117 additions and 4 deletions

View 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`).

View 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);
}

View 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"),

View File

@ -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

View File

@ -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>

View File

@ -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>

View 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");