From nobody Sat May 4 12:46:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629122547778501.4492036814495; Mon, 16 Aug 2021 07:02:27 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-236-mWpFMaoZMheDV2oUyZLZ5w-1; Mon, 16 Aug 2021 10:02:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F49F8799F6; Mon, 16 Aug 2021 14:02:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D54466FFF; Mon, 16 Aug 2021 14:02:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 413C14BB7C; Mon, 16 Aug 2021 14:02:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17GE2Anp011791 for ; Mon, 16 Aug 2021 10:02:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 65B6A21568A5; Mon, 16 Aug 2021 14:02:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6065621568A4 for ; Mon, 16 Aug 2021 14:02:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA22A805F7C for ; Mon, 16 Aug 2021 14:02:06 +0000 (UTC) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-agP69AFDNyKR6evnzBU4fQ-1; Mon, 16 Aug 2021 10:02:04 -0400 Received: by mail-pl1-f178.google.com with SMTP id n12so20152757plf.4 for ; Mon, 16 Aug 2021 07:02:03 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.199.67]) by smtp.googlemail.com with ESMTPSA id k22sm7682986pff.154.2021.08.16.07.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 07:02:01 -0700 (PDT) X-MC-Unique: mWpFMaoZMheDV2oUyZLZ5w-1 X-MC-Unique: agP69AFDNyKR6evnzBU4fQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hTdvI1fslwGLMR0sl8CveZQBgq4OXKqVZECDrIrmzws=; b=cwltNX7umWwcomWuNa5LxJ7nSq53y7k84jMzLjq7NiGgYCRT9MCyZ4Gdo/NT1VVGVT jhb/WExlodrQM5n+lf0aJcppgLq8K17bgpdoaHN4f779+2OXnjD7sfthLYJdaC9FAh33 5eXCQHjYKPxwN2mnZlr2TPxi0Yo17058jLCl/bufpbN9vNPNJ68nspmiuE0kl3YbXOSw c3eMoRwrgA9tAK7wvSCKzdox219IJZD4XEndlMf9/g/i4v7ynC2wTNz0ftyh1o23sPM4 EJZHJvNUK67XUwDJZDEpFiduqNsVitEcNOkOzwr1qeIErObiZnXCpnAD3UrEAXFAuO0W HpLA== X-Gm-Message-State: AOAM531zK+eqvlsTl/wZj9e+Ib9tzxFRP6Xg56ydimN2mzGezlckeTdf HbQASA9D8JnXcNtgCJz4AGXcqnVqWKtDJA== X-Google-Smtp-Source: ABdhPJyaRmBFl03Rx59Y/EZHO00la3d59CPXaLfBRbOhixI/bxdVXFRfHbiKYq6Szvvn8CWXeTVa/g== X-Received: by 2002:a63:712:: with SMTP id 18mr16269552pgh.277.1629122522511; Mon, 16 Aug 2021 07:02:02 -0700 (PDT) From: Ani Sinha To: libvir-list@redhat.com Subject: [RFC PATCH] add support for two global pm options that controls acpi hotplug on q35/i440fx Date: Mon, 16 Aug 2021 19:31:55 +0530 Message-Id: <20210816140155.183703-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Ani Sinha , laine@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1629122578205100005 Content-Type: text/plain; charset="utf-8" 'acpi-pci-hotplug-with-bridge-support' and 'acpi-root-pci-hotplug' are two = pm options in qemu that governs acpi hotplug support. This is a WIP patch that tries to implement support for both these two global qemu options. 'acpi-pci-hotplug-with-bridge-support' applies both for q35 as well as i440= fx platforms. The 'acpi-root-pci-hotplug' only applies for i440fx. 'acpi-pci-hotplug-with-bridge-support' can be turned off by providing the following xml snippet: Similarly, 'acpi-root-pci-hotplug' can be turned off by providing the follo= wing xml snippet: This change adds no unit tests. It will be added later on. It it sent for initial comments and suggestions. Signed-off-by: Ani Sinha --- src/conf/domain_conf.c | 10 ++++++++++ src/conf/domain_conf.h | 2 ++ src/qemu/qemu_capabilities.c | 9 +++++++++ src/qemu/qemu_capabilities.h | 5 +++++ src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++ src/qemu/qemu_validate.c | 21 +++++++++++++++++++++ 6 files changed, 75 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 06c1fcf5e5..512973e6f4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19351,6 +19351,16 @@ virDomainDefLifecycleParse(virDomainDef *def, &def->pm.s4) < 0) goto error; =20 + if (virDomainPMStateParseXML(ctxt, + "string(./pm/acpi-hotplug-bridge/@enabled= )", + &def->pm.acpi_hp_bridge) < 0) + goto error; + + if (virDomainPMStateParseXML(ctxt, + "string(./pm/acpi-root-hotplug/@enabled)", + &def->pm.acpi_root_hp) < 0) + goto error; + return 0; =20 error: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ca21082624..94283cbb04 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2643,6 +2643,8 @@ struct _virDomainPowerManagement { /* These options are of type enum virTristateBool */ int s3; int s4; + int acpi_hp_bridge; + int acpi_root_hp; }; =20 struct _virDomainPerfDef { diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9558938866..8dad4a6351 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -637,6 +637,11 @@ VIR_ENUM_IMPL(virQEMUCaps, "confidential-guest-support", "query-display-options", "s390-pv-guest", + "piix4-acpi-hotplug-bridge", + "piix4-acpi-root-hotplug-en", + + /* 410 */ + "ich9-acpi-hotplug-bridge", ); =20 =20 @@ -1467,6 +1472,9 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsIDEDrive[] =3D { static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPiix4PM[] = =3D { { "disable_s3", QEMU_CAPS_PIIX_DISABLE_S3, NULL }, { "disable_s4", QEMU_CAPS_PIIX_DISABLE_S4, NULL }, + { "acpi-pci-hotplug-with-bridge-support", QEMU_CAPS_PIIX_ACPI_HOTPLUG_= BRIDGE, NULL }, + { "acpi-root-pci-hotplug", QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG, NULL = }, + }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBRedir[]= =3D { @@ -1519,6 +1527,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioGpu[] =3D { static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsICH9[] =3D= { { "disable_s3", QEMU_CAPS_ICH9_DISABLE_S3, NULL }, { "disable_s4", QEMU_CAPS_ICH9_DISABLE_S4, NULL }, + { "acpi-pci-hotplug-with-bridge-support", QEMU_CAPS_ICH9_ACPI_HOTPLUG_= BRIDGE, NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBNECXHCI= [] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2b1bb57a49..e988527f39 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -617,6 +617,11 @@ typedef enum { /* virQEMUCapsFlags grouping marker for= syntax-check */ QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-= guest-support */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp comman= d present */ QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ + QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE, /* -M pc PIIX4_PM.acpi-pci-hotplug= -with-bridge-support */ + QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG, /* -M pc PIIX4_PM.acpi-root-pci-= hotplug */ + + /* 410 */ + QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE, /* -M q35 PIIX4_PM.acpi-pci-hotplu= g-with-bridge-support */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 156af4caee..5a7a23d5b9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6171,6 +6171,34 @@ qemuBuildPMCommandLine(virCommand *cmd, pm_object, def->pm.s4 =3D=3D VIR_TRISTATE_B= OOL_NO); } =20 + if (def->pm.acpi_hp_bridge) { + const char *pm_object =3D "PIIX4_PM"; + const char *switch_str =3D "on"; + + if (def->pm.acpi_hp_bridge =3D=3D VIR_TRISTATE_BOOL_NO) + switch_str =3D "off"; + + if (qemuDomainIsQ35(def) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE)) + pm_object =3D "ICH9-LPC"; + + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.acpi-pci-hotplug-with-bridge-suppo= rt=3D%s", + pm_object, switch_str); + } + + if (def->pm.acpi_root_hp) { + const char *pm_object =3D "PIIX4_PM"; + const char *switch_str =3D "on"; + + if (def->pm.acpi_hp_bridge =3D=3D VIR_TRISTATE_BOOL_NO) + switch_str =3D "off"; + + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.acpi-root-pci-hotplug=3D%s", + pm_object, switch_str); + } + return 0; } =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a964c8593d..22403e6d01 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -560,6 +560,27 @@ qemuValidateDomainDefPM(const virDomainDef *def, } } =20 + if (def->pm.acpi_hp_bridge) { + bool q35ICH9_pcihpbr =3D q35Dom && + virQEMUCapsGet(qemuCaps, + QEMU_CAPS_ICH9_ACPI_HOTPLUG_= BRIDGE); + + if (!q35ICH9_pcihpbr && !virQEMUCapsGet(qemuCaps, + QEMU_CAPS_PIIX_ACPI_HOTPLU= G_BRIDGE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("setting ACPI hotplug bridge not suppor= ted")); + return -1; + } + } + + if (def->pm.acpi_root_hp) { + if (!q35Dom && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_ACPI_ROOT_= PCI_HOTPLUG)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("setting ACPI root pci hotplug not supp= orted")); + return -1; + } + } + return 0; } =20 --=20 2.25.1