From nobody Tue Feb 10 07:38:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1586181140; cv=none; d=zohomail.com; s=zohoarc; b=lAL336L7XKtgPlC8D3v1sVoCkGjjPSyXuFAF34qk2Pk0kIAFjBZlllKUXXBvQfSSj8HwuWiTShZH+VIng2FMXzMEsRSx2CJ3Fq0Z5+My1u+umBQK/+qIvxuHm4Un2gHZsTsGr66EoIqfF5dQogTJ8IXEe+nU72QWKjMjxlXxAmI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586181140; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QFb+G21b7T7XU4FDmPit7qQGB6WetTC39Xcl7bqHasA=; b=HxaOnC46SenlcIHtPnXUUwJFyQ2iUPRhWMVe9n3lBCMJGwnTbU/F63mgWL+t/xCOX2ct/JRPzyN9GT1lBsNy1MdWgmUogJhLZ4X6raiivL5kcQDdlb/RRNJNHH/69jFLfeF7xB2emvHBktRPQvs3V1shw86LtqwqpwmWZe+HvRo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 158618114062682.43052843633757; Mon, 6 Apr 2020 06:52:20 -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-196-WqngGBkCPBiiwFF_qP8ysQ-1; Mon, 06 Apr 2020 09:52:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C96BC18B9FCA; Mon, 6 Apr 2020 13:52:10 +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 8FDC25C1B0; Mon, 6 Apr 2020 13:52:10 +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 2D7E618089CE; Mon, 6 Apr 2020 13:52:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036DpewJ018336 for ; Mon, 6 Apr 2020 09:51:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8EF55C1BB; Mon, 6 Apr 2020 13:51:40 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-243.phx2.redhat.com [10.3.112.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E3E95C1B0 for ; Mon, 6 Apr 2020 13:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586181139; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QFb+G21b7T7XU4FDmPit7qQGB6WetTC39Xcl7bqHasA=; b=UTxC/llJO5Ysu+z1Pq8gVWXu9ki/h+miQYSG9NgYM8W8FK415WIkY2apTjmlNvflqFwN83 lHzt9Uj//Kymh0ALyQxBy2E0g9iEzXVYhFlr1Mz4tcALcwO/xMo/OMcRjMsUsW+Pf07xcq Dk1CEkKMM6cQWS5YFW6535zENeAdV7E= X-MC-Unique: WqngGBkCPBiiwFF_qP8ysQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] conf: new attribute "hotplug" for pci controllers Date: Mon, 6 Apr 2020 09:51:22 -0400 Message-Id: <20200406135130.3080946-3-laine@redhat.com> In-Reply-To: <20200406135130.3080946-1-laine@redhat.com> References: <20200406135130.3080946-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" a element can now have a "hotplug" attribute in the subelement. This is intended to control whether or not the slot(s) of the controller support hotplugging/unplugging a device: The default value of hotplug is "on". Since support for configuring such an option is hypervisor-dependent (and will vary among different types of PCI controllers even on a single hypervisor), no validation is done in this patch - that validation will be done in the patch that wires support for the setting into the hypervisor. Signed-off-by: Laine Stump --- docs/formatdomain.html.in | 11 ++++ docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 20 +++++- src/conf/domain_conf.h | 1 + .../pcie-root-port-nohotplug.xml | 35 ++++++++++ .../pcie-root-port-nohotplug.xml | 64 +++++++++++++++++++ tests/qemuxml2xmltest.c | 7 ++ 7 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml create mode 100644 tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fbffb16866..341f7c78dc 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4706,6 +4706,17 @@ 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 have a hotplug attribute in + the <target> subelement, which is used to + disable hotplug/unplug of devices on a particular + controller. The default setting of hotplug + is on; it should be set to off to + disable hotplug/unplug of devices on a particular controller. + Since 6.3.0 +
busNr
pci-expander-bus and pcie-expander-bus controllers can have an diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index dcf2e09db8..7db32ec5c0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2475,6 +2475,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 460f8064be..4c81579eaf 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11035,6 +11035,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPt= r xmlopt, g_autofree char *port =3D NULL; g_autofree char *busNr =3D NULL; g_autofree char *targetIndex =3D NULL; + g_autofree char *hotplug =3D NULL; g_autofree char *ioeventfd =3D NULL; g_autofree char *portsStr =3D NULL; g_autofree char *iothread =3D NULL; @@ -11106,6 +11107,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPt= r xmlopt, chassis =3D virXMLPropString(cur, "chassis"); port =3D virXMLPropString(cur, "port"); busNr =3D virXMLPropString(cur, "busNr"); + hotplug =3D virXMLPropString(cur, "hotplug"); targetIndex =3D virXMLPropString(cur, "index"); processedTarget =3D true; } @@ -11342,6 +11344,17 @@ virDomainControllerDefParseXML(virDomainXMLOptionP= tr xmlopt, } def->opts.pciopts.numaNode =3D numaNode; } + if (hotplug) { + int val =3D virTristateSwitchTypeFromString(hotplug); + + if (val <=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("PCI controller unrecognized hotplug sett= ing '%s'"), + hotplug); + goto error; + } + def->opts.pciopts.hotplug =3D val; + } break; case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: { g_autofree char *gntframes =3D virXMLPropString(node, "maxGrantFra= mes"); @@ -25333,7 +25346,8 @@ virDomainControllerDefFormat(virBufferPtr buf, def->opts.pciopts.port !=3D -1 || def->opts.pciopts.busNr !=3D -1 || def->opts.pciopts.targetIndex !=3D -1 || - def->opts.pciopts.numaNode !=3D -1) { + def->opts.pciopts.numaNode !=3D -1 || + def->opts.pciopts.hotplug !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAddLit(&childBuf, "opts.pciopts.chassisNr !=3D -1) virBufferAsprintf(&childBuf, " chassisNr=3D'%d'", @@ -25350,6 +25364,10 @@ virDomainControllerDefFormat(virBufferPtr buf, if (def->opts.pciopts.targetIndex !=3D -1) virBufferAsprintf(&childBuf, " index=3D'%d'", def->opts.pciopts.targetIndex); + if (def->opts.pciopts.hotplug !=3D VIR_TRISTATE_SWITCH_ABSENT)= { + virBufferAsprintf(&childBuf, " hotplug=3D'%s'", + virTristateSwitchTypeToString(def->opts.= pciopts.hotplug)); + } if (def->opts.pciopts.numaNode =3D=3D -1) { virBufferAddLit(&childBuf, "/>\n"); } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2038b54c32..bd5aaeaef1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -722,6 +722,7 @@ struct _virDomainPCIControllerOpts { * item in memory target config) -1 =3D=3D unspecified */ int numaNode; + virTristateSwitch hotplug; /* 'off' to prevent hotplug/unplug, default= 'on' */ }; =20 struct _virDomainUSBControllerOpts { diff --git a/tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml b/tests/qe= muxml2argvdata/pcie-root-port-nohotplug.xml new file mode 100644 index 0000000000..8a01494470 --- /dev/null +++ b/tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml @@ -0,0 +1,35 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.xml b/tests/= qemuxml2xmloutdata/pcie-root-port-nohotplug.xml new file mode 100644 index 0000000000..2ecb99728d --- /dev/null +++ b/tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.xml @@ -0,0 +1,64 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + +
+ + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + +
+ + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index b4c83fccca..4b40468d15 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -960,6 +960,13 @@ mymain(void) DO_TEST("pcie-root-port-model-ioh3420", QEMU_CAPS_DEVICE_IOH3420); =20 + DO_TEST("pcie-root-port-nohotplug", + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_DEVICE_X3130_UPSTREAM, + QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, + QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG); + DO_TEST("pcie-switch-upstream-port", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_X3130_UPSTREAM, --=20 2.25.2