qemu: command: wire up usage of q35/ich9 disable s3/s4

If the q35 specific disable s3/s4 setting isn't supported, fallback to
specifying the PIIX setting, which is the previous behavior. It doesn't
have any effect, but qemu will just warn about it rather than error:

  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s3=1 not used
  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s4=1 not used

Since it doesn't error, I don't think we should either, since there
may be configs in the wild that already have q35 + disable_s3/4 (via
virt-manager)
This commit is contained in:
Cole Robinson 2016-01-09 16:00:01 -05:00
parent c77fd89000
commit fde937bda0
6 changed files with 113 additions and 6 deletions

View File

@ -9805,26 +9805,42 @@ qemuBuildCommandLine(virConnectPtr conn,
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 (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) {
const char *pm_object = "PIIX4_PM";
if (qemuDomainMachineIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3)) {
pm_object = "ICH9-LPC";
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("setting ACPI S3 not supported"));
goto error;
}
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "PIIX4_PM.disable_s3=%d",
def->pm.s3 == VIR_TRISTATE_BOOL_NO);
virCommandAddArgFormat(cmd, "%s.disable_s3=%d",
pm_object, def->pm.s3 == VIR_TRISTATE_BOOL_NO);
}
if (def->pm.s4) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) {
const char *pm_object = "PIIX4_PM";
if (qemuDomainMachineIsQ35(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4)) {
pm_object = "ICH9-LPC";
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("setting ACPI S4 not supported"));
goto error;
}
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "PIIX4_PM.disable_s4=%d",
def->pm.s4 == VIR_TRISTATE_BOOL_NO);
virCommandAddArgFormat(cmd, "%s.disable_s4=%d",
pm_object, def->pm.s4 == VIR_TRISTATE_BOOL_NO);
}
/*

View File

@ -0,0 +1,23 @@
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-kvm \
-name q35 \
-S \
-M pc-q35-2.5 \
-m 1024 \
-smp 1 \
-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
-nographic \
-nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait \
-no-acpi \
-global PIIX4_PM.disable_s3=1 \
-global PIIX4_PM.disable_s4=1 \
-boot n \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1

View File

@ -0,0 +1,18 @@
<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='pc-q35-2.5'>hvm</type>
<boot dev='network'/>
</os>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
</devices>
</domain>

View File

@ -0,0 +1,23 @@
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-kvm \
-name q35 \
-S \
-M pc-q35-2.5 \
-m 1024 \
-smp 1 \
-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \
-nographic \
-nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait \
-no-acpi \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot n \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1

View File

@ -0,0 +1,18 @@
<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='pc-q35-2.5'>hvm</type>
<boot dev='network'/>
</os>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
</devices>
</domain>

View File

@ -1506,6 +1506,15 @@ mymain(void)
QEMU_CAPS_ICH9_AHCI,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
DO_TEST("q35-pm-disable",
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
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, QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
DO_TEST("pcie-root-port",
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,