From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Sanath S <sanaths2@amd.com>
Cc: Sanath S <Sanath.S@amd.com>,
mario.limonciello@amd.com, andreas.noever@gmail.com,
michael.jamet@intel.com, YehezkelShB@gmail.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Patch v2 2/2] thunderbolt: Teardown tunnels and reset downstream ports created by boot firmware
Date: Wed, 13 Dec 2023 13:52:56 +0200 [thread overview]
Message-ID: <20231213115256.GM1074920@black.fi.intel.com> (raw)
In-Reply-To: <adcc6446-8c30-a258-e19b-76fca2c50d21@amd.com>
On Wed, Dec 13, 2023 at 04:04:57PM +0530, Sanath S wrote:
>
> On 12/13/2023 11:53 AM, Mika Westerberg wrote:
> > On Wed, Dec 13, 2023 at 08:18:06AM +0200, Mika Westerberg wrote:
> > > On Wed, Dec 13, 2023 at 07:49:14AM +0200, Mika Westerberg wrote:
> > > > On Wed, Dec 13, 2023 at 12:46:35AM +0530, Sanath S wrote:
> > > > > Boot firmware might have created tunnels of its own. Since we cannot
> > > > > be sure they are usable for us. Tear them down and reset the ports
> > > > > to handle it as a new hotplug for USB3 routers.
> > > > >
> > > > > Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
> > > > > Signed-off-by: Sanath S <Sanath.S@amd.com>
> > > > > ---
> > > > > drivers/thunderbolt/tb.c | 11 +++++++++++
> > > > > 1 file changed, 11 insertions(+)
> > > > >
> > > > > diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> > > > > index fd49f86e0353..febd0b6972e3 100644
> > > > > --- a/drivers/thunderbolt/tb.c
> > > > > +++ b/drivers/thunderbolt/tb.c
> > > > > @@ -2598,6 +2598,17 @@ static int tb_start(struct tb *tb)
> > > > > tb_switch_tmu_enable(tb->root_switch);
> > > > > /* Full scan to discover devices added before the driver was loaded. */
> > > > > tb_scan_switch(tb->root_switch);
> > > > > + /*
> > > > > + * Boot firmware might have created tunnels of its own. Since we cannot
> > > > > + * be sure they are usable for us, Tear them down and reset the ports
> > > > > + * to handle it as new hotplug for USB4 routers.
> > > > > + */
> > > > > + if (tb_switch_is_usb4(tb->root_switch)) {
> > > > > + tb_switch_discover_tunnels(tb->root_switch,
> > > > > + &tcm->tunnel_list, false);
> > > > Why this is needed?
> > > >
> > > > It should be enough, to do simply something like this:
> > > >
> > > > if (tb_switch_is_usb4(tb->root_switch))
> > > > tb_switch_reset(tb->root_switch);
> If we don't tear down of tunnels before performing the DPR, the PCIe
> enumeration is failing.
>
> PCIe link is not coming up after DPR. Below log is missing without
> performing path
> deactivation before performing DPR and hence PCIe enumeration is not
> initiated.
>
> [ 746.630865] pcieport 0000:00:03.1: pciehp: Slot(0-1): Card present
> [ 746.630885] pcieport 0000:00:03.1: pciehp: Slot(0-1): Link Up
>
> I think when we do a DPR, it internally does some handling with PCI Path
> Enable bit(PE).
> So, deactivation of PCIe path is necessary for DPR to work.
Rigth, it should be enough to reset the protocol adapter config and path
config spaces. I guess using discovery at this point is fine too but I
would at least check how complex doing the minimal "reset" turns out.
I mean in tb_switch_reset() for USB4 v1 routers it can go over all the
adapters and perform "cleanup" or so.
> > > Actually this needs to be done only for USB4 v1 routers since we already
> > > reset USB4 v2 hosts so something like:
> > >
> > > /*
> > > * Reset USB4 v1 host router to get rid of possible tunnels the
> > > * boot firmware created. This makes sure all the tunnels are
> > > * created by us and thus have known configuration.
> > > *
> > > * For USB4 v2 and beyond we do this in nhi_reset() using the
> > > * host router reset interface.
> > > */
> > > if (usb4_switch_version(tb->root_switch) == 1)
> > > tb_switch_reset(tb->root_switch);
> > >
> > > (possibly add similar comment to the nhi_reset() to refer this one).
> > Oh, and would it be possible to tie this with the "host_reset" parameter
> > too somehow? I guess it could be moved to "tb.c" and "tb.h" and then
> > check it from nhi.c as already done and then here so this would become:
> >
> > if (host_reset && usb4_switch_version(tb->root_switch) == 1)
> > tb_switch_reset(tb->root_switch);
>
> Is host_reset necessary for USB4 v1 routers ? I did not use host_reset in
> this case.
> If its needed, then we have to modify to enable host_reset in nhi.c as well.
Well you are effectively doing that here, no? You "reset" the host
router therefore tying this to the same command line parameter makes
sense and allows user an "escape hatch" if this turns out breaking
things.
next prev parent reply other threads:[~2023-12-13 11:53 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 19:16 [PATCH v2 0/2] Add support for downstream port reset(DPR) Sanath S
2023-12-12 19:16 ` [Patch v2 1/2] thunderbolt: Introduce tb_switch_reset_ports(), tb_port_reset() and usb4_port_reset() Sanath S
2023-12-12 19:26 ` Mario Limonciello
2023-12-13 5:59 ` Mika Westerberg
2023-12-13 11:58 ` Sanath S
2023-12-13 12:04 ` Mika Westerberg
2023-12-12 19:16 ` [Patch v2 2/2] thunderbolt: Teardown tunnels and reset downstream ports created by boot firmware Sanath S
2023-12-12 19:24 ` Mario Limonciello
2023-12-12 19:25 ` Mario Limonciello
2023-12-13 5:49 ` Mika Westerberg
2023-12-13 6:18 ` Mika Westerberg
2023-12-13 6:23 ` Mika Westerberg
2023-12-13 10:34 ` Sanath S
2023-12-13 11:52 ` Mika Westerberg [this message]
2023-12-14 6:38 ` Sanath S
2023-12-14 7:07 ` Mika Westerberg
2023-12-14 7:20 ` Sanath S
2023-12-14 7:32 ` Mika Westerberg
2023-12-14 15:30 ` Sanath S
2023-12-15 11:55 ` Mika Westerberg
2023-12-15 13:54 ` Sanath S
2023-12-15 14:02 ` Mika Westerberg
2023-12-18 10:20 ` Sanath S
2023-12-18 10:42 ` Mika Westerberg
2023-12-18 11:19 ` Sanath S
2023-12-18 11:31 ` Mika Westerberg
2023-12-18 12:23 ` Mika Westerberg
2023-12-18 13:05 ` Sanath S
2023-12-18 13:18 ` Mika Westerberg
2023-12-19 9:11 ` Sanath S
2023-12-19 12:26 ` Mika Westerberg
2023-12-19 14:35 ` Sanath S
2023-12-19 18:04 ` Mika Westerberg
2023-12-20 12:58 ` Mika Westerberg
2023-12-20 17:01 ` Sanath S
2023-12-21 9:31 ` Sanath S
2023-12-21 9:53 ` Mika Westerberg
2024-01-03 14:15 ` Sanath S
2024-01-03 17:17 ` Mika Westerberg
2024-01-04 13:47 ` Sanath S
2024-01-04 13:50 ` Sanath S
2024-01-05 7:08 ` Mika Westerberg
2024-01-08 4:56 ` Sanath S
2024-01-10 14:32 ` Mika Westerberg
2024-01-04 16:49 ` Sanath S
2024-01-05 7:06 ` Mika Westerberg
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=20231213115256.GM1074920@black.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=Sanath.S@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=michael.jamet@intel.com \
--cc=sanaths2@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