From nobody Sun Feb 8 23:41:00 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1713171289538584.2911142420318; Mon, 15 Apr 2024 01:54:49 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F3D819C9; Mon, 15 Apr 2024 04:54:48 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 93B6F1A41; Mon, 15 Apr 2024 04:53:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6181118F6; Mon, 15 Apr 2024 04:53:23 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB38D1797 for ; Mon, 15 Apr 2024 04:53:22 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-226-O_1vQO1EMYi4jYpg4tW2lA-1; Mon, 15 Apr 2024 04:53:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1E143C025C3 for ; Mon, 15 Apr 2024 08:53:20 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D6622166AE5 for ; Mon, 15 Apr 2024 08:53:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: O_1vQO1EMYi4jYpg4tW2lA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/3] conf: Introduce @memReserve to Date: Mon, 15 Apr 2024 10:53:16 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GTP6I4COL4EDGQWONH7S6AOW7X65FV2E X-Message-ID-Hash: GTP6I4COL4EDGQWONH7S6AOW7X65FV2E X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1713171290893100001 There are PCI devices with pretty large non-prefetchable memory, for instance: Memory at 9d800000 (64-bit, non-prefetchable) [size=3D8M] Memory at a6800000 (64-bit, non-prefetchable) [size=3D16K] For cold plugged devices this is not a problem, because firmware sets PCI controllers in a way that make devices behind them just work. Problem arises if such PCI device is to be hot plugged. Since the PCI device wasn't present at cold boot, firmware could not take it into calculations and the amount of reserved memory is not sufficient. Introduce a know that allows users overriding value computed by FW and thus allow hot plug of such PCI devices. Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- docs/formatdomain.rst | 6 ++++++ src/conf/domain_conf.c | 9 +++++++++ src/conf/domain_conf.h | 3 +++ src/conf/schemas/domaincommon.rng | 5 +++++ tests/qemuxmlconfdata/q35-usb2.x86_64-latest.xml | 2 +- tests/qemuxmlconfdata/q35-usb2.xml | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index e2f66b982c..de7036e49c 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -4153,6 +4153,12 @@ generated by libvirt. :since:`Since 1.2.19 (QEMU onl= y)`. ``index`` pci-root controllers for pSeries guests use this attribute to record the order they will show up in the guest. :since:`Since 3.6.0` +``memReserve`` + Some PCI devices have non-prefetchable memory bar larger than 2MiB. Use= this + attribute to override value computed by firmware and thus make controll= er + reserve more memory (in KiB) so that such PCI device can be hot plugged. + For cold plugged PCI devices firmware recognizes this and computes corr= ect + value. :since:`Since 10.3.0` =20 For machine types which provide an implicit PCI bus, the pci-root controll= er with index=3D0 is auto-added and required to use PCI devices. pci-root has= no diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 48c5d546da..a0912062ff 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8528,6 +8528,11 @@ virDomainControllerDefParseXML(virDomainXMLOption *x= mlopt, &def->opts.pciopts.targetIndex, def->opts.pciopts.targetIndex) < 0) return NULL; + + if (virXMLPropULongLong(targetNodes[0], "memReserve", 0, + VIR_XML_PROP_NONZERO, + &def->opts.pciopts.memReserve) < 0) + return NULL; } } =20 @@ -23095,6 +23100,10 @@ virDomainControllerDefFormatPCI(virBuffer *buf, virBufferAsprintf(&targetAttrBuf, " hotplug=3D'%s'", virTristateSwitchTypeToString(def->opts.pciopts.= hotplug)); } + if (def->opts.pciopts.memReserve) { + virBufferAsprintf(&targetAttrBuf, " memReserve=3D'%llu'", + def->opts.pciopts.memReserve); + } =20 if (def->opts.pciopts.numaNode !=3D -1) virBufferAsprintf(&targetChildBuf, "%d\n", def->opts.= pciopts.numaNode); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5925faaf1a..356c25405b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -738,6 +738,9 @@ struct _virDomainPCIControllerOpts { */ int numaNode; virTristateSwitch hotplug; /* 'off' to prevent hotplug/unplug, default= 'on' */ + + unsigned long long memReserve; /* used by pci-bridge and pcie-root-por= t, + 0 =3D=3D undef, KiB */ }; =20 struct _virDomainUSBControllerOpts { diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index f386e46fae..d84e030255 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2897,6 +2897,11 @@ + + + + + diff --git a/tests/qemuxmlconfdata/q35-usb2.x86_64-latest.xml b/tests/qemux= mlconfdata/q35-usb2.x86_64-latest.xml index b860ae2dee..2bbbbfe346 100644 --- a/tests/qemuxmlconfdata/q35-usb2.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/q35-usb2.x86_64-latest.xml @@ -30,7 +30,7 @@ - +
diff --git a/tests/qemuxmlconfdata/q35-usb2.xml b/tests/qemuxmlconfdata/q35= -usb2.xml index 571782a17c..4f5a5580ac 100644 --- a/tests/qemuxmlconfdata/q35-usb2.xml +++ b/tests/qemuxmlconfdata/q35-usb2.xml @@ -25,7 +25,7 @@ - + --=20 2.43.2 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org