Processed: Re: Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-21 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 +patch -help
Bug #1029046 [src:linux] S3 suspend broken on AMD Ryzen Pro 7 5850U
Added tag(s) patch.
Bug #1029046 [src:linux] S3 suspend broken on AMD Ryzen Pro 7 5850U
Removed tag(s) help.
> clone -1 -2
Bug #1029046 [src:linux] S3 suspend broken on AMD Ryzen Pro 7 5850U
Bug 1029046 cloned as bug 1029356
> retitle -2 Thinkpad AMD: amd_pmc module is required for correct s0ix (Windows 
> mode) suspend
Bug #1029356 [src:linux] S3 suspend broken on AMD Ryzen Pro 7 5850U
Changed Bug title to 'Thinkpad AMD: amd_pmc module is required for correct s0ix 
(Windows mode) suspend' from 'S3 suspend broken on AMD Ryzen Pro 7 5850U'.
> severity -2 important
Bug #1029356 [src:linux] Thinkpad AMD: amd_pmc module is required for correct 
s0ix (Windows mode) suspend
Severity set to 'important' from 'serious'

-- 
1029046: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029046
1029356: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029356
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-21 Thread Didier 'OdyX' Raboud
Control: tags -1 +patch -help
Control: clone -1 -2
Control: retitle -2 Thinkpad AMD: amd_pmc module is required for correct s0ix 
(Windows mode) suspend
Control: severity -2 important

Hello there, 

My understanding is that there are two distinct bugs here; hereby splitting 
to make this clearer.

* Original bug, as retitled by Salvatore; S3 suspend is broken on some AMD
  Ryzens. This is fixed by this patch queue, also attached.
https://gitlab.freedesktop.org/superm1/linux/-/commits/mlimonci/rhbz-2162013-gitlab-2357-v4/

  In the BIOS, "S3" is "Linux mode" for suspend.

* While investigating this; it turns out modern kernels can also suspend
  on s0ix "Windows mode", but this _requires_ the `amd_pmc` module, which
  is not loaded automatically, but it really should. This doesn't look
  like an upstream bug, but rather a Debian one.

  As this only shows on Laptops with a "Windows mode" BIOS configuration
  (in a box that also shows "Linux mode"), I think it's reasonable to see
  this as a bug of only "important" level (even though not resuming from
  suspend is _bad_).

  I don't think we have seen a patch to fix this one yet though.

Best,

OdyX
Index: linux/drivers/gpio/gpiolib-acpi.c
===
--- linux.orig/drivers/gpio/gpiolib-acpi.c
+++ linux/drivers/gpio/gpiolib-acpi.c
@@ -361,7 +361,7 @@ err:
 }
 
 static bool acpi_gpio_irq_is_wake(struct device *parent,
-  struct acpi_resource_gpio *agpio)
+  const struct acpi_resource_gpio *agpio)
 {
 	unsigned int pin = agpio->pin_table[0];
 
@@ -754,7 +754,7 @@ static int acpi_populate_gpio_lookup(str
 		lookup->info.pin_config = agpio->pin_config;
 		lookup->info.debounce = agpio->debounce_timeout;
 		lookup->info.gpioint = gpioint;
-		lookup->info.wake_capable = agpio->wake_capable == ACPI_WAKE_CAPABLE;
+		lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio);
 
 		/*
 		 * Polarity and triggering are only specified for GpioInt
@@ -1080,7 +1080,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct
 dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
 			}
 
-			if (wake_capable)
+			if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
 *wake_capable = info.wake_capable;
 
 			return irq;
@@ -1599,6 +1599,19 @@ static const struct dmi_system_id gpioli
 			.ignore_interrupt = "AMDI0030:00@18",
 		},
 	},
+	{
+		/*
+		 * Spurious wakeups from TP_ATTN# pin
+		 * Found in BIOS 1.7.8
+		 * https://gitlab.freedesktop.org/drm/amd/-/issues/1722#note_1720627
+		 */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"),
+		},
+		.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
+			.ignore_wake = "ELAN0415:00@9",
+		},
+	},
 	{} /* Terminating entry */
 };
 
Index: linux/drivers/pinctrl/pinctrl-amd.c
===
--- linux.orig/drivers/pinctrl/pinctrl-amd.c
+++ linux/drivers/pinctrl/pinctrl-amd.c
@@ -365,6 +365,7 @@ static void amd_gpio_dbg_show(struct seq
 
 			} else {
 debounce_enable = "  ∅";
+time = 0;
 			}
 			snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
 			seq_printf(s, "debounce %s (🕑 %sus)| ", debounce_enable, debounce_value);


signature.asc
Description: This is a digitally signed message part.


Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-18 Thread Diederik de Haas
Control: tag -1 help

Hi,

On Wednesday, 18 January 2023 09:22:03 CET Didier 'OdyX' Raboud wrote:
> Control: retitle -1 Thinkpad: amd_pmc module required for on 6.1 for correct 
> suspend
> Le mardi, 17 janvier 2023, 22.53:54 h CET Didier 'OdyX' Raboud a écrit :
> > Le mardi, 17 janvier 2023, 15.32:37 h CET Diederik de Haas a écrit :
> > > On Monday, 16 January 2023 22:33:05 CET Didier 'OdyX' Raboud wrote:
> > > > This is on 6.1.4-1a~test, patched against the "2nd DisplayPort doesn't
> > > > light up", so feel free to close the bug; I'll test if I get the same
> > > > symptoms on an unpatched kernel anyway :-)
> > > 
> > > If that issue doesn't occur with the unpatched kernel, could you add
> > > your finding to that upstream/forwarded issue?
> > ...
> > 
> > All three 6.1 kernels (whether patched or not) don't bring the laptop to
> > the suspended state (power led 'breathing', fans off), but it's kept in
> > an "on" state (power led on, fans on), from which I found that I *can*
> > wake the laptop up by short-pressing the power button; the screens gets
> > back to life and show my lockscreen. But from there, I can't move the
> > mouse nor do anything else. Alt-SysRq-r + ctrl-alt-f2 give me a tty, but
> > any comeback to tty1 only blank (not even a blank screen, just a freeze).
> > 
> > This seems to point to a quite severe regression in amdgpu or other amd-
> > related code; I can't suspend-and-resume the laptop anymore on any 6.1
> > kernel, on battery, without anything attached to it.
> > 
> > I'll forward the above findings to the bug you pointed to, hoping it could
> > help upstream too!
> 
> OK. I've gone and done this:
> https://gitlab.freedesktop.org/drm/amd/-/issues/2171#note_1727281

Awesome, thanks.

> It turns out to get suspend to work, the `amd_pmc` module needs to be
> enabled (_AND_ the BIOS needs to have the "Sleep State" toggled to Windows
> (from Linux).
> 
> I _think_ Debian should make sure amd_pmc is loaded on (all?) modern AMD
> laptops. I have no idea (yet) what the mechanism to make this happen is
> though.

Due to https://bugs.debian.org/992832 the AMD_PMC module got enabled and
I and IIUC you too, verified that it is present in the kernel.

I agree it should be auto-loaded, but I don't know why that didn't happen.
Tagging this bug with 'help' to request the help from ppl who know more
about this then I do.

Cheers,
  Diederik

signature.asc
Description: This is a digitally signed message part.


Processed: Re: Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-18 Thread Debian Bug Tracking System
Processing control commands:

> tag -1 help
Bug #1029046 [src:linux] Thinkpad: amd_pmc module required for on 6.1 for 
correct suspend
Added tag(s) help.

-- 
1029046: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029046
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Processed: Re: Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-18 Thread Debian Bug Tracking System
Processing control commands:

> retitle -1 Thinkpad: amd_pmc module required for on 6.1 for correct suspend
Bug #1029046 [src:linux] Wayland session doesn't get back to life post-suspend
Changed Bug title to 'Thinkpad: amd_pmc module required for on 6.1 for correct 
suspend' from 'Wayland session doesn't get back to life post-suspend'.

-- 
1029046: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029046
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-18 Thread Didier 'OdyX' Raboud
Control: retitle -1 Thinkpad: amd_pmc module required for on 6.1 for correct 
suspend

Le mardi, 17 janvier 2023, 22.53:54 h CET Didier 'OdyX' Raboud a écrit :
> Le mardi, 17 janvier 2023, 15.32:37 h CET Diederik de Haas a écrit :
> > On Monday, 16 January 2023 22:33:05 CET Didier 'OdyX' Raboud wrote:
> > > This is on 6.1.4-1a~test, patched against the "2nd DisplayPort doesn't
> > > light up", so feel free to close the bug; I'll test if I get the same
> > > symptoms on an unpatched kernel anyway :-)
> > 
> > If this issue doesn't occur with the unpatched kernel, that would be VERY
> > important extra information!
> > https://gitlab.freedesktop.org/drm/amd/-/issues/2171#note_1724186 may be
> > the same or similar finding?
> > 
> > If that issue doesn't occur with the unpatched kernel, could you add your
> > finding to that upstream/forwarded issue?
> 
> Now that I got my kernel build in place; I can actually confirm that:
> 
> On my Thinkpad X13 Gen 2a, without any dongle, hub or docking station (on
> battery), with a KDE Plasma Wayland session:
> 
> * 6.0.0-6-amd64 (6.0.12-1)
>   suspends and resumes correctly
> * 6.1.0-1-amd64 (6.1.4-1, unpatched)
>   doesn't finish suspending
> * 6.1.0-2-amd64 (6.1.6-1, from the 'sid' branch on salsa, not patched)
>   doesn't finish suspending
> * 6.1.0-2-amd64 (6.1.6-1, from the 'sid' branch on salsa, patched),
>   doesn't finish suspending
> 
> All three 6.1 kernels (whether patched or not) don't bring the laptop to the
> suspended state (power led 'breathing', fans off), but it's kept in an "on"
> state (power led on, fans on), from which I found that I *can* wake the
> laptop up by short-pressing the power button; the screens gets back to life
> and show my lockscreen. But from there, I can't move the mouse nor do
> anything else. Alt-SysRq-r + ctrl-alt-f2 give me a tty, but any comeback to
> tty1 only blank (not even a blank screen, just a freeze).
> 
> This seems to point to a quite severe regression in amdgpu or other amd-
> related code; I can't suspend-and-resume the laptop anymore on any 6.1
> kernel, on battery, without anything attached to it.
> 
> I'll forward the above findings to the bug you pointed to, hoping it could
> help upstream too!

OK. I've gone and done this: 
https://gitlab.freedesktop.org/drm/amd/-/issues/2171#note_1727281

It turns out to get suspend to work, the `amd_pmc` module needs to be enabled
(_AND_ the BIOS needs to have the "Sleep State" toggled to Windows (from
Linux).

I _think_ Debian should make sure amd_pmc is loaded on (all?) modern AMD
laptops. I have no idea (yet) what the mechanism to make this happen is though.

-- 
OdyX



Processed: Re: Bug#1029046: Wayland session doesn't get back to life post-suspend

2023-01-17 Thread Debian Bug Tracking System
Processing control commands:

> found -1 6.1.6-1
Bug #1029046 [src:linux] Wayland session doesn't get back to life post-suspend
The source 'linux' and version '6.1.6-1' do not appear to match any binary 
packages
Marked as found in versions linux/6.1.6-1.
> found -1 6.1.4-1
Bug #1029046 [src:linux] Wayland session doesn't get back to life post-suspend
Ignoring request to alter found versions of bug #1029046 to the same values 
previously set
> severity -1 serious
Bug #1029046 [src:linux] Wayland session doesn't get back to life post-suspend
Severity set to 'serious' from 'important'

-- 
1029046: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029046
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems