From nobody Tue Feb 10 00:39:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633145304052371.2896504467433; Fri, 1 Oct 2021 20:28:24 -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-559-aDHyTefsNPmwjQgA6OnAeA-1; Fri, 01 Oct 2021 23:28:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AFC5D8145E5; Sat, 2 Oct 2021 03:28:16 +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 77183652A9; Sat, 2 Oct 2021 03:28:16 +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 EFA65180598A; Sat, 2 Oct 2021 03:28:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1923Rbdo014009 for ; Fri, 1 Oct 2021 23:27:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id A77E010BFD7D; Sat, 2 Oct 2021 03:27:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A01BC117C2E8 for ; Sat, 2 Oct 2021 03:27:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 4FC40100B8DD for ; Sat, 2 Oct 2021 03:27:35 +0000 (UTC) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-gHYYmj94P3WqelNulg_EOw-1; Fri, 01 Oct 2021 23:27:33 -0400 Received: by mail-pl1-f169.google.com with SMTP id j4so6034426plx.4 for ; Fri, 01 Oct 2021 20:27:33 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.132.98]) by smtp.googlemail.com with ESMTPSA id s10sm8875926pjn.38.2021.10.01.20.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 20:27:32 -0700 (PDT) X-MC-Unique: aDHyTefsNPmwjQgA6OnAeA-1 X-MC-Unique: gHYYmj94P3WqelNulg_EOw-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=6PXSDBu8S7oAx4/HruWAUUT9dvVcFVR/lXQBjXRpJFI=; b=XayiQxq9jZb8Pz0LbM6tVLs8XY7NQFr2MaxSx/Szuc5o3Zi6VVyennMeQ5wIdT10L+ AdGVi681Bu5H5JSMqVV/0/TyApsE6CZrVZxlmS3RYp7fr0kECUxzIod/GshtI7K6dgt+ OY7YwxXM7fkntIHTtzOya73zp+7qmL4pYcMQBFUfhYJp6PtMGtN0+OlyV6m5SDQ0PWBs VKsPFlkv5EdLhAcI4vqWli3FI8Tnv/DOczA/tKqdrPOiNBoo87QUMnl3/0hpqqFdwgjJ OpjRkK48N6K2xRUGQd98svivShJkpsRcMcoLsDLN1cMO+N0ygJ4hIQKvj0e3B7tNOVSm OGmQ== X-Gm-Message-State: AOAM531REscPxYUtR15t/DicA6AvQ5y8aipE1dx262kltQMYZkllFKU9 f/w9/Lud0Mp+CdXnzlc1RZ6uc1fl4iaYBA== X-Google-Smtp-Source: ABdhPJwCU13K6gg2/4HDR5waglENltwHDwhE6NjDA1bn/Xyxt5/IkKYA29vkBl0K2/wNSurYaiGXSQ== X-Received: by 2002:a17:90b:4f4b:: with SMTP id pj11mr11374830pjb.127.1633145252341; Fri, 01 Oct 2021 20:27:32 -0700 (PDT) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH v5 3/4] qemu: command: add support for acpi-bridge-hotplug feature Date: Sat, 2 Oct 2021 08:57:06 +0530 Message-Id: <20211002032707.820361-4-ani@anisinha.ca> In-Reply-To: <20211002032707.820361-1-ani@anisinha.ca> References: <20211002032707.820361-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.3 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.11 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: 1633145305720100001 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 | 14 ++++++++ .../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, 97 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 08f6d735f8..6c8c99e595 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6069,6 +6069,7 @@ qemuBuildPMCommandLine(virCommand *cmd, qemuDomainObjPrivate *priv) { virQEMUCaps *qemuCaps =3D priv->qemuCaps; + int acpihp_br =3D def->pci_features[(virDomainPCI)VIR_DOMAIN_PCI_ACPI_= BRIDGE_HP]; =20 if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { /* with new qemu we always want '-no-shutdown' on startup and we s= et @@ -6114,6 +6115,19 @@ qemuBuildPMCommandLine(virCommand *cmd, pm_object, def->pm.s4 =3D=3D VIR_TRISTATE_B= OOL_NO); } =20 + if (acpihp_br) { + const char *pm_object =3D "PIIX4_PM"; + + 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, + 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 e0ff216b3a..b35ce99bb4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2574,6 +2574,22 @@ mymain(void) DO_TEST("pc-i440fx-acpi-root-hotplug-disable", QEMU_CAPS_PIIX_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_PIIX_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