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 4B7F044C7C; Mon, 6 Jan 2025 15:42:21 +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=1736178141; cv=none; b=dq7W+JWgBIdSBaU3g0aBCcyoVryrZ/eRc8Fjr8Meb9wVsgGfHwl5LXlZqHAYojstfy39P/pa/C0sv2uSn9Pi9fGWx9ni+e5vT7S5d1hWB57tS6384U+rgAR8L+bv4SorW19kM0L1/tDNvdi5G8qeyvhUzgFgxvYFvwKiwwqmpHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178141; c=relaxed/simple; bh=f1k+n7hiWgA7XSuG/1B4E01U3vCo2IdGZeUAySxBHik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U3Rh0sff4r22jD52MVnKDdA0d5qZIMbKeSBIw3sOvQGss5NlEOG90cNbamFxvd5c9UBU5RbbqJL5gJI2488vasxk93jmkx2mP+dmQ0lfvbchIbLqgdFZCJ3O04r6/NQ0PxTEg8aUSpUebOU0T3lsXAdXPBIWHmwmrB3Eu929KEU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dPuNnE9Z; 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="dPuNnE9Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F02C4CED2; Mon, 6 Jan 2025 15:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736178141; bh=f1k+n7hiWgA7XSuG/1B4E01U3vCo2IdGZeUAySxBHik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dPuNnE9ZkMVx1w8+qA6QutqbzfKYEKcP5ggFWA2OTDoIgmvZQLf/3W4nvO+jLr/qv nAgmhqgjM7ZqKVCdo1BfHADVg+j8SvMCrqcqhe+Duk8Po4EhE5HWlA1zoMVgNZFyFP U7k0GDfyfN/8dGNUoePM/xrRNhh9Pfbl8mRmwgY4= 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.10 003/138] PCI: Use preserve_config in place of pci_flags Date: Mon, 6 Jan 2025 16:15:27 +0100 Message-ID: <20250106151133.343764438@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106151133.209718681@linuxfoundation.org> References: <20250106151133.209718681@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.10-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 6ce34a1deecb..2525bd043261 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -71,10 +71,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; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 02a75f3b5920..b0ac721e047d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3018,20 +3018,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