From 474549f84151ceaed1c4ef0465192c7b0952f161 Mon Sep 17 00:00:00 2001 From: Nire Bryce Date: Mon, 25 Mar 2024 07:40:22 +0000 Subject: [PATCH] gigabyte b550: suspend fix (#884) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes b550 suspend bug by setting up systemd services that disable GPP0 and GPP8 in /proc/acpi/wakeup Co-authored-by: Jörg Thalheim --- README.md | 1 + gigabyte/b550/README.md | 47 ++++++++++++++++++++++++++++++ gigabyte/b550/b550-fix-suspend.nix | 35 ++++++++++++++++++++++ gigabyte/b550/default.nix | 5 ++++ 4 files changed, 88 insertions(+) create mode 100644 gigabyte/b550/README.md create mode 100644 gigabyte/b550/b550-fix-suspend.nix create mode 100644 gigabyte/b550/default.nix diff --git a/README.md b/README.md index e3c84ab..60ba932 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ See code for all available configurations. | [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `` | | [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `` | | [Focus M2 Gen 1](focus/m2/gen1) | `` | +| [Gigabyte B550](gigabyte/b550) | `` | [GPD MicroPC](gpd/micropc) | `` | | [GPD P2 Max](gpd/p2-max) | `` | | [GPD Pocket 3](gpd/pocket-3) | `` | diff --git a/gigabyte/b550/README.md b/gigabyte/b550/README.md new file mode 100644 index 0000000..e8ccf53 --- /dev/null +++ b/gigabyte/b550/README.md @@ -0,0 +1,47 @@ +# B550 suspend bug + +Gigabyte B550-family motherboards have a hard to diagnose (At least, from the system log events) suspend bug. + +As of the F18 bios for the b550m-d3sh (My machine), released in 2024-02-27, this is still unfixed by the manufacurer and has been for over 4 years. + +Symptoms: +- Suspend PC +- It goes into suspend, then seems to boot and hang. Sometimes it suspends successfully, but waking it from suspend puts it in the "zombie" state. +- By playing chicken with volatile storage and flicking the power switch on the back of power supply, you can sometimes get it to wake from suspend as the card un-powers before volatile storage does. + +Fix: disable GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup + - To do this permanently, a systemd service is provided + + +## This affects at least: +- Gigabyte b550m-d3sh (my machine) +- Gigabyte B550i AORUS Pro Ax https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/ +- Gigabyte B550 Vision D https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/ +- Gigabyte B550 Aorus Pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ijsx8ia/ +- Gigabyte B550 Aorus Pro AC https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j6cbnwq/ +- Gigabyte B550 Aorus Pro v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/imx7sz0/ + - B550 Aorus Pro may need GPP0 and PTXH instead of GPP8, I don't have hardware to test +- Gigabyte B550 Aurus Elite v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/k2psbgu/ +- Gigabyte B550m pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/huocd81/ +- Gigabyte B550m Aorus Elite https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hzngaa7/ +- Gigabyte B550 Gaming X v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hvojl44/ +- Gigabyte B550 Aorus Master v1.0 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j1alpxk/ + +### Anecdotes of other boards: +- Gigabyte A520M https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/i57jpjw/ + + + +## Shoutouts: +- thanks to [/u/dustythermals's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/) for the systemd service blueprint +- thanks to help from [@ToxicFrog](https://github.com/ToxicFrog) for advice on making it not toggle when `nixos-rebuild switch` is ran +- thanks to [/u/Demotay's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/) for how to make it check and only fire if these are enabled +- Huge thanks to /u/theHugePotato who found the [root cause](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/h9plj88/) and put it where everyone could find + +## Breadcrumbs: +https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/ + +https://www.reddit.com/r/archlinux/comments/11urtla/systemctl_suspend_hibernate_and_hybridsleep_all/ + +https://forum.manjaro.org/t/system-do-not-wake-up-after-suspend/76681/2 + diff --git a/gigabyte/b550/b550-fix-suspend.nix b/gigabyte/b550/b550-fix-suspend.nix new file mode 100644 index 0000000..0e922a8 --- /dev/null +++ b/gigabyte/b550/b550-fix-suspend.nix @@ -0,0 +1,35 @@ +{ pkgs, lib, ... } : + +{ + systemd.services.bugfixSuspend-GPP0 = { + enable = lib.mkDefault true; + description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; + unitConfig = { + Type = "oneshot"; + }; + serviceConfig = { + User = "root"; # root may not be necessary + # check for gppN, disable if enabled + # lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay + ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'"; + RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran + + }; + wantedBy = ["multi-user.target"]; + }; + + systemd.services.bugfixSuspend-GPP8 = { + enable = lib.mkDefault true; + description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)"; + unitConfig = { + Type = "oneshot"; + }; + serviceConfig = { + User = "root"; + ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi''"; + RemainAfterExit = "yes"; + }; + wantedBy = ["multi-user.target"]; + }; + +} diff --git a/gigabyte/b550/default.nix b/gigabyte/b550/default.nix new file mode 100644 index 0000000..6935d99 --- /dev/null +++ b/gigabyte/b550/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./b550-fix-suspend.nix + ]; +}