From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: linux-pci@vger.kernel.org, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 1/3] PCI: Cache bridge firmware secondary bus number
Date: Fri, 13 Nov 2026 01:05:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-212033@kernel.org> (raw)
In-Reply-To: <20261112-vfct-regression-v7-1-69b1e0cf45c2@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] PCI: dead fw_sec_bus_sampled in pci_read_bridge_windows() and
log mismatch
--
commit d3720492f32e5a284ef73b3dc9f69d02b13df2c4
Author: Mario Limonciello <mario.limonciello@amd.com>
PCI: Cache bridge firmware secondary bus number
This commit caches the firmware-assigned secondary bus number on a PCI
bridge's struct pci_dev in pci_read_bridge_windows() before bus renumbering
can occur.
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 27008e2ea5afc..f20a4b8f7a23b 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -505,14 +505,26 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res,
> static void pci_read_bridge_windows(struct pci_dev *bridge)
> {
> u32 buses;
> + u8 secondary;
> + u8 subordinate;
> u16 io;
> u32 pmem, tmp;
> struct resource res;
>
> pci_read_config_dword(bridge, PCI_PRIMARY_BUS, &buses);
> res.flags = IORESOURCE_BUS;
> - res.start = FIELD_GET(PCI_SECONDARY_BUS_MASK, buses);
> - res.end = FIELD_GET(PCI_SUBORDINATE_BUS_MASK, buses);
> + secondary = FIELD_GET(PCI_SECONDARY_BUS_MASK, buses);
> + subordinate = FIELD_GET(PCI_SUBORDINATE_BUS_MASK, buses);
> + res.start = secondary;
> + res.end = subordinate;
> +
> + if (!bridge->fw_sec_bus_sampled) {
> + bridge->fw_sec_bus_sampled = true;
> + if (secondary > 0 && secondary < 0xff) {
> + bridge->fw_sec_busnr = secondary;
> + bridge->fw_sec_bus_valid = true;
> + }
> + }
[Severity: Low]
As reported by Lazar, Lijo on v5 [1], is bridge->fw_sec_bus_sampled needed
here?
pci_read_bridge_windows() is only called from pci_setup_device() when
pci_scan_device() first allocates and initializes a new struct pci_dev. On
later bus rescans, pci_scan_single_device() finds the existing device via
pci_get_slot() and returns early without calling pci_setup_device() or
pci_read_bridge_windows(). Because pci_read_bridge_windows() runs at most
once per bridge instance on a zero-initialized struct pci_dev,
fw_sec_bus_sampled is always false on entry and is never read elsewhere,
making the bitfield and the commit message's rescan explanation unnecessary.
In addition, since bus 0 is the root bus and fw_sec_busnr is only set when
secondary > 0 && secondary < 0xff, fw_sec_bus_valid is redundant with
checking whether fw_sec_busnr is non-zero.
[1] https://lore.kernel.org/r/eba45235-a6b1-4a48-9c56-9e069c299478@amd.com
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-vfct-regression-v7-0-69b1e0cf45c2@amd.com?part=1
next prev parent reply other threads:[~2026-11-13 1:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 21:54 [PATCH v7 0/3] Fix VFCT matching after PCI bus renumbering Mario Limonciello
2026-11-12 21:54 ` [PATCH v7 1/3] PCI: Cache bridge firmware secondary bus number Mario Limonciello
2026-11-13 1:05 ` sashiko-bot [this message]
2026-11-12 21:54 ` [PATCH v7 2/3] drm/amdgpu: Match VFCT using initial PCI " Mario Limonciello
2026-11-13 0:59 ` sashiko-bot
2026-11-12 21:54 ` [PATCH v7 3/3] drm/radeon: " Mario Limonciello
2026-11-13 0:58 ` sashiko-bot
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=sashiko-outbox-212033@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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