From patchwork Sat Jan 9 21:32:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 59432 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1293575lbb; Sat, 9 Jan 2016 13:35:47 -0800 (PST) X-Received: by 10.140.169.139 with SMTP id p133mr161941701qhp.50.1452375347738; Sat, 09 Jan 2016 13:35:47 -0800 (PST) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id l3si13321040qki.63.2016.01.09.13.35.46 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jan 2016 13:35:47 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u09LXJa2018281; Sat, 9 Jan 2016 16:33:19 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u09LWYqS003667 for ; Sat, 9 Jan 2016 16:32:34 -0500 Received: from colepc.redhat.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u09LWSow020408; Sat, 9 Jan 2016 16:32:34 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Sat, 9 Jan 2016 16:32:23 -0500 Message-Id: <02c3549b3e3f279aabc9638c71e9e500ceede04e.1452375080.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] qemu: command: wire up usage of q35/ich9 disable s3/s4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com If the q35 specific disable s3/s4 setting isn't disabled, 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) --- src/qemu/qemu_command.c | 32 ++++++++++++++++++---- .../qemuxml2argv-q35-pm-disable-fallback.args | 23 ++++++++++++++++ .../qemuxml2argv-q35-pm-disable-fallback.xml | 18 ++++++++++++ .../qemuxml2argv-q35-pm-disable.args | 23 ++++++++++++++++ .../qemuxml2argv-q35-pm-disable.xml | 18 ++++++++++++ tests/qemuxml2argvtest.c | 9 ++++++ 6 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.xml -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0ee3247..dc7adcb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9806,25 +9806,45 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->pm.s3) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) { + const char *pm_object = NULL; + + if (qemuDomainMachineIsQ35(def) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S3)) { + pm_object = "ICH9-LPC"; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3)) { + /* We fall back to this 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.*/ + pm_object = "PIIX4_PM"; + } else { 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; + + if (qemuDomainMachineIsQ35(def) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_DISABLE_S4)) { + pm_object = "ICH9-LPC"; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4)) { + pm_object = "PIIX4_PM"; + } else { 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); } /* diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.args new file mode 100644 index 0000000..bab2b68 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.xml new file mode 100644 index 0000000..95177ae --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable-fallback.xml @@ -0,0 +1,18 @@ + + q35 + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + + + + + /usr/bin/qemu-kvm + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.args new file mode 100644 index 0000000..dbf1119 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.xml new file mode 100644 index 0000000..95177ae --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pm-disable.xml @@ -0,0 +1,18 @@ + + q35 + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + + + + + /usr/bin/qemu-kvm + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b75d453..f361f2a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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,