mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
	Alex Deucher <alexander.deucher@amd.com>
Cc: Oz Tiram <oz@shift-computing.de>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH 1/2] PCI: Preserve the initial bus number in pci_dev
Date: Mon, 19 Oct 2026 20:44:31 -0500	[thread overview]
Message-ID: <20261019-vfct-regression-v1-1-5a63ddd378dd@amd.com> (raw)
In-Reply-To: <20261019-vfct-regression-v1-0-5a63ddd378dd@amd.com>

PCI bus numbers can be reassigned after device discovery, for example
during resource reallocation. Preserve the number seen at allocation
time so drivers can match devices using firmware-visible bus numbers.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/pci/probe.c | 1 +
 include/linux/pci.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 27008e2ea5afc..580b288d5c64f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2508,6 +2508,7 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
 	INIT_LIST_HEAD(&dev->bus_list);
 	dev->dev.type = &pci_dev_type;
 	dev->bus = pci_bus_get(bus);
+	dev->initial_bus_number = bus->number;
 	dev->driver_exclusive_resource = (struct resource) {
 		.name = "PCI Exclusive",
 		.start = 0,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ffcf5ce8c966..dae68b28ce051 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -363,6 +363,7 @@ struct pci_dev {
 	struct pci_slot	*slot;		/* Physical slot this device is in */
 
 	unsigned int	devfn;		/* Encoded device & function index */
+	u8		initial_bus_number;	/* Bus number when device was discovered */
 	unsigned short	vendor;
 	unsigned short	device;
 	unsigned short	subsystem_vendor;

-- 
2.43.0


  reply	other threads:[~2026-10-20  1:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  1:44 [PATCH 0/2] Fix amdgpu detection of pci=realloc Mario Limonciello
2026-10-20  1:44 ` Mario Limonciello [this message]
2026-10-20  1:44 ` [PATCH 2/2] drm/amdgpu: Match VFCT using initial PCI bus number Mario Limonciello
2026-10-20  2:06 ` [PATCH 0/2] Fix amdgpu detection of pci=realloc Mario Limonciello

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=20261019-vfct-regression-v1-1-5a63ddd378dd@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=oz@shift-computing.de \
    /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®