diff mbox series

[v4,2/2] PM: ACPI: reboot: Reinstate S5 for reboot

Message ID 20220916043319.119716-2-kai.heng.feng@canonical.com (mailing list archive)
State Mainlined, archived
Headers show
Series None | expand

Commit Message

Kai-Heng Feng Sept. 16, 2022, 4:33 a.m. UTC
Commit d60cd06331a3 ("PM: ACPI: reboot: Use S5 for reboot") caused Dell
PowerEdge r440 hangs at reboot.

The issue is fixed by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on
system reboot to avoid triggering AER"), so use the new sysoff API to
reinstate S5 for reboot on ACPI-based systems.

Using S5 for reboot is default behavior under Windows, "A full shutdown
(S5) occurs when a system restart is requested" [1].

[1] https://docs.microsoft.com/en-us/windows/win32/power/system-power-state

Cc: Josef Bacik <josef@toxicpanda.com>
Suggested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v4:
 - Add comment and add more info to commit message.
v3:
 - Use new API to invoke ACPI S5.
v2:
 - Use do_kernel_power_off_prepare() instead.

 drivers/acpi/sleep.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Rafael J. Wysocki Sept. 24, 2022, 4:19 p.m. UTC | #1
On Fri, Sep 16, 2022 at 6:33 AM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> Commit d60cd06331a3 ("PM: ACPI: reboot: Use S5 for reboot") caused Dell
> PowerEdge r440 hangs at reboot.
>
> The issue is fixed by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on
> system reboot to avoid triggering AER"), so use the new sysoff API to
> reinstate S5 for reboot on ACPI-based systems.
>
> Using S5 for reboot is default behavior under Windows, "A full shutdown
> (S5) occurs when a system restart is requested" [1].
>
> [1] https://docs.microsoft.com/en-us/windows/win32/power/system-power-state
>
> Cc: Josef Bacik <josef@toxicpanda.com>
> Suggested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
> v4:
>  - Add comment and add more info to commit message.
> v3:
>  - Use new API to invoke ACPI S5.
> v2:
>  - Use do_kernel_power_off_prepare() instead.
>
>  drivers/acpi/sleep.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index ad4b2987b3d6e..0b557c0d405ef 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -1088,6 +1088,14 @@ int __init acpi_sleep_init(void)
>                 register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
>                                          SYS_OFF_PRIO_FIRMWARE,
>                                          acpi_power_off, NULL);
> +
> +               /*
> +                * Windows uses S5 for reboot, so some BIOSes depend on it to
> +                * perform proper reboot.
> +                */
> +               register_sys_off_handler(SYS_OFF_MODE_RESTART_PREPARE,
> +                                        SYS_OFF_PRIO_FIRMWARE,
> +                                        acpi_power_off_prepare, NULL);
>         } else {
>                 acpi_no_s5 = true;
>         }
> --

Applied as 6.1 material with some edits in the changelog, thanks!
Rafael J. Wysocki Sept. 25, 2022, 3:50 p.m. UTC | #2
On Sat, Sep 24, 2022 at 6:19 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, Sep 16, 2022 at 6:33 AM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > Commit d60cd06331a3 ("PM: ACPI: reboot: Use S5 for reboot") caused Dell
> > PowerEdge r440 hangs at reboot.
> >
> > The issue is fixed by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on
> > system reboot to avoid triggering AER"), so use the new sysoff API to
> > reinstate S5 for reboot on ACPI-based systems.
> >
> > Using S5 for reboot is default behavior under Windows, "A full shutdown
> > (S5) occurs when a system restart is requested" [1].
> >
> > [1] https://docs.microsoft.com/en-us/windows/win32/power/system-power-state
> >
> > Cc: Josef Bacik <josef@toxicpanda.com>
> > Suggested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> > v4:
> >  - Add comment and add more info to commit message.
> > v3:
> >  - Use new API to invoke ACPI S5.
> > v2:
> >  - Use do_kernel_power_off_prepare() instead.
> >
> >  drivers/acpi/sleep.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> > index ad4b2987b3d6e..0b557c0d405ef 100644
> > --- a/drivers/acpi/sleep.c
> > +++ b/drivers/acpi/sleep.c
> > @@ -1088,6 +1088,14 @@ int __init acpi_sleep_init(void)
> >                 register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
> >                                          SYS_OFF_PRIO_FIRMWARE,
> >                                          acpi_power_off, NULL);
> > +
> > +               /*
> > +                * Windows uses S5 for reboot, so some BIOSes depend on it to
> > +                * perform proper reboot.
> > +                */
> > +               register_sys_off_handler(SYS_OFF_MODE_RESTART_PREPARE,
> > +                                        SYS_OFF_PRIO_FIRMWARE,
> > +                                        acpi_power_off_prepare, NULL);
> >         } else {
> >                 acpi_no_s5 = true;
> >         }
> > --
>
> Applied as 6.1 material with some edits in the changelog, thanks!

And dropped due to a build failure.

It looks like it depends on patch [1/2], but I haven't seen that one.
Kai-Heng Feng Sept. 29, 2022, 6:03 a.m. UTC | #3
On Sun, Sep 25, 2022 at 11:50 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Sat, Sep 24, 2022 at 6:19 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Fri, Sep 16, 2022 at 6:33 AM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> > >
> > > Commit d60cd06331a3 ("PM: ACPI: reboot: Use S5 for reboot") caused Dell
> > > PowerEdge r440 hangs at reboot.
> > >
> > > The issue is fixed by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on
> > > system reboot to avoid triggering AER"), so use the new sysoff API to
> > > reinstate S5 for reboot on ACPI-based systems.
> > >
> > > Using S5 for reboot is default behavior under Windows, "A full shutdown
> > > (S5) occurs when a system restart is requested" [1].
> > >
> > > [1] https://docs.microsoft.com/en-us/windows/win32/power/system-power-state
> > >
> > > Cc: Josef Bacik <josef@toxicpanda.com>
> > > Suggested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > > ---
> > > v4:
> > >  - Add comment and add more info to commit message.
> > > v3:
> > >  - Use new API to invoke ACPI S5.
> > > v2:
> > >  - Use do_kernel_power_off_prepare() instead.
> > >
> > >  drivers/acpi/sleep.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> > > index ad4b2987b3d6e..0b557c0d405ef 100644
> > > --- a/drivers/acpi/sleep.c
> > > +++ b/drivers/acpi/sleep.c
> > > @@ -1088,6 +1088,14 @@ int __init acpi_sleep_init(void)
> > >                 register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
> > >                                          SYS_OFF_PRIO_FIRMWARE,
> > >                                          acpi_power_off, NULL);
> > > +
> > > +               /*
> > > +                * Windows uses S5 for reboot, so some BIOSes depend on it to
> > > +                * perform proper reboot.
> > > +                */
> > > +               register_sys_off_handler(SYS_OFF_MODE_RESTART_PREPARE,
> > > +                                        SYS_OFF_PRIO_FIRMWARE,
> > > +                                        acpi_power_off_prepare, NULL);
> > >         } else {
> > >                 acpi_no_s5 = true;
> > >         }
> > > --
> >
> > Applied as 6.1 material with some edits in the changelog, thanks!
>
> And dropped due to a build failure.
>
> It looks like it depends on patch [1/2], but I haven't seen that one.

Sorry about that, let me resend it to linux-pm too.

Kai-Heng
diff mbox series

Patch

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index ad4b2987b3d6e..0b557c0d405ef 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -1088,6 +1088,14 @@  int __init acpi_sleep_init(void)
 		register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
 					 SYS_OFF_PRIO_FIRMWARE,
 					 acpi_power_off, NULL);
+
+		/*
+		 * Windows uses S5 for reboot, so some BIOSes depend on it to
+		 * perform proper reboot.
+		 */
+		register_sys_off_handler(SYS_OFF_MODE_RESTART_PREPARE,
+					 SYS_OFF_PRIO_FIRMWARE,
+					 acpi_power_off_prepare, NULL);
 	} else {
 		acpi_no_s5 = true;
 	}