qemu: Always assume support for QEMU_CAPS_PIIX_DISABLE_S* and QEMU_CAPS_ICH9_DISABLE_S*

The support for PIIX power management was added in qemu commit
v1.0-3094-g459ae5ea5a and the suport for ICH9 power management was added
in qemu commit v2.2.0-542-g6ac0d8d44c and both can't be compiled out.

This means we can always assume support for these features. Remove the
validation and impossible tests. Move relevant bits from
'q35-pm-disable' to 'q35' test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-09-01 16:57:34 +02:00
parent 5e73c89d22
commit c225398015
11 changed files with 32 additions and 186 deletions

View File

@ -6047,7 +6047,7 @@ qemuBuildClockCommandLine(virCommand *cmd,
}
static int
static void
qemuBuildPMCommandLine(virCommand *cmd,
const virDomainDef *def,
qemuDomainObjPrivate *priv)
@ -6075,35 +6075,24 @@ qemuBuildPMCommandLine(virCommand *cmd,
virCommandAddArg(cmd, "-no-acpi");
}
/* We fall back to PIIX4_PM even for q35, since it's what we did
pre-q35-pm support. QEMU starts up fine (with a warning) if
mixing PIIX PM and -M q35. Starting to reject things here
could mean we refuse to start existing configs in the wild.*/
if (def->pm.s3) {
if (def->pm.s3 || def->pm.s4) {
const char *pm_object = "PIIX4_PM";
if (qemuDomainIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3))
if (qemuDomainIsQ35(def))
pm_object = "ICH9-LPC";
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.disable_s3=%d",
pm_object, def->pm.s3 == VIR_TRISTATE_BOOL_NO);
if (def->pm.s3) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.disable_s3=%d",
pm_object, def->pm.s3 == VIR_TRISTATE_BOOL_NO);
}
if (def->pm.s4) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.disable_s4=%d",
pm_object, def->pm.s4 == VIR_TRISTATE_BOOL_NO);
}
}
if (def->pm.s4) {
const char *pm_object = "PIIX4_PM";
if (qemuDomainIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4))
pm_object = "ICH9-LPC";
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.disable_s4=%d",
pm_object, def->pm.s4 == VIR_TRISTATE_BOOL_NO);
}
return 0;
}
@ -10444,8 +10433,7 @@ qemuBuildCommandLine(virDomainObj *vm,
if (qemuBuildClockCommandLine(cmd, def, qemuCaps) < 0)
return NULL;
if (qemuBuildPMCommandLine(cmd, def, priv) < 0)
return NULL;
qemuBuildPMCommandLine(cmd, def, priv);
if (qemuBuildBootCommandLine(cmd, def) < 0)
return NULL;

View File

@ -588,38 +588,6 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
}
static int
qemuValidateDomainDefPM(const virDomainDef *def,
virQEMUCaps *qemuCaps)
{
bool q35Dom = qemuDomainIsQ35(def);
if (def->pm.s3) {
bool q35ICH9_S3 = q35Dom &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3);
if (!q35ICH9_S3 && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("setting ACPI S3 not supported"));
return -1;
}
}
if (def->pm.s4) {
bool q35ICH9_S4 = q35Dom &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4);
if (!q35ICH9_S4 && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("setting ACPI S4 not supported"));
return -1;
}
}
return 0;
}
static int
qemuValidateDomainDefNvram(const virDomainDef *def,
virQEMUCaps *qemuCaps)
@ -1279,8 +1247,11 @@ qemuValidateDomainDef(const virDomainDef *def,
if (qemuValidateDomainDefClockTimers(def, qemuCaps) < 0)
return -1;
if (qemuValidateDomainDefPM(def, qemuCaps) < 0)
if ((def->pm.s3 || def->pm.s4) && !ARCH_IS_X86(def->os.arch)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("setting ACPI S3/S4 not supported"));
return -1;
}
if (qemuValidateDomainDefBoot(def, qemuCaps) < 0)
return -1;

View File

@ -1 +0,0 @@
unsupported configuration: setting ACPI S4 not supported

View File

@ -1,37 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-q35 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-q35/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-q35/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-q35/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=q35,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-q35/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
-m size=1048576k \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
-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 \
-no-acpi \
-global PIIX4_PM.disable_s3=1 \
-global PIIX4_PM.disable_s4=1 \
-boot strict=on \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device ioh3420,port=8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
-audiodev '{"id":"audio1","driver":"none"}' \
-global ICH9-LPC.noreboot=off \
-watchdog-action reset \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
-msg timestamp=on

View File

@ -1,18 +0,0 @@
<domain type='qemu'>
<name>q35</name>
<uuid>56f5055c-1b8d-490c-844a-ad646a1caaaa</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='q35'>hvm</type>
<boot dev='network'/>
</os>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
</devices>
</domain>

View File

@ -1,37 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-q35 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-q35/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-q35/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-q35/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=q35,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-q35/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
-m size=1048576k \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
-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 \
-no-acpi \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device ioh3420,port=8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
-audiodev '{"id":"audio1","driver":"none"}' \
-global ICH9-LPC.noreboot=off \
-watchdog-action reset \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
-msg timestamp=on

View File

@ -1,18 +0,0 @@
<domain type='qemu'>
<name>q35</name>
<uuid>56f5055c-1b8d-490c-844a-ad646a1caaaa</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='q35'>hvm</type>
<boot dev='network'/>
</os>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
</devices>
</domain>

View File

@ -24,6 +24,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-q35-test/.config \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=0 \
-boot strict=on \
-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d \

View File

@ -8,6 +8,10 @@
<type arch='x86_64' machine='q35'>hvm</type>
<boot dev='hd'/>
</os>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='yes'/>
</pm>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>

View File

@ -1394,10 +1394,9 @@ mymain(void)
DO_TEST_NOCAPS("input-usbmouse");
DO_TEST_NOCAPS("input-usbtablet");
DO_TEST_NOCAPS("misc-acpi");
DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3);
DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4);
DO_TEST_PARSE_ERROR_NOCAPS("misc-enable-s4");
DO_TEST_NOCAPS("misc-disable-s3");
DO_TEST_NOCAPS("misc-disable-suspends");
DO_TEST_NOCAPS("misc-enable-s4");
DO_TEST_CAPS_VER("misc-no-reboot", "5.2.0");
DO_TEST_CAPS_LATEST("misc-no-reboot");
DO_TEST_NOCAPS("misc-uuid");
@ -2135,17 +2134,6 @@ mymain(void)
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
QEMU_CAPS_DEVICE_IOH3420);
DO_TEST("q35-pm-disable",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
QEMU_CAPS_ICH9_DISABLE_S3, QEMU_CAPS_ICH9_DISABLE_S4);
DO_TEST("q35-pm-disable-fallback",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
DO_TEST_CAPS_LATEST("pc-i440fx-acpi-root-hotplug-disable");
DO_TEST_CAPS_LATEST("pc-i440fx-acpi-root-hotplug-enable");
DO_TEST_CAPS_VER_PARSE_ERROR("pc-i440fx-acpi-root-hotplug-disable", "5.1.0");

View File

@ -15,6 +15,10 @@
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='yes'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='block' device='disk'>