Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lenovo Legion 5 15ARH05 #1207

Open
SoSeDiK opened this issue Oct 26, 2024 · 8 comments
Open

Lenovo Legion 5 15ARH05 #1207

SoSeDiK opened this issue Oct 26, 2024 · 8 comments

Comments

@SoSeDiK
Copy link

SoSeDiK commented Oct 26, 2024

There's already a profile for 15ARH05H model, and it seems to work fine so far with my 15ARH05.
https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/legion-series/legion-5-15arh05/

Possibly could be almost 1:1 copy, the only issue I noticed is a different AMD GPU bus id, which is PCI:5:0:0 instead of PCI:6:0:0:

lspci | grep -i vga                        
01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Ti Mobile] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [Radeon Vega Series / Radeon Vega Mobile Series] (rev c7)

Edit: currently testing my setup at https://github.com/SoSeDiK/nixos-hardware/tree/lenovo-legion-15arh05, will open a PR later at some point.

@LucasFA
Copy link

LucasFA commented Dec 23, 2024

Could this be a case similar to #1038? Definitely sounds like there is more than one version, and it is unlikely than the original creator simply missed the correct bus ID.

@SoSeDiK
Copy link
Author

SoSeDiK commented Dec 23, 2024

It is similar indeed, Lenovo seems to have three versions for this model:

Lenovo product search

image

My test setup for my model works so far and seems to be correct on paper, but I'm holding back due to a couple of unresolved issues with NVIDIA GPU (not properly working sleep/suspend on both open and closed driver).

@LucasFA
Copy link

LucasFA commented Dec 23, 2024

I missed the H being missing in your3 title and first line. Woops.
Regarding your sleep issues, have you seen #336723 or directly this Discourse thread?

@SoSeDiK
Copy link
Author

SoSeDiK commented Dec 24, 2024

I'm not on GNOME (mostly running Hyprland), so sadly the fix doesn't apply.

Suspend works most of the time (at very rare occasions screen turns off, but laptop still works; in that case screen turns on from any key/mouse action and then suspend will work from the second try), the issues mostly arise upon waking up from the sleep as I've had the laptop freeze a bunch of times.

I also can't get neither S01x nor D3 to work despite reports on the Internet that it works for other people with the same/similar laptop/GPU models (the usual workaround of closed driver with NVreg_EnableGpuFirmware=0 didn't work).

Details

cat /proc/driver/nvidia/gpus/0000:01:00.0/power

Runtime D3 status: Not supported
Video Memory: Active

GPU Hardware Support:
Video Memory Self Refresh: Not Supported
Video Memory Off: Supported

S0ix Power Management:
Platform Support: Not Supported
Status: Disabled

For some more context, I'm on nixos-unstable with 6.12.5-xanmod1 kernel and stable 565.77 closed nvidia driver.

@SoSeDiK
Copy link
Author

SoSeDiK commented Dec 26, 2024

I suspect the finegrained power management (hardware.nvidia.powerManagement.finegrained) to be the cause of my issues. Disabling it and using instead NVreg_DynamicPowerManagement=0x01 (because otherwise it's disabled by default for Turing GPUs) enables RTD3:

cat /proc/driver/nvidia/gpus/0000\:01\:00.0/power
Runtime D3 status:          Enabled (coarse-grained)
Video Memory:               Active

GPU Hardware Support:
 Video Memory Self Refresh: Not Supported
 Video Memory Off:          Supported

S0ix Power Management:
 Platform Support:          Not Supported
 Status:                    Disabled

I've done a few dozen suspend & hibernate cycles without issues: laptop properly shutdowns and wakes up.
I've also switched to the open nvidia driver and had no issues either after a few cycles (same kernel and driver version as before).

Setting NVreg_DynamicPowerManagement=0x02 makes it Not supported again, not sure why. Can't get Video Memory Self Refresh and S0ix to work either, even though they supposedly are supported by the hardware?

@LucasFA
Copy link

LucasFA commented Dec 26, 2024

I suspect the finegrained power management (hardware.nvidia.powerManagement.finegrained) to be the cause of my issues.

I just looked into this and realised the card does not (officially) support the option on the open modules. The finegrained option mentions the chapter 22 of the nvidia docs, which do say it supports Turing and newer, but the open kernel modules docs say that they only support RTD3 from Ampere (30 series) onwards. Hence why the closed driver should make it work, but, well, your empirical testing seems to show that no.

Have you tested manually adding the NVreg_DynamicPowerManagement=0x01 to the kernel boot options, with the closed driver? Instead of using the hardware.nvidia.powerManagement.enabled option. I'm thinking there's something going on with the default, which is 0x03 and it disables RTD3 features

@SoSeDiK
Copy link
Author

SoSeDiK commented Dec 26, 2024

Have you tested manually adding the NVreg_DynamicPowerManagement=0x01 to the kernel boot options, with the closed driver? Instead of using the hardware.nvidia.powerManagement.enabled option. I'm thinking there's something going on with the default, which is 0x03 and it disables RTD3 features

Default 0x03 disables dynamic power management by default for Turing, so the manual override is needed indeed.

Basic coarse-grained 0x01 power management works on both open and closed drivers, fine-grained 0x02 doesn't.

There are a bunch of reports like pop-os/nvidia-graphics-drivers#216 on the Internet, which make me think that the GPU itself should support fine-grained too, but the workarounds didn't work for me.

@SoSeDiK
Copy link
Author

SoSeDiK commented Dec 27, 2024

I've dug up some threads from years ago, notably like this one: https://forums.developer.nvidia.com/t/nvidia-d3-runtime-power-management-only-works-on-window/196553/3.

According to the users with the same issue, NVIDIA blocked fine-grained RTD3 on Linux on Ryzen 4xxx and 3xxx models (I have Ryzen 5 4600H) despite the hardware support being there and it working fine on Windows. I couldn't find any official statements from NVIDIA or sources besides users just reporting the issue, but seems plausible, and sucks if that still the case after all these years.

My system advertises support for S0ix mode too, defaulting to S3:

cat /sys/power/mem_sleep
s2idle [deep]

But NVIDIA's unhappy, and booting with s2idle breaks suspend, causing system freezing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants