From nobody Tue Feb 10 17:30:34 2026 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 1633675387523977.4235347206559; Thu, 7 Oct 2021 23:43:07 -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-588-s_YQvS0zN9OAOzsX20_mwA-1; Fri, 08 Oct 2021 02:42:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A77E802C94; Fri, 8 Oct 2021 06:42:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B6B95D9F0; Fri, 8 Oct 2021 06:42:52 +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 F31C81800B8B; Fri, 8 Oct 2021 06:42:47 +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 1986gkhG022025 for ; Fri, 8 Oct 2021 02:42:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4504D2166B4A; Fri, 8 Oct 2021 06:42:46 +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 3E4E22166B41 for ; Fri, 8 Oct 2021 06:42:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 8A29618A01A9 for ; Fri, 8 Oct 2021 06:42:45 +0000 (UTC) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-z0XWOzC6PRmuC9LLUntO4Q-1; Fri, 08 Oct 2021 02:42:44 -0400 Received: by mail-pg1-f180.google.com with SMTP id m21so2167791pgu.13 for ; Thu, 07 Oct 2021 23:42:43 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([203.212.240.146]) by smtp.googlemail.com with ESMTPSA id h6sm10329180pji.6.2021.10.07.23.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 23:42:42 -0700 (PDT) X-MC-Unique: s_YQvS0zN9OAOzsX20_mwA-1 X-MC-Unique: z0XWOzC6PRmuC9LLUntO4Q-1 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=8BQsTTwiJnhn2ai8XchJTse0gEq2hl1obxJnM/Qa+GE=; b=bX4zTkS1bdmo+Zyeumnf+HpZwQKLtQ+9PIGZiOqpqcfh4MnWGqw+mbofu0IoZmF0kM IquZAjxztaOPKnXOCQ2AgqrqS7/lTyvV4NwUS0ktXgUYQlZpin0m+9XniviUh64zW9Ym CWSpgUkEOjd1CeSqxczNqjtFhbQBjMM6Z2jKL6eXLlgouGIt8p+xEmGtEMHMHV6yHomR yruXECiKFTHo9S8AJWQcMaPfklrbCdKuSBJLGmz1PobEDRCgtDzTX/YNH5G/sX8wxlKW cSMj5kc106A5ERuUW9Nxl6jRy6lqgBQH/OgK9t4tymHaXOpRomTbI4VGBXPCS+kAGCoD +yCA== X-Gm-Message-State: AOAM531aTemWJPDW0c6SIB0bMxgkbGRmQ6wwU72mdxIMemTlcXpY5+oJ q57g0qwtQdF+fUdoS19Hvz8mwKicut4upA== X-Google-Smtp-Source: ABdhPJwAW/3t3Y5QRmy/AOPaChyjkG5l5v/Q2AU8Kp2X9hbuAEzw5aCsJMaDcipoB6+EJItbfVJsng== X-Received: by 2002:a62:7a4f:0:b0:448:6a41:14bb with SMTP id v76-20020a627a4f000000b004486a4114bbmr8668264pfc.31.1633675362495; Thu, 07 Oct 2021 23:42:42 -0700 (PDT) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH v7 3/4] qemu: command: add support for acpi-bridge-hotplug feature Date: Fri, 8 Oct 2021 12:12:14 +0530 Message-Id: <20211008064215.50480-4-ani@anisinha.ca> In-Reply-To: <20211008064215.50480-1-ani@anisinha.ca> References: <20211008064215.50480-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 , jusual@redhat.com, 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.14 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: 1633675389179100001 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 machines): -global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=3D (q35 machines): -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 capabi= lity validation checks as well as checks for using this option with the right architecture. Signed-off-by: Ani Sinha --- src/qemu/qemu_command.c | 20 +++++++++++ .../aarch64-acpi-hotplug-bridge-disable.err | 1 + ...pc-i440fx-acpi-hotplug-bridge-disable.args | 31 +++++++++++++++++ .../pc-i440fx-acpi-hotplug-bridge-disable.err | 1 + .../q35-acpi-hotplug-bridge-disable.args | 33 +++++++++++++++++++ .../q35-acpi-hotplug-bridge-disable.err | 1 + tests/qemuxml2argvtest.c | 16 +++++++++ 7 files changed, 103 insertions(+) create mode 100644 tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disa= ble.err create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-di= sable.args create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-di= sable.err create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.= args create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.= err diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 28bca1519c..f45be80744 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6102,6 +6102,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 @@ -6147,6 +6148,25 @@ qemuBuildPMCommandLine(virCommand *cmd, pm_object, def->pm.s4 =3D=3D VIR_TRISTATE_B= OOL_NO); } =20 + if (acpihp_br) { + const char *pm_object =3D NULL; + + if (!qemuDomainIsQ35(def) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE)) + 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.err= b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.err new file mode 100644 index 0000000000..9f0a88b826 --- /dev/null +++ b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.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.a= rgs b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args new file mode 100644 index 0000000000..a1e5dc85c7 --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args @@ -0,0 +1,31 @@ +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 \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Di440fx,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-i440= fx/master-key.aes \ +-machine pc-i440fx-2.5,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 1024 \ +-realtime mlock=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,path=3D/tmp/lib/domain--1-i440fx/monitor.= sock,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 \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.e= rr b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.err new file mode 100644 index 0000000000..8c09a3cd76 --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.err @@ -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.args b/= tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args new file mode 100644 index 0000000000..007c22c646 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args @@ -0,0 +1,33 @@ +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 \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dq35,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-q35/= master-key.aes \ +-machine pc-q35-2.5,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 1024 \ +-realtime mlock=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,path=3D/tmp/lib/domain--1-q35/monitor.soc= k,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 i82801b11-bridge,id=3Dpci.1,bus=3Dpcie.0,addr=3D0x1e \ +-device pci-bridge,chassis_nr=3D2,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \ +-device ioh3420,port=3D0x8,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=3D0x1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.2,addr=3D0x1 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err b/t= ests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err new file mode 100644 index 0000000000..8c09a3cd76 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.err @@ -0,0 +1 @@ +unsupported configuration: acpi-bridge-hotplug is not available with this = QEMU binary diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7df3946751..116ba714eb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2562,6 +2562,22 @@ mymain(void) DO_TEST("pc-i440fx-acpi-root-hotplug-disable", QEMU_CAPS_PIIX4_ACPI_ROOT_PCI_HOTPLUG); DO_TEST_PARSE_ERROR_NOCAPS("pc-i440fx-acpi-root-hotplug-disable"); + DO_TEST("q35-acpi-hotplug-bridge-disable", + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE); + DO_TEST("pc-i440fx-acpi-hotplug-bridge-disable", + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE); + DO_TEST_PARSE_ERROR_NOCAPS("q35-acpi-hotplug-bridge-disable"); + DO_TEST_PARSE_ERROR_NOCAPS("pc-i440fx-acpi-hotplug-bridge-disable"); + /* verify that we fail when acpi-bridge-hotplug option is specified for + * archs other than x86 + */ + DO_TEST_PARSE_ERROR_NOCAPS("aarch64-acpi-hotplug-bridge-disable"); DO_TEST("q35-usb2", QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, --=20 2.25.1