Kernel patch to solve suspend issue for AMD Ryzen laptop

Hello,

here is my configuration

  System:
  Kernel: 5.12.0-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.12-x86_64 
  root=UUID=80b2aca5-4bd7-420a-bcaf-66d8c913e258 ro quiet apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: KDE Plasma 5.21.3 tk: Qt 5.15.2 wm: kwin_wayland vt: 2 dm: SDDM 
  Distro: Manjaro Linux base: Arch Linux
 
Machine:
  Type: Laptop System: LENOVO product: 82A2 v: Yoga Slim 7 14ARE05 
  serial: <filter Chassis: type: 10 v: Yoga Slim 7 14ARE05 serial: <filter 
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN serial: <filter 
  UEFI: LENOVO v: DMCN38WW date: 01/18/2020 

Battery:
  ID-1: BAT1 charge: 7.7 Wh (12.9%) condition: 59.8/60.7 Wh (98.5%) 
  volts: 14.7 min: 15.4 model: Celxpert L19C4PF4 type: Li-poly 
  serial: <filter status: Discharging cycles: 22
 
Memory:
  RAM: total: 15.08 GiB used: 4.74 GiB (31.4%) 
  RAM Report: permissions: Unable to run dmidecode. Root privileges required. 

CPU:
  Info: 8-Core model: AMD Ryzen 7 4800U with Radeon Graphics bits: 64 
  type: MT MCP arch: Zen 2 family: 17 (23) model-id: 60 (96) stepping: 1 
  microcode: 8600106 cache: L2: 4 MiB bogomips: 57505 
  Speed: 1381 MHz min/max: 1400/1800 MHz boost: enabled Core speeds (MHz): 
  1: 1381 2: 1804 3: 1397 4: 1756 5: 1374 6: 2217 7: 1340 8: 1397 9: 1397 
  10: 1396 11: 1397 12: 1471 13: 1372 14: 1336 15: 1783 16: 1380 
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1 
  bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy 
  constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc 
  cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid 
  fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs irperf lahf_lm 
  lbrv lm mba mca mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx 
  nonstop_tsc nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter 
  pclmulqdq pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pni 
  popcnt pse pse36 rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni 
  skinit smap smca smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor 
  svm svm_lock syscall tce topoext tsc tsc_scale umip v_vmsave_vmload vgif 
  vmcb_clean vme vmmcall wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt 
  xsaves 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, IBRS_FW, 
  STIBP: conditional, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 

Graphics:
  Device-1: AMD Renoir vendor: Lenovo driver: amdgpu v: kernel bus-ID: 03:00.0 
  chip-ID: 1002:1636 class-ID: 0300 
  Device-2: Chicony Integrated Camera type: USB driver: uvcvideo bus-ID: 1-4:2 
  chip-ID: 04f2:b6cb class-ID: fe01 serial: <filter 
  Display: wayland server: X.Org 1.21.1 compositor: kwin_wayland driver: 
  loaded: amdgpu,ati unloaded: modesetting alternate: fbdev,vesa 
  display-ID: :1 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x286mm (20.0x11.3") 
  s-diag: 583mm (23") 
  Monitor-1: XWAYLAND0 res: 1920x1080 hz: 60 dpi: 157 
  size: 310x170mm (12.2x6.7") diag: 354mm (13.9") 
  OpenGL: renderer: AMD RENOIR (DRM 3.40.0 5.12.0-1-MANJARO LLVM 11.1.0) 
  v: 4.6 Mesa 21.0.1 direct render: Yes 

Audio:
  Device-1: AMD vendor: Lenovo driver: snd_hda_intel v: kernel bus-ID: 03:00.1 
  chip-ID: 1002:1637 class-ID: 0403 
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor vendor: Lenovo 
  driver: snd_rn_pci_acp3x v: kernel alternate: snd_pci_acp3x bus-ID: 03:00.5 
  chip-ID: 1022:15e2 class-ID: 0480 
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel 
  v: kernel bus-ID: 03:00.6 chip-ID: 1022:15e3 class-ID: 0403 
  Sound Server-1: ALSA v: k5.12.0-1-MANJARO running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: no 
  Sound Server-4: PipeWire v: 0.3.24 running: yes 

Network:
  Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus-ID: 01:00.0 
  chip-ID: 8086:2723 class-ID: 0280 
  IF: wlp1s0 state: up mac: <filter 
  IP v4: <filter type: dynamic noprefixroute scope: global 
  broadcast: <filter 
  IP v6: <filter type: noprefixroute scope: link 
  IF-ID-1: tun0 state: unknown speed: 10 Mbps duplex: half mac: N/A 
  IP v4: <filter type: noprefixroute scope: global broadcast: <filter 
  IP v6: <filter virtual: stable-privacy scope: link 
  WAN IP: <filter 

Bluetooth:
  Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 3-4:2 
  chip-ID: 8087:0029 class-ID: e001 
  Report: This feature requires one of these tools: hciconfig/bt-adapter 

Drives:
  Local Storage: total: 953.87 GiB used: 117.46 GiB (12.3%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVLB1T0HBLR-000L2 
  size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s 
  lanes: 4 rotation: SSD serial: <filter rev: 3L1QEXF7 scheme: GPT 
  Message: No Optical or Floppy data was found. 

Swap:
  Alert: No Swap data was found. 

USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 1-4:2 info: Chicony Integrated Camera type: Video driver: uvcvideo 
  interfaces: 5 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 04f2:b6cb 
  class-ID: fe01 serial: <filter 
  Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 3-4:2 info: Intel AX200 Bluetooth type: Bluetooth driver: btusb 
  interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 8087:0029 
  class-ID: e001 
  Hub-4: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 

Sensors:
  System Temperatures: cpu: 38.4 C mobo: N/A gpu: amdgpu temp: 37.0 C 
  Fan Speeds (RPM): N/A 

Info:
  Processes: 357 Uptime: 1h 40m wakeups: 4205 Init: systemd v: 247 
  tool: systemctl Compilers: gcc: 10.2.0 clang: 11.1.0 Packages: pacman: 1379 
  lib: 409 flatpak: 0 Shell: Bash v: 5.1.0 running-in: konsole inxi: 3.3.03

My issue is that “suspend to RAM” does’nt work. I think I’m not the only one since it’s seems due to new AMD processor (?).

I wrote on this thread Ryzen 4700U failing to enter suspend/modern-standby correctly and " Julian Sikorski" give me this answer :

What you might want to try instead is to look at either Commits · s0ix-7 · Alex Deucher / linux · GitLab or Files · fedora-5.11-s0ix-7-simple-suspend · Julian Sikorski / kernel-ark · GitLab, see which patches are already in rc5+ and add the remaining ones. Depending on your machine you might need to replace nvme: put some AMD PCIE downstream NVME device to simple suspend/resume path (d8f9a80d) · Commits · Julian Sikorski / kernel-ark · GitLab with a device-specific quirk according to #1230 (comment 858965). ETA: @ctrlaltca has already done the work: #1230 (comment 863032)

Since I’m not very good (to be honest I don’t know how to do that) to do this kind of stuff and the fact that I’m probably not the only one, I thought that maybe the team (person ?) responsible of kernel compilation in Manjaro could implement these patch in order to fix once for all the problem.

If I can help I will do but my knowledge is poor…

Thanks

Accordind to “Julan Sikorski” :

rc6 is out and the patches are still not in. I believe the ones left out are still a bit too much WIP for upstreaming"

:frowning:

What exactly is not working for you?
On my Ideapad 5 14ARE05 (with a 4600U), initially the laptop would not suspend correctly, leading to increased battery drain and occasionally issues when waking up.
I fixed it by applying this fix to the ACPI tables:
https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_5_14are05#Suspend_issues_(S3_sleep_fix)

Of course, that might not help you, if you don’T have the same model, but probably similar patches can be found for your model.

Since Kernel 5.11 I do have other issues with suspend, however - waking the laptop results in display corruption and a locked-up system. It was gone with 5.11.6, but apparently it’s back with 5.11.10…

Is there a fix for this display corruption ?

Well, since it worked with 5.11.6 it seems like a regression, so I would assume there’s a fix. Unfortunately I can’t find the original bug report anymore.

Anyway, I suspect the OPs issue is more related to the S3_sleep issue, not this bug, so I don’t want to hijack this thread.

Accordind to “Julan Sikorski” :

This patch appears to modify the dsdt tables to make legacy S3 work. I don’t think this is applicable to a distro kernel but I don’t really know.

I don’t know if it will solve my problem. I tried before but it failed at compilation.

and

How I understand it is that both solutions solve the same problem: modern laptops dropping legacy S3 suspend in favour of modern standby aka S0ix. dsdt patches attempt to add back S3 support while the patches discussed here get s0ix working under Linux.

So I will wait for a kernel with patches solving this issue

Well i tried fedora 34, even though i know its beta, some stuff might not work.
After updating it was on the latest kernel that was 5.11.12.
After some tinkering i was able to use that patch and get sleep working , but the displays stops after waking up from sleep.

I wonder if that is actually the bug I’m having since 5.11 - although it worked fine with 5.11.6, it’s back since (at least) 5.11.10.

When waking from sleep, I get a corrupted screen, then it comes back, but freezes.

How did you use the patch? I’m on fedora 33 and I could not use it. Can you give some feedback pls?

I looked around a bit and stumbled upon some related threads on the Arch forums.
Seems like there’s two potential issues at play here. One is a bug in amdgpu, causing the lock-up when waking from sleep, the other one is an issue with the latest kernels (both in 5.11 and 5.10) which causes the S3 state for sleep not to work correctly anymore.
There was a fix for the amdgpu bug in 5.11.6, but it got removed again for some reason. However, there’s some hope it will be re-introduced at least for 5.12 and possibly in 5.11 as well.
With the second issue, it seems that it got fixed in the latest versions (5.11.16+).

I follow this thread : Ryzen 4700U failing to enter suspend/modern-standby correctly (#1230) · Issues · drm / amd · GitLab

it seems to be difficult to solve the problem…

I think I will create a swap partition to use “hibernate” since suspend is not working for AMD Ryzen. Do you tried this ? Is it working ?

Thanks

AMDGPU Driver Gets Initial Fixes For Linux 5.13
"
Suspend and resume fixes.
"

Hoep it will work !

Hope we see them backported to 5.12 and 5.11…

1 Like