From: Greg Ungerer <gerg@linux-m68k.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"David Matlack" <dmatlack@google.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Russell King" <linux@armlinux.org.uk>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Rich Felker" <dalias@libc.org>,
"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Helge Deller" <deller@gmx.de>, "Len Brown" <lenb@kernel.org>,
"Dominik Brodowski" <linux@dominikbrodowski.net>,
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
Subject: Re: [PATCH v3 01/17] PCI: Add pci_bus_size_and_assign_resources()
Date: Wed, 2 Dec 2026 15:21:37 +1000 [thread overview]
Message-ID: <877f7259-6065-42ef-9d25-2788c126ab11@linux-m68k.org> (raw)
In-Reply-To: <20261125230925.2441-2-ilpo.jarvinen@linux.intel.com>
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 <ilpo.jarvinen@linux.intel.com>
> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
> Cc: stable@vger.kernel.org
For the coldfire changes:
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
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);
next prev parent reply other threads:[~2026-12-02 5:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 23:08 [PATCH v3 00/17] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 01/17] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-12-02 5:21 ` Greg Ungerer [this message]
2026-11-25 23:09 ` [PATCH v3 02/17] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 03/17] PCI: Use guard() for pci_bus_sem in pci_do_resource_release_and_resize() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 04/17] PCI: Add pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 05/17] PCI: acpiphp: Use pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 06/17] PCI: Hold pci_bus_sem across sizing and assignment entrypoints Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 07/17] PCI: Make pci_find_host_bridge() take a const bus Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 08/17] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 09/17] PCI: Make internal sizing and assignment functions static Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 10/17] EDAC/i82875p: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
2026-11-26 0:32 ` Borislav Petkov
2026-11-25 23:09 ` [PATCH v3 11/17] platform/x86: asus-wmi: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 12/17] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 13/17] parisc/PCI: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 14/17] PCI: octep_hp: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 15/17] PCI: ftpci100: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 16/17] PCI: hv: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 17/17] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
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=877f7259-6065-42ef-9d25-2788c126ab11@linux-m68k.org \
--to=gerg@linux-m68k.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bhelgaas@google.com \
--cc=dalias@libc.org \
--cc=deller@gmx.de \
--cc=dmatlack@google.com \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kw@linux.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@dominikbrodowski.net \
--cc=lorenzo.pieralisi@arm.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=ysato@users.sourceforge.jp \
/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
all inboxes | Powered by JetHome®