Re: [PATCH v4] PCI: Relabel JHL6540 on Lenovo X1 Carbon 7,8

Esther Shimanovich
2024-06-24T15:58:58Z

On Thu, May 16, 2024 at 5:16 AM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
>
> I suggest trying on more devices just to be sure it covers all of them.

I tested Mika's on additional devices, Lenovo ThinkPad T490 (JHL6250),
Dell Latitude 7400 (JHL6340), Lenovo Thinkpad Carbon X1 Gen 7
(JHL6540) and the HP Elitebook 840 G6 (JHL7540) and the patch worked
smoothly on all of those devices. It looks good to me! If you have any
specific types of additional devices you'd want me to test this on,
then let me know!

On Wed, May 15, 2024 at 4:45 PM Lukas Wunner <lukas@wunner.de> wrote:
>
> Could you add this to the command line:
>
> thunderbolt.dyndbg ignore_loglevel log_buf_len=10M
>
> and this to your kernel config:
>
> CONFIG_DYNAMIC_DEBUG=y
>
> You should see "... is associated with ..." messages in dmesg.

I tried Lukas's patches again, after enabling the Thunderbolt driver
in the config and also verbose messages, so that I can see
"thunderbolt:" messages, but it still never reaches the
tb_pci_notifier_call function. I don't see "associated with" in any of
the logs. The config on the image I am testing does not have the
thunderbolt driver enabled by default, so this patch wouldn't help my
use case even if I did manage to get it to work. I did spend some time
on this -- it seems like it would take more time to test this out. And
I would like maybe an explanation on why it is worth it to look into
this, before I continue. I appreciate your patience with this!

Things I tried:
-searching through all existing logs for "associated with" and nothing came up.
-I tried adding my own logs into the added function and compiling.
-I did cherry pick Lukas's commits onto an earlier version of the
kernel (5_15)--- I'm not sure if that could have affected anything.
-I tried littering pci.c with logs but none of them showed up after
deployment. I'm not sure at which point the thunderbolt driver decides
that PCI tunneling is occurring. That could be something to look into.
- I wonder if I am running into some additional ChromeOS-related
restrictions surrounding tunneling. This seems to be the likely case.

Also, this is what happens when I plug in an external thunderbolt
device. Maybe there's a reason in the logs why the
tb_pci_notifier_call function wasn't reached?:
```
2024-06-24T15:19:20.215183Z INFO kernel: [183837.056612] usb 1-5: new
high-speed USB device number 10 using xhci_hcd
2024-06-24T15:19:20.509844Z DEBUG kernel: [183837.349927] thunderbolt
0000:07:00.0: control channel starting...
2024-06-24T15:19:20.509867Z DEBUG kernel: [183837.349932] thunderbolt
0000:07:00.0: starting TX ring 0
2024-06-24T15:19:20.509870Z DEBUG kernel: [183837.349939] thunderbolt
0000:07:00.0: enabling interrupt at register 0x38200 bit 0 (0x0 ->
0x1)
2024-06-24T15:19:20.509872Z DEBUG kernel: [183837.349942] thunderbolt
0000:07:00.0: starting RX ring 0
2024-06-24T15:19:20.509876Z DEBUG kernel: [183837.349948] thunderbolt
0000:07:00.0: enabling interrupt at register 0x38200 bit 12 (0x1 ->
0x1001)
2024-06-24T15:19:21.879381Z DEBUG kernel: [183838.720640] thunderbolt
0000:07:00.0: current switch config:
2024-06-24T15:19:21.879389Z DEBUG kernel: [183838.720655] thunderbolt
0000:07:00.0: Thunderbolt 3 Switch: 8086:15ef (Revision: 6, TB
Version: 16)
2024-06-24T15:19:21.879396Z DEBUG kernel: [183838.720667] thunderbolt
0000:07:00.0: Max Port Number: 13
2024-06-24T15:19:21.879402Z DEBUG kernel: [183838.720674] thunderbolt
0000:07:00.0: Config:
2024-06-24T15:19:21.879407Z DEBUG kernel: [183838.720679] thunderbolt
0000:07:00.0: Upstream Port Number: 1 Depth: 1 Route String: 0x3
Enabled: 1, PlugEventsDelay: 254ms
2024-06-24T15:19:21.879414Z DEBUG kernel: [183838.720689] thunderbolt
0000:07:00.0: unknown1: 0x0 unknown4: 0x0
2024-06-24T15:19:21.912146Z DEBUG kernel: [183838.753606] thunderbolt
0000:07:00.0: 3: reading drom (length: 0x80)
2024-06-24T15:19:22.511672Z DEBUG kernel: [183839.353220] thunderbolt
0000:07:00.0: 3: DROM version: 1
2024-06-24T15:19:22.517258Z DEBUG kernel: [183839.358696] thunderbolt
0000:07:00.0: 3: uid: 0x175942e1c49f800

[SOME VERSION OF THIS IS REPEATED FOR PORTS 1-13]
2024-06-24T15:19:22.523134Z DEBUG kernel: [183839.365301] thunderbolt
0000:07:00.0: Port 1: 8086:15ef (Revision: 6, TB Version: 1, Type:
Port (0x1))
2024-06-24T15:19:22.523155Z DEBUG kernel: [183839.365304] thunderbolt
0000:07:00.0: Max hop id (in/out): 19/19
2024-06-24T15:19:22.523158Z DEBUG kernel: [183839.365305] thunderbolt
0000:07:00.0: Max counters: 16
2024-06-24T15:19:22.523159Z DEBUG kernel: [183839.365306] thunderbolt
0000:07:00.0: NFC Credits: 0x7800048
2024-06-24T15:19:22.523160Z DEBUG kernel: [183839.365308] thunderbolt
0000:07:00.0: Credits (total/control): 120/2

2024-06-24T15:19:22.531155Z INFO kernel: [183839.373585] thunderbolt
0-3: new device found, vendor=0x175 device=0x87f
2024-06-24T15:19:22.531156Z INFO kernel: [183839.373587] thunderbolt
0-3: SAMSUNG ELECTRONICS CO.,LTD F32TU87x
2024-06-24T15:19:22.535373Z DEBUG kernel: [183839.377053] thunderbolt
0-3: GPIO lookup for consumer wp
2024-06-24T15:19:22.535379Z DEBUG kernel: [183839.377056] thunderbolt
0-3: using lookup tables for GPIO lookup
2024-06-24T15:19:22.535381Z DEBUG kernel: [183839.377057] thunderbolt
0-3: No GPIO consumer wp found
2024-06-24T15:19:22.535383Z DEBUG kernel: [183839.377082] thunderbolt
0-3: GPIO lookup for consumer wp
2024-06-24T15:19:22.535389Z DEBUG kernel: [183839.377083] thunderbolt
0-3: using lookup tables for GPIO lookup
2024-06-24T15:19:22.535390Z DEBUG kernel: [183839.377084] thunderbolt
0-3: No GPIO consumer wp found
2024-06-24T15:19:22.538463Z INFO pciguard[782]: INFO pciguard:
[udev_monitor.cc(94)] UdevEvent: thunderbolt add
/sys/devices/pci0000:00/0000:00:1d.4/0000:05:00.0/0000:06:00.0/0000:07:00.0/domain0/0-0/0-3
2024-06-24T15:19:22.538474Z INFO pciguard[782]: INFO pciguard:
[event_handler.cc(28)] CurrentState=NO_USER_LOGGED_IN,
UserPermission=0, received event=New-Thunderbolt-Dev

[SOME VERSION OF THIS SECTION IS REPEATED 7 TIMES]
2024-06-24T15:19:24.038230Z DEBUG kernel: [183840.880242] i915
0000:00:02.0: HDMI infoframe: Dynamic Range and Mastering, version 1,
length 26
2024-06-24T15:19:24.038271Z DEBUG kernel: [183840.880256] i915
0000:00:02.0: length: 26
2024-06-24T15:19:24.038277Z DEBUG kernel: [183840.880261] i915
0000:00:02.0: metadata type: 0
2024-06-24T15:19:24.038282Z DEBUG kernel: [183840.880266] i915
0000:00:02.0: eotf: 2
2024-06-24T15:19:24.038286Z DEBUG kernel: [183840.880270] i915
0000:00:02.0: x[0]: 35400
2024-06-24T15:19:24.038290Z DEBUG kernel: [183840.880275] i915
0000:00:02.0: y[0]: 14600
2024-06-24T15:19:24.038294Z DEBUG kernel: [183840.880279] i915
0000:00:02.0: x[1]: 8500
2024-06-24T15:19:24.038327Z DEBUG kernel: [183840.880283] i915
0000:00:02.0: y[1]: 39850
2024-06-24T15:19:24.038334Z DEBUG kernel: [183840.880287] i915
0000:00:02.0: x[2]: 6550
2024-06-24T15:19:24.038338Z DEBUG kernel: [183840.880290] i915
0000:00:02.0: y[2]: 2300
2024-06-24T15:19:24.038342Z DEBUG kernel: [183840.880294] i915
0000:00:02.0: white point x: 15635
2024-06-24T15:19:24.038346Z DEBUG kernel: [183840.880298] i915
0000:00:02.0: white point y: 16450
2024-06-24T15:19:24.038350Z DEBUG kernel: [183840.880302] i915
0000:00:02.0: max_display_mastering_luminance: 0
2024-06-24T15:19:24.038354Z DEBUG kernel: [183840.880307] i915
0000:00:02.0: min_display_mastering_luminance: 0
2024-06-24T15:19:24.038358Z DEBUG kernel: [183840.880310] i915
0000:00:02.0: max_cll: 0
2024-06-24T15:19:24.038362Z DEBUG kernel: [183840.880314] i915
0000:00:02.0: max_fall: 0

2024-06-24T15:19:40.375221Z DEBUG kernel: [183857.217231] thunderbolt
0000:07:00.0: stopping RX ring 0
2024-06-24T15:19:40.375267Z DEBUG kernel: [183857.217254] thunderbolt
0000:07:00.0: disabling interrupt at register 0x38200 bit 12 (0x1001
-> 0x1)
2024-06-24T15:19:40.375275Z DEBUG kernel: [183857.217286] thunderbolt
0000:07:00.0: stopping TX ring 0
2024-06-24T15:19:40.375280Z DEBUG kernel: [183857.217298] thunderbolt
0000:07:00.0: disabling interrupt at register 0x38200 bit 0 (0x1 ->
0x0)
2024-06-24T15:19:40.375323Z DEBUG kernel: [183857.217317] thunderbolt
0000:07:00.0: control channel stopped
```

I could share other thunderbolt logs if that helps!