Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v8 0/3] Fix VFCT matching after PCI bus renumbering
@ 2026-11-19 19:21 Mario Limonciello
  2026-11-19 19:21 ` [PATCH v8 1/3] PCI: Cache bridge firmware secondary bus number Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mario Limonciello @ 2026-11-19 19:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Alex Deucher
  Cc: Christian König, Lijo Lazar, linux-pci, amd-gfx,
	Mario Limonciello, Reza Nikzad Chaleshori

amdgpu and radeon pick the VFCT image for a GPU by comparing the PCI bus
number recorded by the BIOS at POST with the device's bus number. When
the kernel renumbers buses (e.g. pci=realloc), the runtime number no
longer matches the one in VFCT.

commit 11c141672045f ("drm/amdgpu: Fix VFCT bus number matching with soft
filter") and its radeon counterpart worked around this by accepting an
entry whenever everything but the bus number matched. That picks the
wrong image when a system has two identical GPUs.

Instead, have the PCI core remember the secondary bus number of each
bridge at FW/OS handoff, and make amdgpu and radeon match the VFCT bus
number against it again, using the upstream bridge of the GPU. The
value is captured in pci_read_bridge_windows(), which only runs when the
bridge is first enumerated, so renumbering and later rescans don't
overwrite it.

Patch 1 adds the cached firmware secondary bus number to struct pci_dev.
Patches 2 and 3 convert amdgpu and radeon to use it and drop the soft
filter.

Link: https://lore.kernel.org/linux-pci/20261015124843.203905-1-mario.limonciello@amd.com/
Link: https://lore.kernel.org/amd-gfx/20261019194106.2796150-1-alexander.deucher@amd.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Changes in v8:
- PCI: Drop fw_sec_bus_sampled; pci_read_bridge_windows() only runs once
  per bridge, so it was dead code (Lijo, Sashiko).
- PCI: Drop fw_sec_bus_valid and the 0/0xff filtering; record the
  secondary bus number exactly as firmware left it at handoff, since
  0xff is a valid bus and that is the only number firmware knows
  about (Bjorn, Sashiko).
- amdgpu/radeon: Use pci_upstream_bridge() instead of bus->self (Bjorn).
- amdgpu/radeon: Use the cached bridge bus number unconditionally, only
  falling back to the current bus number for devices on a root bus
  (Bjorn).
- amdgpu/radeon: Return bool from *_acpi_vfct_match() instead of
  0/-ENODEV (Bjorn).
- radeon: Drop an unintended re-indent of the match function prototype.
- Link to v7: https://patch.msgid.link/20261112-vfct-regression-v7-0-69b1e0cf45c2@amd.com

Changes in v7:
- Reword the cover letter and the PCI patch to describe the current design:
  the firmware secondary bus number is cached on the bridge pci_dev when its
  bridge windows are first read, and amdgpu/radeon match VFCT against it.
- No code changes.
- Link to v6: https://patch.msgid.link/20261111-vfct-regression-v6-0-393797bbb6e3@amd.com

Changes in v6:
- Capture the firmware secondary bus number when reading bridge windows and
  ignore unconfigured values so rescans cannot replace it with runtime data
  (Sashiko).
- No change needed in the VFCT consumers; they continue to read the cached
  value from the upstream bridge.
- Link to v5: https://patch.msgid.link/20261110-vfct-regression-v5-0-f49fae981bf3@amd.com

Changes in v5:
- Record the firmware secondary bus number only on the bridge struct pci_dev,
  guard it with a validity bit, and keep it across rescans (Bjorn, Lijo).
- Drop pci_bus::number_initial and have amdgpu/radeon read the saved bridge
  number when matching VFCT entries.

Changes in v4:
- Retain secondary bus bus number for a bridge across rescans, and the child bus is initialized
  from it during allocation, before registration callbacks run. (Sashiko)
- Rename variable to clarify it's for bridges (Lijo)
- Link to v3: https://patch.msgid.link/20261026-vfct-regression-v3-0-fe9586ed6978@amd.com

Changes in v3:
- Preserve the firmware bus number across bridge renumbering, capturing the
  secondary bus number before pci_scan_bridge_extend() clears it.
- Adjust member name in all patches
- Add tags
- Link to v2: https://patch.msgid.link/20261020-vfct-regression-v2-0-d2394d11450a@amd.com

Changes in v2:
- pci_alloc_dev(NULL) remains safe.
- For buses behind a reassigned bridge, the PCI core now saves the firmware secondary bus
  number before clearing the bridge configuration and carries it into the newly allocated bus.
  Devices discovered there inherit that original number.
- Add changes for radeon too.
- Link to v1: https://patch.msgid.link/20261019-vfct-regression-v1-0-5a63ddd378dd@amd.com

---
Mario Limonciello (3):
      PCI: Cache bridge firmware secondary bus number
      drm/amdgpu: Match VFCT using initial PCI bus number
      drm/radeon: Match VFCT using initial PCI bus number

 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 42 ++++++++++++--------------------
 drivers/gpu/drm/radeon/radeon_bios.c     | 42 ++++++++++++--------------------
 drivers/pci/probe.c                      |  1 +
 include/linux/pci.h                      |  2 ++
 4 files changed, 33 insertions(+), 54 deletions(-)
---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261119-vfct-regression-v8-d767fad2d1f2

Best regards,
--  
Mario Limonciello <mario.limonciello@amd.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-19 20:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 19:21 [PATCH v8 0/3] Fix VFCT matching after PCI bus renumbering Mario Limonciello
2026-11-19 19:21 ` [PATCH v8 1/3] PCI: Cache bridge firmware secondary bus number Mario Limonciello
2026-11-19 19:26   ` sashiko-bot
2026-11-19 19:55   ` Bjorn Helgaas
2026-11-19 20:09   ` Alex Deucher
2026-11-19 19:21 ` [PATCH v8 2/3] drm/amdgpu: Match VFCT using initial PCI " Mario Limonciello
2026-11-19 19:28   ` sashiko-bot
2026-11-19 19:21 ` [PATCH v8 3/3] drm/radeon: " Mario Limonciello
2026-11-19 19:26   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox