From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 998D91DE2A1; Mon, 6 Jan 2025 15:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178558; cv=none; b=P5tMwmXQ6/U2OE5Ao1+iENAB/zIFfn2cNw+9kxtyoHGRrVfKNNUh821eyF+E+Yb4fCy8GvKfiv30zfiUTtsMG6cgeYRPW5vit3ssII+DwEVigJ9xHMa0aQ/LeWzL23dYtBt0gZcc6OEXhNcMu3Cl9nOj0LLRJZAS/+VU81owlcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178558; c=relaxed/simple; bh=fvXB3rxHBoXCv1fNs9KXPupzCmLobgxyyaxtdu66kTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YUViOstVCbG53snVz0ZOxNCu6qdZQBPSgPeznqKreMATldkCgzBhdMvnSlqj37Q7zugIoH0RbIXzsF+98pif6Lmd+KSoIIi2ZrIZzHN6F/Zmp2xAGIV0JgRAuU4Iyqpi9azymNFs69h5k8le3ez9B3sqzpdjHB+HW8seqWpiBnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YKdZ/nDr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YKdZ/nDr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EF5AC4CED2; Mon, 6 Jan 2025 15:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736178558; bh=fvXB3rxHBoXCv1fNs9KXPupzCmLobgxyyaxtdu66kTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKdZ/nDrlLGSni/4DorOdjy63Q6rjwSUWAin5MvGooxMKYtRwk1f/BzdLKj35yIeh Y7J3XfdKK7Xjc2BXn3IBdoxx+3Ol247pgtaiCnP/AhQ670O2YAHKqq1vfwXE2BmW+7 IZ/hK3wwdgQLigdSyJMdLjWQlDxS1sk3QED6dDds= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vidya Sagar , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.15 002/168] PCI: Use preserve_config in place of pci_flags Date: Mon, 6 Jan 2025 16:15:10 +0100 Message-ID: <20250106151138.548891185@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106151138.451846855@linuxfoundation.org> References: <20250106151138.451846855@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vidya Sagar [ Upstream commit 7246a4520b4bf1494d7d030166a11b5226f6d508 ] Use preserve_config in place of checking for PCI_PROBE_ONLY flag to enable support for "linux,pci-probe-only" on a per host bridge basis. This also obviates the use of adding PCI_REASSIGN_ALL_BUS flag if !PCI_PROBE_ONLY, as pci_assign_unassigned_root_bus_resources() takes care of reassigning the resources that are not already claimed. Link: https://lore.kernel.org/r/20240508174138.3630283-5-vidyas@nvidia.com Signed-off-by: Vidya Sagar Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-host-common.c | 4 ---- drivers/pci/probe.c | 20 +++++++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index d3924a44db02..fd3020a399cf 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -73,10 +73,6 @@ int pci_host_common_probe(struct platform_device *pdev) if (IS_ERR(cfg)) return PTR_ERR(cfg); - /* Do not reassign resources if probe only */ - if (!pci_has_flag(PCI_PROBE_ONLY)) - pci_add_flags(PCI_REASSIGN_ALL_BUS); - bridge->sysdata = cfg; bridge->ops = (struct pci_ops *)&ops->pci_ops; bridge->msi_domain = true; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index dd2134c7c419..cda6650aa3b1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3048,20 +3048,18 @@ int pci_host_probe(struct pci_host_bridge *bridge) bus = bridge->bus; + /* If we must preserve the resource configuration, claim now */ + if (bridge->preserve_config) + pci_bus_claim_resources(bus); + /* - * We insert PCI resources into the iomem_resource and - * ioport_resource trees in either pci_bus_claim_resources() - * or pci_bus_assign_resources(). + * Assign whatever was left unassigned. If we didn't claim above, + * this will reassign everything. */ - if (pci_has_flag(PCI_PROBE_ONLY)) { - pci_bus_claim_resources(bus); - } else { - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); + pci_assign_unassigned_root_bus_resources(bus); - list_for_each_entry(child, &bus->children, node) - pcie_bus_configure_settings(child); - } + list_for_each_entry(child, &bus->children, node) + pcie_bus_configure_settings(child); pci_bus_add_devices(bus); return 0; -- 2.39.5