From: Ethan Zhao <etzhao1900@gmail.com>
To: Rui He <rui.he@windriver.com>, Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Prashant.Chikhalkar@windriver.com, Jiguang.Xiao@windriver.com
Subject: Re: [PATCH 1/1] pci: Add subordinate check before pci_add_new_bus()
Date: Sun, 17 Aug 2025 10:46:08 +0800 [thread overview]
Message-ID: <64025ba8-948a-4d91-8fc6-a1ede807ca8d@gmail.com> (raw)
In-Reply-To: <20250814093937.2372441-1-rui.he@windriver.com>
On 8/14/2025 5:39 PM, Rui He wrote:
> For preconfigured PCI bridge, child bus created on the first scan.
> While for some reasons(e.g register mutation), the secondary, and subordiante
> register reset to 0 on the second scan, which caused to create
> PCI bus twice for the same PCI device.
>
> Following is the related log:
> [Wed May 28 20:38:36 CST 2025] pci 0000:0b:01.0: PCI bridge to [bus 0d]
> [Wed May 28 20:38:36 CST 2025] pci 0000:0b:05.0: bridge configuration invalid ([bus 00-00]), reconfiguring
> [Wed May 28 20:38:36 CST 2025] pci 0000:0b:01.0: PCI bridge to [bus 0e-10]
> [Wed May 28 20:38:36 CST 2025] pci 0000:0b:05.0: PCI bridge to [bus 0f-10]
Could you help to attach a 'lspci -t' about the topology ?
bridge 0000:0b:01.0 and 0000:0b:05.0 have the same subordinate
bus number, that is weird seems they aren't connected as upstream
and downstream, but siblings.
Does the device behind the bridge 0000:0b:05.0 work after the
second scan (TLP are forwarded) ?>
> Here PCI device 000:0b:01.0 assigend to bus 0d and 0e.
>
> This patch checks if child PCI bus has been created on the second scan
> of bridge. If yes, return directly instead of create a new one.
>
> Signed-off-by: Rui He <rui.he@windriver.com>
> ---
> drivers/pci/probe.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index f41128f91ca76..ec67adbf31738 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1444,6 +1444,9 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
> goto out;
> }
>
The bridge should was marked as broken=1 already, bailed out earlier,
wouldn't get here with bridge forwarding was disabled. no further
configuration anymore. what is your kernel number ?
Thanks,
Ethan> + if(pci_has_subordinate(dev))
> + goto out;
> +
> /* Clear errors */
> pci_write_config_word(dev, PCI_STATUS, 0xffff);
>
next prev parent reply other threads:[~2025-08-17 2:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 9:39 [PATCH 1/1] pci: Add subordinate check before pci_add_new_bus() Rui He
2025-08-14 20:36 ` Bjorn Helgaas
2025-08-15 2:31 ` He, Rui
2025-08-15 14:22 ` Bjorn Helgaas
2025-08-26 7:01 ` He, Rui
2025-08-17 2:46 ` Ethan Zhao [this message]
2025-08-25 8:47 ` He, Rui
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=64025ba8-948a-4d91-8fc6-a1ede807ca8d@gmail.com \
--to=etzhao1900@gmail.com \
--cc=Jiguang.Xiao@windriver.com \
--cc=Prashant.Chikhalkar@windriver.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rui.he@windriver.com \
/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