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(a)redhat.com>
---
src/qemu/qemu_command.c | 40 +++++++------------
src/qemu/qemu_validate.c | 37 ++---------------
tests/qemuxml2argvdata/misc-enable-s4.err | 1 -
.../q35-pm-disable-fallback.args | 37 -----------------
.../q35-pm-disable-fallback.xml | 18 ---------
tests/qemuxml2argvdata/q35-pm-disable.args | 37 -----------------
tests/qemuxml2argvdata/q35-pm-disable.xml | 18 ---------
tests/qemuxml2argvdata/q35.args | 2 +
tests/qemuxml2argvdata/q35.xml | 4 ++
tests/qemuxml2argvtest.c | 18 ++-------
.../qemuxml2xmloutdata/q35.x86_64-latest.xml | 4 ++
11 files changed, 31 insertions(+), 185 deletions(-)
delete mode 100644 tests/qemuxml2argvdata/misc-enable-s4.err
delete mode 100644 tests/qemuxml2argvdata/q35-pm-disable-fallback.args
delete mode 100644 tests/qemuxml2argvdata/q35-pm-disable-fallback.xml
delete mode 100644 tests/qemuxml2argvdata/q35-pm-disable.args
delete mode 100644 tests/qemuxml2argvdata/q35-pm-disable.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a55218d5fd..f7079c6920 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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.s4) {
- const char *pm_object = "PIIX4_PM";
-
- if (qemuDomainIsQ35(def) &&
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4))
- pm_object = "ICH9-LPC";
+ if (def->pm.s3) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.disable_s3=%d",
+ pm_object, def->pm.s3 == VIR_TRISTATE_BOOL_NO);
+ }
- virCommandAddArg(cmd, "-global");
- virCommandAddArgFormat(cmd, "%s.disable_s4=%d",
- pm_object, def->pm.s4 == 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);
+ }
}
-
- 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;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 8f9e8fd7f0..d5fe1cbd73 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -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;
diff --git a/tests/qemuxml2argvdata/misc-enable-s4.err
b/tests/qemuxml2argvdata/misc-enable-s4.err
deleted file mode 100644
index a256b75792..0000000000
--- a/tests/qemuxml2argvdata/misc-enable-s4.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: setting ACPI S4 not supported
diff --git a/tests/qemuxml2argvdata/q35-pm-disable-fallback.args
b/tests/qemuxml2argvdata/q35-pm-disable-fallback.args
deleted file mode 100644
index 924e3087fb..0000000000
--- a/tests/qemuxml2argvdata/q35-pm-disable-fallback.args
+++ /dev/null
@@ -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
diff --git a/tests/qemuxml2argvdata/q35-pm-disable-fallback.xml
b/tests/qemuxml2argvdata/q35-pm-disable-fallback.xml
deleted file mode 100644
index 386391b270..0000000000
--- a/tests/qemuxml2argvdata/q35-pm-disable-fallback.xml
+++ /dev/null
@@ -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>
diff --git a/tests/qemuxml2argvdata/q35-pm-disable.args
b/tests/qemuxml2argvdata/q35-pm-disable.args
deleted file mode 100644
index f50ddcc118..0000000000
--- a/tests/qemuxml2argvdata/q35-pm-disable.args
+++ /dev/null
@@ -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
diff --git a/tests/qemuxml2argvdata/q35-pm-disable.xml
b/tests/qemuxml2argvdata/q35-pm-disable.xml
deleted file mode 100644
index 386391b270..0000000000
--- a/tests/qemuxml2argvdata/q35-pm-disable.xml
+++ /dev/null
@@ -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>
diff --git a/tests/qemuxml2argvdata/q35.args b/tests/qemuxml2argvdata/q35.args
index e4cb36b1d0..638c79d45f 100644
--- a/tests/qemuxml2argvdata/q35.args
+++ b/tests/qemuxml2argvdata/q35.args
@@ -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
\
diff --git a/tests/qemuxml2argvdata/q35.xml b/tests/qemuxml2argvdata/q35.xml
index 22a7aca47b..30697fb940 100644
--- a/tests/qemuxml2argvdata/q35.xml
+++ b/tests/qemuxml2argvdata/q35.xml
@@ -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>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1e6cbbf028..5d23c552c5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -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");
diff --git a/tests/qemuxml2xmloutdata/q35.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/q35.x86_64-latest.xml
index 909f94fe2c..3303370e7a 100644
--- a/tests/qemuxml2xmloutdata/q35.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/q35.x86_64-latest.xml
@@ -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'>
--
2.41.0