From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vidya Sagar <vidyas@nvidia.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Sasha Levin <sashal@kernel.org>,
will@kernel.org, lpieralisi@kernel.org, kw@linux.com,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 5.10 03/11] PCI: Use preserve_config in place of pci_flags
Date: Sun, 28 Jul 2024 12:09:36 -0400 [thread overview]
Message-ID: <20240728160954.2054068-3-sashal@kernel.org> (raw)
In-Reply-To: <20240728160954.2054068-1-sashal@kernel.org>
From: Vidya Sagar <vidyas@nvidia.com>
[ 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 <vidyas@nvidia.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 6ce34a1deecb2..2525bd0432616 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 02a75f3b59208..b0ac721e047db 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.43.0
next prev parent reply other threads:[~2024-07-28 16:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-28 16:09 [PATCH AUTOSEL 5.10 01/11] PCI: Add ACS quirk for Broadcom BCM5760X NIC Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 02/11] ASoC: Intel: sof_sdw: Add quirks for some new Dell laptops Sasha Levin
2024-07-29 7:30 ` Pavel Machek
2024-08-10 9:13 ` Sasha Levin
2024-07-28 16:09 ` Sasha Levin [this message]
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 04/11] usb: cdns3: Add quirk flag to enable suspend residency Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 05/11] usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 06/11] usb: typec: ucsi: Fix null pointer dereference in trace Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 07/11] MIPS: Loongson64: DTS: Fix msi node for ls7a Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 08/11] PCI/AER: Disable AER service on suspend Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 09/11] PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0) Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 10/11] PCI: Add missing bridge lock to pci_bus_lock() Sasha Levin
2024-07-28 16:09 ` [PATCH AUTOSEL 5.10 11/11] ALSA: usb: Fix UBSAN warning in parse_audio_unit() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240728160954.2054068-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vidyas@nvidia.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox