From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796188907; b=t5oX0judOODJ/SH7TmHGjNYOBtc39p83c+i7Tc0ohmoQxrLrPOuY1T8FMzJZ+K8RVCJs cRHkZPaUAAf15Va15j6L2oeh6tgHUZs4K5wfJFvQdrQYBo9qZ0BnpKYyyJI/awVxQixdU Y3h7/M9j4kRPLRnLEcPF6A/BHQlhounKENqyJqZsC2dtBQdAIi/rzXeAn/x7yhbRED5Nn mkVRPpkLKaQqGqOWRJKN48V0Pdh6sn7T4h/w4bR/VXZDCewdu5JlkeG2dDkMUHAe+1Mcr IibmoCRMgMToeGrkfiJuT17EQzG4PEW5oHQyCOPBenCseSaQFi5/GrLLctGdlW4go+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796188907; h=Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=oRsRlrGNG6U1FyVsRr4x0VQiq8tab1pKHRtluzKpjhg=; b=HSfWTbs4DMjbl6I/Xg6fZ5xRP2osT6XlvczH8pfBwDCTanyOK5cFgooHZ36xhGm23pmc pEz7beu27lWaxEIY1rCIptQ+q4L4dnxcGBDVZLiHRFOKiXsEreesc/FcuTFP1nAHSBtiW hWXkk7oabq1428v620dth5vN9gTjC5jb/2t6yqoIpEapoYz7gWl7LVQ/TGSiwgFLycXRv Pu7QshoULbsStLCaCuFoIPd6BvbOiniOeGGfE7GhKxTfq1f/Ba4pDRwNAplCTJTZxhNzv wfitCAMePHnsUgI5OurF/5x9kHM97DVJg67zlmac85JSbMKX0gnheSp7vEBqs79FNzA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B444B606A31A; Wed, 2 Dec 2026 05:21:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 858A41F00893; Wed, 2 Dec 2026 05:21:40 +0000 (UTC) Message-ID: <877f7259-6065-42ef-9d25-2788c126ab11@linux-m68k.org> Date: Wed, 2 Dec 2026 15:21:37 +1000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 01/17] PCI: Add pci_bus_size_and_assign_resources() To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , David Matlack , "Rafael J . Wysocki" , Russell King , Geert Uytterhoeven , Thomas Bogendoerfer , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "James E.J. Bottomley" , Helge Deller , Len Brown , Dominik Brodowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-sh@vger.kernel.org, linux-parisc@vger.kernel.org, linux-acpi@vger.kernel.org Cc: stable@vger.kernel.org References: <20261125230925.2441-1-ilpo.jarvinen@linux.intel.com> <20261125230925.2441-2-ilpo.jarvinen@linux.intel.com> Content-Language: en-US From: Greg Ungerer In-Reply-To: <20261125230925.2441-2-ilpo.jarvinen@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 26/11/26 09:09, Ilpo Järvinen wrote: > Bridge window sizing and resource assignment must not run concurrently > with another sizing and assignment pass or with device removal. > Preventing that requires holding locks across both phases. Many callers > outside of PCI core call pci_bus_size_bridges() immediately followed by > pci_bus_assign_resources() and cannot hold the PCI core internal locks > across the two calls. > > Add pci_bus_size_and_assign_resources() into PCI core which combines > these two operations and convert the callers that call them back to > back. > > Signed-off-by: Ilpo Järvinen > Acked-by: Rafael J. Wysocki (Intel) > Cc: stable@vger.kernel.org For the coldfire changes: Acked-by: Greg Ungerer Regards Greg > --- > arch/arm/kernel/bios32.c | 5 ++--- > arch/m68k/coldfire/pci.c | 3 +-- > arch/mips/pci/pci-legacy.c | 5 ++--- > arch/sh/drivers/pci/pci.c | 3 +-- > drivers/parisc/lba_pci.c | 7 ++----- > drivers/pci/hotplug/acpiphp_glue.c | 3 +-- > drivers/pci/setup-bus.c | 7 +++++++ > drivers/pcmcia/cardbus.c | 3 +-- > include/linux/pci.h | 1 + > 9 files changed, 18 insertions(+), 19 deletions(-) > > diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c > index ac0e890510da..555bfb091d30 100644 > --- a/arch/arm/kernel/bios32.c > +++ b/arch/arm/kernel/bios32.c > @@ -510,15 +510,14 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) > /* > * We insert PCI resources into the iomem_resource and > * ioport_resource trees in either pci_bus_claim_resources() > - * or pci_bus_assign_resources(). > + * or pci_bus_size_and_assign_resources(). > */ > if (pci_has_flag(PCI_PROBE_ONLY)) { > pci_bus_claim_resources(bus); > } else { > struct pci_bus *child; > > - pci_bus_size_bridges(bus); > - pci_bus_assign_resources(bus); > + pci_bus_size_and_assign_resources(bus); > > list_for_each_entry(child, &bus->children, node) > pcie_bus_configure_settings(child); > diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c > index 5afb207ccc51..dd21c77c43a6 100644 > --- a/arch/m68k/coldfire/pci.c > +++ b/arch/m68k/coldfire/pci.c > @@ -250,8 +250,7 @@ static int __init mcf_pci_init(void) > rootbus->resource[0] = &mcf_pci_io; > rootbus->resource[1] = &mcf_pci_mem; > > - pci_bus_size_bridges(rootbus); > - pci_bus_assign_resources(rootbus); > + pci_bus_size_and_assign_resources(rootbus); > pci_bus_add_devices(rootbus); > return 0; > } > diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c > index dae6dafdd6e0..ec0e42d9a895 100644 > --- a/arch/mips/pci/pci-legacy.c > +++ b/arch/mips/pci/pci-legacy.c > @@ -129,15 +129,14 @@ static void pcibios_scanbus(struct pci_controller *hose) > /* > * We insert PCI resources into the iomem_resource and > * ioport_resource trees in either pci_bus_claim_resources() > - * or pci_bus_assign_resources(). > + * or pci_bus_size_and_assign_resources(). > */ > if (pci_has_flag(PCI_PROBE_ONLY)) { > pci_bus_claim_resources(bus); > } else { > struct pci_bus *child; > > - pci_bus_size_bridges(bus); > - pci_bus_assign_resources(bus); > + pci_bus_size_and_assign_resources(bus); > list_for_each_entry(child, &bus->children, node) > pcie_bus_configure_settings(child); > } > diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c > index 878a27a1acfb..c91ca8f4cb1c 100644 > --- a/arch/sh/drivers/pci/pci.c > +++ b/arch/sh/drivers/pci/pci.c > @@ -81,8 +81,7 @@ static void pcibios_scanbus(struct pci_channel *hose) > need_domain_info = 1; > } > > - pci_bus_size_bridges(hose->bus); > - pci_bus_assign_resources(hose->bus); > + pci_bus_size_and_assign_resources(hose->bus); > pci_bus_add_devices(hose->bus); > } > > diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c > index 5197a3c93c70..39ab93ba458b 100644 > --- a/drivers/parisc/lba_pci.c > +++ b/drivers/parisc/lba_pci.c > @@ -1639,11 +1639,8 @@ lba_driver_probe(struct parisc_device *dev) > if (is_pdc_pat()) { > /* assign resources to un-initialized devices */ > > - DBG_PAT("LBA pci_bus_size_bridges()\n"); > - pci_bus_size_bridges(lba_bus); > - > - DBG_PAT("LBA pci_bus_assign_resources()\n"); > - pci_bus_assign_resources(lba_bus); > + DBG_PAT("LBA pci_bus_size_and_assign_resources()\n"); > + pci_bus_size_and_assign_resources(lba_bus); > > #ifdef DEBUG_LBA_PAT > DBG_PAT("\nLBA PIOP resource tree\n"); > diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c > index 78e3effbb32d..632344f34cae 100644 > --- a/drivers/pci/hotplug/acpiphp_glue.c > +++ b/drivers/pci/hotplug/acpiphp_glue.c > @@ -465,8 +465,7 @@ static void acpiphp_native_scan_bridge(struct pci_dev *bridge) > max = pci_scan_bridge(bus, dev, max, 1); > if (dev->subordinate) { > pcibios_resource_survey_bus(dev->subordinate); > - pci_bus_size_bridges(dev->subordinate); > - pci_bus_assign_resources(dev->subordinate); > + pci_bus_size_and_assign_resources(dev->subordinate); > } > } > } > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c > index ed16ef7c26fa..29ec9ba59d92 100644 > --- a/drivers/pci/setup-bus.c > +++ b/drivers/pci/setup-bus.c > @@ -2492,3 +2492,10 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus) > __pci_bus_assign_resources(bus, &add_list, NULL); > } > EXPORT_SYMBOL_GPL(pci_assign_unassigned_bus_resources); > + > +void pci_bus_size_and_assign_resources(struct pci_bus *bus) > +{ > + pci_bus_size_bridges(bus); > + __pci_bus_assign_resources(bus, NULL, NULL); > +} > +EXPORT_SYMBOL_GPL(pci_bus_size_and_assign_resources); > diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c > index 5e5cf2c3e2c8..19df3f9228a7 100644 > --- a/drivers/pcmcia/cardbus.c > +++ b/drivers/pcmcia/cardbus.c > @@ -81,8 +81,7 @@ int __ref cb_alloc(struct pcmcia_socket *s) > /* > * Size all resources below the CardBus controller. > */ > - pci_bus_size_bridges(bus); > - pci_bus_assign_resources(bus); > + pci_bus_size_and_assign_resources(bus); > cardbus_config_irq_and_cls(bus, s->pci_irq); > > /* socket specific tune function */ > diff --git a/include/linux/pci.h b/include/linux/pci.h > index aa3765a20a96..d89aeb7c9ff7 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1569,6 +1569,7 @@ resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); > void pci_bus_assign_resources(const struct pci_bus *bus); > void pci_bus_claim_resources(struct pci_bus *bus); > void pci_bus_size_bridges(struct pci_bus *bus); > +void pci_bus_size_and_assign_resources(struct pci_bus *bus); > int pci_claim_resource(struct pci_dev *, int); > int pci_claim_bridge_resource(struct pci_dev *bridge, int i); > void pci_assign_unassigned_resources(void);