From: Bjorn Helgaas <helgaas@kernel.org>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Sanath S <Sanath.S@amd.com>,
bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
Sanjay R Mehta <sanju.mehta@amd.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
"Maciej W. Rozycki" <macro@orcam.me.uk>
Subject: Re: [PATCH] PCI: Allocate maximum available buses to help extending the daisy chain
Date: Fri, 8 Dec 2023 16:44:00 -0600 [thread overview]
Message-ID: <20231208224400.GA835068@bhelgaas> (raw)
In-Reply-To: <1e0431bc-6747-4367-bbbd-95c75395329f@amd.com>
On Fri, Dec 08, 2023 at 04:29:42PM -0600, Mario Limonciello wrote:
> On 12/8/2023 16:24, Bjorn Helgaas wrote:
> > On Wed, Aug 16, 2023 at 10:49:23AM +0530, Sanath S wrote:
> > > In the case of Thunderbolt, it contains a PCIe switch and one or
> > > more hotplug-capable PCIe downstream ports where the daisy chain
> > > can be extended.
> > >
> > > Currently when a Thunderbolt Dock is plugged in during S5/Reboot,
> > > System BIOS allocates a very minimal number of buses for bridges and
> > > hot-plug capable PCIe downstream ports to enumerate the dock during
> > > boot. Because of this, we run out of bus space pretty quickly when
> > > more PCIe devices are attached to hotplug downstream ports in order
> > > to extend the chain.
> > >
> > > Before:
> > > +-04.0
> > > +-04.1-[63-c1]----00.0-[64-69]--+-00.0-[65]--
> > > | +-01.0-[66]--
> > > | +-02.0-[67]--
> > > | +-03.0-[68]--
> > > | \-04.0-[69]--
> > > +-08.0
> >
> > Looks like a clear issue here because there's no other use for
> > buses 70-c1. But what would happen if there were more hotplug-capable
> > downstream ports, e.g., assume one at 08.1 leading to [bus c2-c7]?
> >
> > The 04.1 bridge has a lot of space, but 08.1 has very little. With
> > this patch, would we distribute it more evenly across 04.1 and 08.1?
> > If not, I think we'll just have the same problem when somebody plugs
> > in a similar hierarchy at 08.1.
> >
> > > In case of a thunderbolt capable bridge, reconfigure the buses allocated
> > > by BIOS to the maximum available buses. So that the hot-plug bridges gets
> > > maximum buses and chain can be extended to accommodate more PCIe devices.
> > > This fix is necessary for all the PCIe downstream ports where the daisy
> > > chain can be extended.
> > >
> > > After:
> > > +-04.0
> > > +-04.1-[63-c1]----00.0-[64-c1]--+-00.0-[65]--
> > > | +-01.0-[66-84]--
> > > | +-02.0-[85-a3]--
> > > | +-03.0-[a4-c0]--
> > > | \-04.0-[c1]--
> > > +-08.0
> >
> > This doesn't look like anything specific to Thunderbolt; it's just
> > that we don't do a good job of reassigning bus numbers in general,
> > right? We shouldn't just punt and say "BIOS should have done
> > something" because not all machines *have* BIOS, and the OS can
> > reconfigure bus numbers as needed. The patch certainly isn't
> > Thunderbolt-specific.
>
> From the discussions Sanath and I have been in related to this issue
> the BIOS is pretty static with it's initialization under the
> presumption that the OS will rebalance things if necessary.
> ...
> For this particular issue it's being approached a different way.
>
> Windows never rebalances things but doesn't suffer from this issue.
> That's because Windows actually does a "Downstream port reset" when
> it encounters a USB4 router.
>
> Sanath posted a quirk that aligned this behavior when encountering
> an AMD USB4 router, but as part of the discussion I suggested that
> we do it for everyone.
>
> https://lore.kernel.org/linux-usb/20231123065739.GC1074920@black.fi.intel.com/
>
> So Sanath has a new patch that does this that is under testing right
> now and will be posted soon.
Hmm, ok. I don't know what a "downstream port reset" does or how it
resolves the bus number allocation issue, but I'm happy if you have a
fix that doesn't need PCI core changes.
Bjorn
next prev parent reply other threads:[~2023-12-08 22:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 5:19 [PATCH] PCI: Allocate maximum available buses to help extending the daisy chain Sanath S
2023-08-16 13:18 ` Sanath S
2023-08-17 10:24 ` Mika Westerberg
2023-08-18 3:31 ` Sanath S
2023-08-18 4:56 ` Mika Westerberg
2023-08-22 14:36 ` Maciej W. Rozycki
2023-08-23 14:15 ` kernel test robot
2023-12-08 22:24 ` Bjorn Helgaas
2023-12-08 22:29 ` Mario Limonciello
2023-12-08 22:44 ` Bjorn Helgaas [this message]
2023-12-11 21:48 ` Mario Limonciello
2023-12-12 20:54 ` 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=20231208224400.GA835068@bhelgaas \
--to=helgaas@kernel.org \
--cc=Sanath.S@amd.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=mario.limonciello@amd.com \
--cc=mika.westerberg@linux.intel.com \
--cc=sanju.mehta@amd.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;
as well as URLs for NNTP newsgroup(s).