From nobody Sat Nov 1 16:30:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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.129.124]) by mx.zohomail.com with SMTPS id 1646721632614987.4687870649439; Mon, 7 Mar 2022 22:40:32 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-MHZL_uxDMa-dnfK-EyCCBA-1; Tue, 08 Mar 2022 01:40:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2550C1801388; Tue, 8 Mar 2022 06:40:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FDE340CFD12; Tue, 8 Mar 2022 06:40:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ADBC5194F4B5; Tue, 8 Mar 2022 06:40:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 25766194E109 for ; Tue, 8 Mar 2022 06:40:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 09614401E64; Tue, 8 Mar 2022 06:40:25 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 053D8401E58 for ; Tue, 8 Mar 2022 06:40:25 +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 DB850180138A for ; Tue, 8 Mar 2022 06:40:24 +0000 (UTC) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-457-5qc9gppbMkW0sBITbngOZw-2; Tue, 08 Mar 2022 01:40:23 -0500 Received: by mail-pj1-f44.google.com with SMTP id mv5-20020a17090b198500b001bf2a039831so1346175pjb.5 for ; Mon, 07 Mar 2022 22:40:22 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.121.168]) by smtp.googlemail.com with ESMTPSA id 78-20020a621451000000b004f6e8a033b5sm8941899pfu.142.2022.03.07.22.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 22:40:21 -0800 (PST) X-MC-Unique: MHZL_uxDMa-dnfK-EyCCBA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 5qc9gppbMkW0sBITbngOZw-2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k3cBHL0YGvGYNGrZAMhf3iMSpg+KwX8sZ+gzm+fmtG0=; b=JH3xkN4TZxCmGoUHapLt6rrptvfPpSGnu45Wdw1nBjfwBIvNdg81Dd/F3poVabLZcY ca2yJqfH+BTCj3k26Yu91UM7RnzjLobWvp+QxNlEYS0WD0Q+I7qZ8GKntWyeyggd6YAl ME3uUthiCvVnQK/UydiijP5iZg2QKXWUguMqlTRWr5Lzz9YnAorYcjAzRA4okl4tCbh9 485Sr7zdfaxdJzOxdZE007iwvuY1+AiaMC1USUI684yahFl8S+6QcaKEVh02xvbP1rUX TWb3hPmGF3zxbE3rNl5C0Dn7tO4VJNlUKMQ0+d3Z3ogvBldhRkyyHh2hYS6JLs7jAi9g h9PA== X-Gm-Message-State: AOAM5301I9O/el7GffHSkgktl/9jrAP1qdk8jXprRbby5HDNXF6uw1lx cP7p5iv7Uki02QENb2zpX3BwtHdrxTWwGA== X-Google-Smtp-Source: ABdhPJx7DMHu9JGd2H2nc9frCVecUqMkIQU8mQdi4PqlQiQR8+MNrmuD9KWJ+DzkM2WixlmSj49Fmw== X-Received: by 2002:a17:902:e74e:b0:151:c46f:6e18 with SMTP id p14-20020a170902e74e00b00151c46f6e18mr16372540plf.32.1646721622278; Mon, 07 Mar 2022 22:40:22 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [libvirt] [PATCH RESEND v2 3/4] qemu: command: add support for acpi-bridge-hotplug feature Date: Tue, 8 Mar 2022 12:09:54 +0530 Message-Id: <20220308063955.2285902-4-ani@anisinha.ca> In-Reply-To: <20220308063955.2285902-1-ani@anisinha.ca> References: <20220308063955.2285902-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.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , imammedo@redhat.com, qemu-devel@nognu.org, jusual@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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: 1646721633305100003 Content-Type: text/plain; charset="utf-8" This change adds backend qemu command line support for new libvirt global feature 'acpi-bridge-hotplug'. This option can be used as following: The '' sub-element under '' is also newly introduced. 'acpi-bridge-hotplug' turns on the following command line option to qemu for x86 guests: (pc): -global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=3D (q35): -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=3D This change also adds the required qemuxml2argv unit tests in order to test correct qemu arguments. Unit tests have also been added to test qemu capability validation checks as well as checks for using this option with the right architecture. Signed-off-by: Ani Sinha --- src/qemu/qemu_command.c | 19 ++++++++++ ...-hotplug-bridge-disable.aarch64-latest.err | 1 + ...-hotplug-bridge-disable.x86_64-latest.args | 35 +++++++++++++++++ ...pi-hotplug-bridge-disable.x86_64-6.0.0.err | 1 + ...-hotplug-bridge-disable.x86_64-latest.args | 38 +++++++++++++++++++ tests/qemuxml2argvtest.c | 7 ++++ 6 files changed, 101 insertions(+) create mode 100644 tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disa= ble.aarch64-latest.err create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-di= sable.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.= x86_64-6.0.0.err create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.= x86_64-latest.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c836799888..206a9794cb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6280,6 +6280,7 @@ qemuBuildPMCommandLine(virCommand *cmd, qemuDomainObjPrivate *priv) { virQEMUCaps *qemuCaps =3D priv->qemuCaps; + int acpihp_br =3D def->pci_features[VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG= ]; =20 if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { /* with new qemu we always want '-no-shutdown' on startup and we s= et @@ -6325,6 +6326,24 @@ qemuBuildPMCommandLine(virCommand *cmd, pm_object, def->pm.s4 =3D=3D VIR_TRISTATE_B= OOL_NO); } =20 + if (acpihp_br !=3D VIR_TRISTATE_SWITCH_ABSENT) { + const char *pm_object =3D NULL; + + if (!qemuDomainIsQ35(def)) + pm_object =3D "PIIX4_PM"; + + if (qemuDomainIsQ35(def) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE)) + pm_object =3D "ICH9-LPC"; + + if (pm_object !=3D NULL) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.acpi-pci-hotplug-with-bridge-s= upport=3D%s", + pm_object, + virTristateSwitchTypeToString(acpihp_br= )); + } + } + return 0; } =20 diff --git a/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aar= ch64-latest.err b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disabl= e.aarch64-latest.err new file mode 100644 index 0000000000..9f0a88b826 --- /dev/null +++ b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-la= test.err @@ -0,0 +1 @@ +unsupported configuration: acpi-bridge-hotplug is not available for archit= ecture 'aarch64' diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x= 86_64-latest.args b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-di= sable.x86_64-latest.args new file mode 100644 index 0000000000..90527dfefd --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-l= atest.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-i440fx \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-i440fx/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-i440fx/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-i440fx/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Di440fx,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-i440fx/master-key.aes"}' \ +-machine pc-i440fx-2.5,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc= .ram \ +-accel tcg \ +-cpu qemu64 \ +-m 1024 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=3Doff \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-= 6.0.0.err b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-6= .0.0.err new file mode 100644 index 0000000000..8c09a3cd76 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-6.0.0.e= rr @@ -0,0 +1 @@ +unsupported configuration: acpi-bridge-hotplug is not available with this = QEMU binary diff --git a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-= latest.args b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64= -latest.args new file mode 100644 index 0000000000..6e3aeb1f30 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.= args @@ -0,0 +1,38 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-q35 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-q35/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-q35/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-q35/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dq35,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-q35/master-key.aes"}' \ +-machine pc-q35-2.5,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ra= m \ +-accel tcg \ +-cpu qemu64 \ +-m 1024 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 56f5055c-1b8d-490c-844a-ad646a1caaaa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=3Doff \ +-boot strict=3Don \ +-device '{"driver":"i82801b11-bridge","id":"pci.1","bus":"pcie.0","addr":"= 0x1e"}' \ +-device '{"driver":"pci-bridge","chassis_nr":2,"id":"pci.2","bus":"pci.1",= "addr":"0x0"}' \ +-device '{"driver":"ioh3420","port":8,"chassis":3,"id":"pci.3","bus":"pcie= .0","addr":"0x1"}' \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.3","addr":"0x0"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.2","add= r":"0x1"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ce475df466..bc4f9cbcf1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2592,6 +2592,13 @@ mymain(void) 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"); DO_TEST_CAPS_VER_PARSE_ERROR("pc-i440fx-acpi-root-hotplug-enable", "5.= 1.0"); + DO_TEST_CAPS_LATEST("q35-acpi-hotplug-bridge-disable"); + DO_TEST_CAPS_LATEST("pc-i440fx-acpi-hotplug-bridge-disable"); + DO_TEST_CAPS_VER_PARSE_ERROR("q35-acpi-hotplug-bridge-disable", "6.0.0= "); + /* verify that we fail when acpi-bridge-hotplug option is specified for + * archs other than x86 + */ + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-acpi-hotplug-bridge-disa= ble", "aarch64"); DO_TEST("q35-usb2", QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, --=20 2.25.1