All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Christian Schaubschläger" <christian.schaubschlaeger@gmx.at>
Cc: linux-usb@vger.kernel.org,
	"michael.simon@cpsd.at" <michael.simon@cpsd.at>
Subject: Re: Possible problem with thunderbolt 4
Date: Tue, 3 Jan 2023 13:08:05 +0200	[thread overview]
Message-ID: <Y7QMlV82mtaApJwJ@black.fi.intel.com> (raw)
In-Reply-To: <a324ff2a-d014-83d2-4f30-b865db7c352b@gmx.at>

Hi,

On Tue, Jan 03, 2023 at 10:08:16AM +0100, Christian Schaubschläger wrote:
> Good morning,
> 
> > Can you try the below hack? It should tear down all tunnels during
> > reboot so the firmware should see pristine path configuration spaces
> > (assuming it is looking at them and failing because if already configure
> > paths).
> >
> > diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> > index 1711dc19b1e2..e0544843e242 100644
> > --- a/drivers/thunderbolt/tb.c
> > +++ b/drivers/thunderbolt/tb.c
> > @@ -1982,13 +1982,7 @@ static void tb_stop(struct tb *tb)
> >  	cancel_delayed_work(&tcm->remove_work);
> >  	/* tunnels are only present after everything has been initialized */
> >  	list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) {
> > -		/*
> > -		 * DMA tunnels require the driver to be functional so we
> > -		 * tear them down. Other protocol tunnels can be left
> > -		 * intact.
> > -		 */
> > -		if (tb_tunnel_is_dma(tunnel))
> > -			tb_tunnel_deactivate(tunnel);
> > +		tb_tunnel_deactivate(tunnel);
> >  		tb_tunnel_free(tunnel);
> >  	}
> >  	tb_switch_remove(tb->root_switch);
> That doesn't change the behaviour unfortunately.

Okay then it is not about the paths.

> I did find out two (confusing) things, though. The network interface
> on the dock is an Intel I255-LMvP, in linux it's eth1. When I do this
> before the reboot:
> 
> echo 1 > /sys/class/net/eth1/device/remove
> 
> the device is removed and then added again immedidately:
> 
> [   31.930950] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> [   77.496059] igc 0000:2c:00.0 eth1: PHC removed
> [   77.670531] pci 0000:2c:00.0: Removing from iommu group 21
> [   78.551553] pci 0000:2c:00.0: [8086:5502] type 00 class 0x020000
> [   78.552412] pci 0000:2c:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
> [   78.553194] pci 0000:2c:00.0: reg 0x1c: [mem 0x00000000-0x00003fff]
> [   78.554128] pci 0000:2c:00.0: PME# supported from D0 D3hot D3cold
> [   78.555110] pci 0000:2c:00.0: Adding to iommu group 21
> [   78.555913] pcieport 0000:04:04.0: ASPM: current common clock configuration is inconsistent, reconfiguring
> [   78.566265] pci_bus 0000:05: Allocating resources
> [   78.566285] pci_bus 0000:2c: Allocating resources
> [   78.566296] pci 0000:2c:00.0: BAR 0: assigned [mem 0x82000000-0x820fffff]
> [   78.567075] pci 0000:2c:00.0: BAR 3: assigned [mem 0x82100000-0x82103fff]
> [   78.567862] igc 0000:2c:00.0: enabling device (0000 -> 0002)
> [   78.568671] igc 0000:2c:00.0: PTM enabled, 4ns granularity
> [   78.626297] pps pps0: new PPS source ptp1
> [   78.627161] igc 0000:2c:00.0 (unnamed net_device) (uninitialized): PHC added
> [   78.653444] igc 0000:2c:00.0: 4.000 Gb/s available PCIe bandwidth (5.0 GT/s PCIe x1 link)
> [   78.654448] igc 0000:2c:00.0 eth1: MAC: 5c:60:ba:71:ea:be
> [   78.655307] pci_bus 0000:05: Allocating resources
> [   78.655327] pci_bus 0000:2c: Allocating resources
> [   81.598703] igc 0000:2c:00.0 eth1: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
> [   81.599729] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> 
> 
> If I reboot now, I can see the network interface in the firmware!

Does this happens 100% or it happened just once?

> And now for the confusing part: I do exactly the same steps as above,
> but whith an external display connected to the dock. Even if I don't
> touch this display in Linux (the i915 driver isn't loaded, just efi
> framebuffer), then the net interface is gone in the firmware after the
> reboot...

It is enough if there is monitor plugged the DP tunnel is then up even
if there is no i915.

> Also, after the
> 
> echo 1 > /sys/class/net/eth1/device/remove
> 
> 
> the device doesn't show up in linux again:
> 
> [   10.158596] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
> [   42.773958] igc 0000:2c:00.0 eth1: PHC removed
> [   42.962208] pci 0000:2c:00.0: Removing from iommu group 21

You mean with display connected it does not show up again?

I think what is expected is that when you do

 # echo 1 > /sys/class/net/eth1/device/remove

the network interface is removed and it is not expected to come back but
I realized that when you have the DP connected the TCSS (Type-C
SubsSystem) does not enter D3.

So I wonder if you can run another test still?

0. Remove the hack patch if not already.

Steps 1-3 same as before.

4. Disable runtime PM from the PCIe root ports:

  # echo on > /sys/bus/pci/devices/0000:00:07.0/power/control
  # echo on > /sys/bus/pci/devices/0000:00:07.1/power/control
  # echo on > /sys/bus/pci/devices/0000:00:07.2/power/control
  # echo on > /sys/bus/pci/devices/0000:00:07.3/power/control

(or how many Thunderbolt PCIE root ports you have, disable it from all of them).

5. De-authorize the PCIe tunnel

  # echo 0 > /sys/bus/thunderbolt/devices/.../authorized

6. Soft reboot

Does this change anything or the behavior is the same?

  reply	other threads:[~2023-01-03 11:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 11:24 Possible problem with thunderbolt 4 Christian Schaubschläger
2022-12-27 14:28 ` Mika Westerberg
2022-12-30  7:57   ` Christian Schaubschläger
2022-12-30  9:28     ` Mika Westerberg
2022-12-30 11:38       ` Christian Schaubschläger
2022-12-30 11:55         ` Mika Westerberg
2022-12-30 12:08           ` Christian Schaubschläger
2022-12-30 12:21             ` Mika Westerberg
2023-01-02  8:56               ` Christian Schaubschläger
2023-01-02 11:11                 ` Mika Westerberg
2023-01-02 11:45                   ` Christian Schaubschläger
2023-01-02 16:23                     ` Mika Westerberg
2023-01-03  9:08                       ` Christian Schaubschläger
2023-01-03 11:08                         ` Mika Westerberg [this message]
2023-01-03 12:14                           ` Christian Schaubschläger
2023-01-03 16:07                             ` Mika Westerberg
2023-01-03 17:50                               ` Christian Schaubschläger
2023-01-04  8:04                                 ` Mika Westerberg
2023-01-09 12:17                                   ` Christian Schaubschläger
2023-01-09 12:50                                     ` Mika Westerberg
2023-01-09 14:21                                       ` Christian Schaubschläger
2023-01-10 15:12                                         ` Mika Westerberg
2023-01-11 10:38                                           ` Christian Schaubschläger
2023-01-11 10:45                                             ` Mika Westerberg
2023-01-19  9:41                                               ` Christian Schaubschläger
2023-01-19 10:10                                                 ` Mika Westerberg
2023-01-19 14:37                                                   ` Christian Schaubschläger
2023-01-20 10:14                                                     ` Mika Westerberg
2023-01-20 11:19                                                       ` Christian Schaubschläger
2023-01-20 11:36                                                         ` Mika Westerberg
2023-01-27 12:07                                                     ` Christian Schaubschläger
2023-01-27 12:27                                                       ` Mika Westerberg
2023-01-30 10:52                                                         ` Christian Schaubschläger
2023-01-30 14:10                                                           ` Mika Westerberg
2023-03-06 11:52                                                             ` Mika Westerberg
2023-03-06 12:27                                                               ` Christian Schaubschläger
2023-05-23  8:22                                                                 ` Christian Schaubschläger
2023-05-23  8:55                                                                   ` 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=Y7QMlV82mtaApJwJ@black.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=christian.schaubschlaeger@gmx.at \
    --cc=linux-usb@vger.kernel.org \
    --cc=michael.simon@cpsd.at \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.