From: Bjorn Helgaas <helgaas@kernel.org>
To: Keith Busch <kbusch@meta.com>
Cc: linux-pci@vger.kernel.org, dan.j.williams@intel.com,
alex@shazbot.org, ilpo.jarvinen@linux.intel.com,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv5 2/3] PCI: allow all bus devices to use the same slot
Date: Mon, 9 Mar 2026 15:50:09 -0500 [thread overview]
Message-ID: <20260309205009.GA582379@bhelgaas> (raw)
In-Reply-To: <20260217160836.2709885-3-kbusch@meta.com>
On Tue, Feb 17, 2026 at 08:08:35AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> A pcie hotplug slot applies to the entire subordinate bus. Thus, pciehp
> only allocates a single hotplug_slot for the bridge to that bus. The pci
> slot, though, would only match to functions on device 0, meaning all
> device beyond that are not matched to any slot even though they share
> it. A slot reset will break all the missing devices because the handling
> skips them.
I tweaked this a bit to (a) refer to the "secondary" bus instead of
"subordinate" to avoid confusion with the PCI "subordinate" term
("pci_dev->subordinate" already has this confusion but is harder to
fix), and (b) mention ARI, which I think is what causes the problem
you're solving:
+ A PCIe hotplug slot applies to the entire secondary bus. Thus, pciehp only
+ allocates a single hotplug_slot for the bridge to that bus. The existing
+ PCI slot, though, would only match to functions on device 0, meaning any
+ devices beyond that, e.g., ARI functions, are not matched to any slot even
+ though they share it.
> For example, ARI devices with more than 8 functions fail because their state is
> not properly handled, nor is the attached driver notified of the reset. In the
> best case, the device will appear unresponsive to the driver, resulting in
> unexpected errors. A worse possibility may panic the kernel if in flight
> transactions trigger hardware reported errors like this real observation:
> @@ -222,6 +233,13 @@ static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr)
> * consist solely of a dddd:bb tuple, where dddd is the PCI domain of the
> * %struct pci_bus and bb is the bus number. In other words, the devfn of
> * the 'placeholder' slot will not be displayed.
> + *
> + * Bus-wide slots:
> + * For PCIe hotplug, the physical slot encompasses the entire subordinate
> + * bus, not just a single device number. Pass @slot_nr == PCI_SLOT_ALL_DEVICES
> + * to create a slot that matches all devices on the bus. Unlike placeholder
> + * slots, bus-wide slots go through normal slot lookup and reuse existing
> + * slots if present.
+ * For PCIe hotplug, the physical slot encompasses the entire secondary
+ * bus, not just a single device number. If the device supports ARI and ARI
+ * Forwarding is enabled in the upstream bridge, a multi-function device
+ * may include functions that appear to have several different device
+ * numbers, i.e., PCI_SLOT() values. Pass @slot_nr == PCI_SLOT_ALL_DEVICES
> */
> struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
> const char *name,
> +++ b/include/linux/pci.h
> @@ -72,12 +72,18 @@
> /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
> #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
>
> +/*
> + * PCI_SLOT_ALL_DEVICES indicates a slot that covers all devices on the bus.
> + * Used for PCIe hotplug where the physical slot is the entire subordinate bus.
+ * Used for PCIe hotplug where the physical slot is the entire secondary bus,
+ * and, if ARI Forwarding is enabled, functions may appear to be on multiple
+ * devices.
Let me know if I got any of this wrong.
Bjorn
next prev parent reply other threads:[~2026-03-09 20:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 16:08 [PATCHv5 0/3] pci slot reset handling fixes Keith Busch
2026-02-17 16:08 ` [PATCHv5 1/3] PCI: rename __pci_bus_reset and __pci_slot_reset Keith Busch
2026-02-17 16:08 ` [PATCHv5 2/3] PCI: allow all bus devices to use the same slot Keith Busch
2026-03-09 20:50 ` Bjorn Helgaas [this message]
2026-03-11 19:35 ` Dan Williams
2026-02-17 16:08 ` [PATCHv5 3/3] PCI: make reset_subordinate hotplug safe Keith Busch
2026-02-26 22:41 ` [PATCHv5 0/3] pci slot reset handling fixes Keith Busch
2026-03-05 23:17 ` Bjorn Helgaas
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=20260309205009.GA582379@bhelgaas \
--to=helgaas@kernel.org \
--cc=alex@shazbot.org \
--cc=dan.j.williams@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-pci@vger.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