tomsom / yoga-linux

Run Linux on the Lenovo Yoga 7 14 (14ARB7) with AMD Ryzen 6800U (Rembrand).
https://github.com/tomsom/yoga-linux/wiki
56 stars 2 forks source link

USB-4 and dock related issues #13

Closed soupglasses closed 1 year ago

soupglasses commented 1 year ago

Trying to keep track of USB-4 and Thunderbolt dock support on Ryzen 6000 series CPUs.

soupglasses commented 1 year ago

@tomsom I see you write in the README that:

Kernel 6.1 is incompatible with my (Delock) USB-C dock(system freezes)

Could you check if the issue linked above matches your issue?

tomsom commented 1 year ago

It sounds like a different issue; if a (hdmi) monitor is connected to the dock it freezes as soon as i connect it. I also think the dock is not thunderbolt enabled. But i'll investigate further tomorrow. (Guess journalctl is where to look? I haven't really much experience looking into such problems..)

Okazakee commented 1 year ago

Thunderbolt does not work on AMD, usb 4 should be fine tho...

soupglasses commented 1 year ago

That is not exactly true, Thunderbolt 4 and USB4 have the same underlying protocol, only that Thunderbolt has a much stricter set of minimum requirements than USB4. You can think of Thunderbolt 4 as USB4 with all extras added.

AMD's Ryzen 6000 series USB4 implementation should be strict enough to support most (if not all) of Thunderbolt 4. Annoyingly there is no easy resource to find exactly which features would be missing.

soupglasses commented 1 year ago

@tomsom Could you send the full name of your USB C dock? As there exists several technologies you can use to send a display over USB. For example DisplayLink is one that requires a driver, while Displayport Alt Mode should be driverless.

tomsom commented 1 year ago

Yes, as far as I know USB-4 pretty much implements the Thunderbolt 3 protocol..? Me Dock is only USB 3.2 Gen 1 (5Gb/s) tho. Definitely didn't had to install any drivers. But here's a link if you really want to look into it :) https://www.delock.com/produkt/87772/merkmale.html (idk why delock has german named paths in there URL lol)

The specs say it supports display port over usb-c and/or TB3

tomsom commented 1 year ago

Hmm, ok, i experimented a little: The system freezes even at the LUKS decryption screen on boot.

When connecting the dock(and freezing the system) after login in to session: On wayland nothing appears in the logs lol; An x session first spitted out this: https://github.com/tomsom/yoga-linux/blob/main/logs/dock-connect1.txt

I noticed there arent really any errors but a lot of stuff regarding my keyboard, so i tried it again this time without having the keyboard connected to the dock. The output it vastly different but i think also a little more useful: https://github.com/tomsom/yoga-linux/blob/main/logs/dock-connect2.txt (probably not everything related but idk what to make of it..) oh yeah and i uploaded it as separate files bc well.. kinda long..

soupglasses commented 1 year ago

I am not quite sure what kind of setup you run, but the error:

Process 3492 (org_kde_powerdevil) crashed in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&)

Seems to say its related to KDE? There is also a lot of power related problems. You could try and see if the issues persist on a LiveUSB, as my gut feeling quickly goes to power management freaking out?

You may need to update your BIOS for the ACPI related errors? https://forums.lenovo.com/t5/other-linux-discussions/t14-amd-kernel-says-acpi-error-no-handler-for-region-ecsi/m-p/5066588

Might be a red herring however.

tomsom commented 1 year ago

Hey, thank you for taking a look :)

Yes i'm currently running KDE but i dont think its related to it; i have the same behavior in Gnome and even at the LUKS decryption prompt at boot. Also the issue only appears when a monitor is connected to the dock. So it's probably a kernel/graphics driver/usb driver issue? booting 6.0+ is fine - the freezing only happens with 6.1+

BIOS update probably wont hurt tho

soupglasses commented 1 year ago

Now the not 6.0 but only 6.1 is important. Sounds like a regression. If you have some time you may be able to bisect between 6.0 and the latest rc to find the culprit.

soupglasses commented 1 year ago

If you could set drm.debug=0x116 log_buf_len=50M as boot parameters and get the dmesg output, that may give some better input on what is going on. I think something like journalctl -o short-precise -k -b -1 > log.txt should suffice to show last the boot if it crashes.

soupglasses commented 1 year ago

There is also 6.1-rc6 now, it may already be fixed in that release.

tomsom commented 1 year ago

Thank you for your suggestions :D Already tried rc6, same thing happens.

Here is the dmesg log of kernel 6.1-rc4 with the parameters you suggested but with the dock not connected(it wouldnt make it past the encryption so i guess it cant save the log anywhere..): https://github.com/tomsom/yoga-linux/blob/main/logs/dmesg-rc4.txt

This is the output of journalctl -o short-precise -k -b -1: https://github.com/tomsom/yoga-linux/blob/main/logs/log_jctl_shortprecise.txt I plugged in the dock at around 13:35:16 I dont know why journalctl shows me timestamps of the future, its really confusing. (it starts with 14:xx(the future for me) then suddenly skips in the presence to 13:xx)

Oh yeah i tried looking at the differences from 6.0 to 6.1 but i really dont know what to look for as i have absolutely no clue of kernel development..

soupglasses commented 1 year ago

Yeah so we can see dp_mst, amdgpu, drm all over the place. And seeing how its something from 6.0 and 6.1-rc4, it may be an issue about a regression to open in https://gitlab.freedesktop.org/drm/amd/

My absolute longshot guess would be related to compute_mst_dsc_configs_for_link as its the most unique name to spot, as it seems like its struggling with taking a mutex_lock and drm_modeset_lock in that area. But im no kernel developer, so someone who knows better should tune in about this.

~~Closest issue i can find is this: https://gitlab.freedesktop.org/drm/amd/-/issues/1926 Could also be this, but i am unsure: https://gitlab.freedesktop.org/drm/amd/-/issues/2171~~

soupglasses commented 1 year ago

Actually i just found the exact issue: https://gitlab.freedesktop.org/drm/amd/-/issues/2210

It is a duplicate of: https://gitlab.freedesktop.org/drm/amd/-/issues/2171

tomsom commented 1 year ago

Awesome, it looks like there's a patch on it's way! Thank you for taking the time checking it out, I would not have been able to find this by myself.

I really appreciate it :))

tomsom commented 1 year ago

It got fixed with 6.1-rc7 :D

soupglasses commented 1 year ago

The crashing, or that the screen has started working? As currently the fix only seems to stop crashes and hard locks.

tomsom commented 1 year ago

Both, no crashing, no freezing but the external and internal screens both work just as expected.

stuarthayhurst commented 1 year ago

Can this be closed, or is there something left to do?

tomsom commented 1 year ago

guess not

soupglasses commented 1 year ago

So there are still issues with USB-4, but its quite difficult to show any pattern to it now after linux 6.2.

I have ended up using the USB 3 port with DP support as it is much more stable.

stuarthayhurst commented 1 year ago

Have either of you had issues with USB 2.0 devices on the USB A port? USB 3.0 devices work fine, but nothing 2.0 even shows up to the system, whether it's Linux, Windows or BIOS. I'm 99% sure it's a hardware / firmware fault since I've tried all the settings that might impact it, but I was curious if anyone else has had this issue before I request a replacement due to the dodgy trackpad and USB port.

soupglasses commented 1 year ago

I just tested mine with USB 1.1 and USB 2.0 devices. Both work flawlessly. I am guessing it must be a hardware fault, as i have not seen anyone else with such problem.

stuarthayhurst commented 1 year ago

Thanks for testing, I guess I'll start an RMA soon then.

stuarthayhurst commented 1 year ago

USB 2.0 issues fixed with a service request, so I can confirm that's not some quirky setup I have. They told me my touchpad was fine, but it had problems again even live-booting a distro to restore my backup, so I guess that's going back again :/

rodude123 commented 2 months ago

Ok so recently I got a new monitor that supports DP out but my arch KDE running kernel 6.9.1 seems to lock up and make it do nothing if I choose high-speed mode vs high-resolution mode. I've set MST On and USB C prioritization to high-resolution. Any potential fixes or should I not? I would really like to have USB 3 speeds and gigabit ethernet vs 300 MB internet. (I pay for 500Mb)