From nobody Mon Sep 8 17:04:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756276877; cv=none; d=zohomail.com; s=zohoarc; b=QcuskNgSVUOCQwq3yKdAlM78TdnYffaGJ7QAYgxfQzUX4T4s+m8eFr6iwiL6pCQjdJSOWPpPecK4sEYyhstaP8qIisc9Rb3wtdt41FS2rFbfjFP8sO123QtzAUdabToIk0zLF7kaKx8nSjV4kHx5szdp7/i652oXeb9wqjt5Msk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756276877; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=xUUolvabg5MOm2xG7kCJJNPh7ZWdPkH8/tq0jdrOvbg=; b=AlmzsRyGz1Z2NTZSdLyHpfRYy6rXNL6ycGMU4jUcW8S9GvG9YIv1oof4hrCMtD22DZf1GGRtUJa3OCY6G2Y3fUs3VZt+l83zFbjNaMsQF+yxnB9NPw5/v0rTDktGOZ2BfefaCiluffwB+OAfhhGmzM2/KxZ2IlL5Uhqsld3DESg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756276877157888.864169202333; Tue, 26 Aug 2025 23:41:17 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 5B57943F9D; Wed, 27 Aug 2025 02:41:15 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3718243FCC; Wed, 27 Aug 2025 02:38:31 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9E46843F3E; Wed, 27 Aug 2025 02:38:14 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id EAC6743F37 for ; Wed, 27 Aug 2025 02:38:13 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416-8ytajHLAOoGmabjfqedoSg-1; Wed, 27 Aug 2025 02:38:11 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1760219560AE for ; Wed, 27 Aug 2025 06:38:11 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.65.70]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A111F19560AB for ; Wed, 27 Aug 2025 06:38:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756276693; h=from:from: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; bh=xUUolvabg5MOm2xG7kCJJNPh7ZWdPkH8/tq0jdrOvbg=; b=WZJBEz4bYBgqZ2AJ1C1Whj6yeSvUAtvh51vt4t0a7RpZXP+/GOkDYzoOwcmPim+kxflnJJ 6KrbI7NJu9wEQYCFcTAEGtSs3LiArqgagUD6+s6StF+ThDIE8qlg5W8D2s3po5g+NjlU7q XdthciEy1+nUaPomCMaSgY1VSzWhbZs= X-MC-Unique: 8ytajHLAOoGmabjfqedoSg-1 X-Mimecast-MFC-AGG-ID: 8ytajHLAOoGmabjfqedoSg_1756276691 To: devel@lists.libvirt.org Subject: [PATCH 3/3] conf: auto-add a pcie-root-port when needed while plugging in pcie-to-pci-bridge Date: Wed, 27 Aug 2025 02:38:07 -0400 Message-ID: <20250827063807.99334-4-laine@redhat.com> In-Reply-To: <20250827063807.99334-1-laine@redhat.com> References: <20250827063807.99334-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: YVYM__5cKdqrr_78z2Sa6rYZCk-6yz4wkPSTvQfXh8Y_1756276691 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AGNTCHHYFLJDVXAQ7EFBIK7HAYVDHQGE X-Message-ID-Hash: AGNTCHHYFLJDVXAQ7EFBIK7HAYVDHQGE X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756276888580124100 Content-Type: text/plain; charset="utf-8"; x-default="true" This will almost surely never come up during any normal operation[*], which is likely why this wasn't done when pcie-to-pci-bridge support was added back in the before-fore times. It's pretty simple to support though - a pcie-to-pci-bridge plugs into a pcie-root-port just like any other pcie device, and if there isn't an open slot on an existing pcie-root-port, we can just add one. ([*] in real life, a pcie-to-pci-bridge is only auto-added by libvirt itself, while this function is dealing with the followup to *user added* devices. Also each pcie-to-pci-bridge has 32 slots, and it's unlikely a domain with pcie support would be wanting more than 32 conventional PCI (i.e. not PCIe) devices) Signed-off-by: Laine Stump --- src/conf/domain_addr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index ef1b2bd69a..6aa5ac1b9f 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -691,7 +691,8 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSet *addr= s, } } } else if (flags & (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE | - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT)) { + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT | + VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE)) { model =3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT; } else { /* The types of devices that we can't auto-add a controller for: --=20 2.51.0