From nobody Wed Feb 11 02:08:55 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 1632666988173511.17801281342724; Sun, 26 Sep 2021 07:36:28 -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-582-0sV9-sEUORWWCflfBf9N5w-1; Sun, 26 Sep 2021 10:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D7B0802E3D; Sun, 26 Sep 2021 14:36:20 +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 7EDEF1002391; Sun, 26 Sep 2021 14:36:20 +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 426F04EA29; Sun, 26 Sep 2021 14:36:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18QEa8kk031771 for ; Sun, 26 Sep 2021 10:36:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id D51C763F25; Sun, 26 Sep 2021 14:36:08 +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 D01325F25E for ; Sun, 26 Sep 2021 14:36:03 +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 8C6D880B91D for ; Sun, 26 Sep 2021 14:36:03 +0000 (UTC) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-Ru5BSsb5NxaZnoxOSkYTHQ-1; Sun, 26 Sep 2021 10:36:01 -0400 Received: by mail-pl1-f180.google.com with SMTP id t4so10002811plo.0 for ; Sun, 26 Sep 2021 07:36:01 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.152.236]) by smtp.googlemail.com with ESMTPSA id t22sm8668302pgb.77.2021.09.26.07.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:35:59 -0700 (PDT) X-MC-Unique: 0sV9-sEUORWWCflfBf9N5w-1 X-MC-Unique: Ru5BSsb5NxaZnoxOSkYTHQ-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=fVVhmrpdstuyDOdmh2iN+V4l7I/VKsa5rAJu0KHsIq8=; b=eBpvKy9DUfssp2Su7zpU3WoDvMG6oqkHNH6lLMMxXNa1PwkAxlVFxbQV/lmy8YEDjq duQfHFK89899Lapn99FrY8k/B9OXKM2/v9rX5mGmLQgL24oaFPZPCjaH2eOXFzTfh8On s0d2eaFtKHO1mBgL4D0CdbSXO3lRyX8vM+nTYNfAg432W92C2TsAfNC9bZMPNRsOoXwk vd4fb2xM4e2JQBvjXxZpukXYDAQ4KDE0hr2qND3ijh6M6uThAO0hZp5vWqAo+cTdL3XE gGWP8JSGwvTeyCX0Xyhl1bDArqcS0slV8SNKtWQBfhW6gVdWcTce/UjTldi+B2aTaXbd EDhg== X-Gm-Message-State: AOAM530By5W8Rk5bj3NGDiQNUkgZ/L+T31xWtCYgr3LkC1n/i6vbZrSB RWTEcw9fH22ujS4QWl3uWtJW6SWBRlJEzw== X-Google-Smtp-Source: ABdhPJzfQxFrNpFupJYjFH2CXsYeyJoKBGSYt7ndTYC01ZoWE/NAXpv1u0qwTDmQJRgYzhINbuNdPw== X-Received: by 2002:a17:90a:1984:: with SMTP id 4mr14298908pji.87.1632666959888; Sun, 26 Sep 2021 07:35:59 -0700 (PDT) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH v4 2/4] conf: introduce option to enable/disable pci hotplug on pci-root controller Date: Sun, 26 Sep 2021 20:05:37 +0530 Message-Id: <20210926143539.253990-3-ani@anisinha.ca> In-Reply-To: <20210926143539.253990-1-ani@anisinha.ca> References: <20210926143539.253990-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.79 on 10.11.54.5 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.84 on 10.5.11.22 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: 1632666990049100001 Content-Type: text/plain; charset="utf-8" This change introduces libvirt xml support to enable/disable hotplug on the pci-root controller. It adds a 'target' subelement for the pci-root control= ler with a 'hotplug' property. This property can be used to enable or disable hotplug for the pci-root controller. For example, in order to disable hotpl= ug on the pci-root controller, one has to use set '' as shown below: '' option would enable hotplug for pci-root controll= er. This is also the default value. This option is only available for pc machine types and is applicable for qemu only/kvm accelerator onlt.This feature was introduced from qemu version 5.2 with the following change in qemu reposito= ry: 3d7e78aa7777f ("Introduce a new flag for i440fx to disable PCI hotplug on t= he root bus") The above qemu commit describes some reasons why users might to disable hot= plug on PCI root buses. Related unit tests to exercise the new conf option has also been added. Signed-off-by: Ani Sinha --- docs/formatdomain.rst | 12 ++++---- docs/schemas/domaincommon.rng | 10 +++++++ src/qemu/qemu_validate.c | 9 +++++- .../pc-i440fx-acpi-root-hotplug-disable.xml | 17 +++++++++++ .../pc-i440fx-acpi-root-hotplug-enable.xml | 17 +++++++++++ .../pc-i440fx-acpi-root-hotplug-disable.xml | 30 +++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 7 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disa= ble.xml create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enab= le.xml create mode 100644 tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-di= sable.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 0f5d833521..e2a1768ba7 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3776,11 +3776,13 @@ generated by libvirt. :since:`Since 1.2.19 (QEMU on= ly).` controller's "port" configuration value, which is visible to the virtual machine. If set, port must be between 0 and 255. ``hotplug`` - pcie-root-port and pcie-switch-downstream-port controllers can also hav= e a - ``hotplug`` attribute in the ```` subelement, which is used to - disable hotplug/unplug of devices on a particular controller. The defau= lt - setting of ``hotplug`` is ``on``; it should be set to ``off`` to disable - hotplug/unplug of devices on a particular controller. :since:`Since 6.3= .0` + pci-root (:since:`Since 7.8.0`), pcie-root-port (:since:`Since 6.3.0`) = and + pcie-switch-downstream-port controllers (:since:`Since 6.3.0`) can + also have a ``hotplug`` attribute in the ```` subelement, which= is + used to disable hotplug/unplug of devices on a particular controller. T= he + default setting of ``hotplug`` is ``on``; it should be set to ``off`` to + disable hotplug/unplug of devices on a particular controller. + ``busNr`` pci-expander-bus and pcie-expander-bus controllers can have an optional ``busNr`` attribute (1-254). This will be the bus number of the new bus= ; All diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fdc04f90aa..cce50c9c89 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2668,6 +2668,16 @@ + + + + + + + + + + diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 13fbfd01b2..510e766cfd 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3879,6 +3879,14 @@ qemuValidateDomainDeviceDefControllerPCI(const virDo= mainControllerDef *cont, /* hotplug */ if (pciopts->hotplug !=3D VIR_TRISTATE_SWITCH_ABSENT) { switch ((virDomainControllerModelPCI) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOT= PLUG)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("setting the %s property on a pci-root de= vice is not supported by this QEMU binary"), + "hotplug"); + return -1; + } + break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG= )) { @@ -3889,7 +3897,6 @@ qemuValidateDomainDeviceDefControllerPCI(const virDom= ainControllerDef *cont, } break; =20 - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.xml= b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.xml new file mode 100644 index 0000000000..f6a4c4b16a --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.xml @@ -0,0 +1,17 @@ + + i440fx + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.xml = b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.xml new file mode 100644 index 0000000000..90a568cd9b --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.xml @@ -0,0 +1,17 @@ + + i440fx + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-disable.x= ml b/tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-disable.xml new file mode 100644 index 0000000000..93f2779f68 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-disable.xml @@ -0,0 +1,30 @@ + + i440fx + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +