All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: Add resume event mapping for PMSG_POWEROFF
@ 2026-09-16 21:13 Mario Limonciello (AMD)
  2026-09-25 19:29 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello (AMD) @ 2026-09-16 21:13 UTC (permalink / raw)
  To: mario.limonciello, rafael, lenb, pavel, gregkh, dakr
  Cc: Mario Limonciello (AMD), Eric Naim, linux-pm, driver-core

PM_EVENT_POWEROFF (0x0800) and PMSG_POWEROFF were already defined in
include/linux/pm.h. Add the resume_event() which is used when a shutdown
sequence needs to be aborted and the system should return to normal
operation.

This completes the PMSG_POWEROFF infrastructure needed to support
differentiating between hibernation and shutdown sequences when
re-using callbacks for common code.

Hibernation is started by writing a hibernation method (such as 'platform'
'shutdown', or 'reboot') to use into /sys/power/disk and writing 'disk' to
/sys/power/state.

Later shutdown will be initiated with the reboot() syscall with arguments
on whether to halt the system or power it off.

Tested-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/base/power/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e130da4281410..7265553ba24ca 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1472,6 +1472,8 @@ static pm_message_t resume_event(pm_message_t sleep_state)
 		return PMSG_RECOVER;
 	case PM_EVENT_HIBERNATE:
 		return PMSG_RESTORE;
+	case PM_EVENT_POWEROFF:
+		return PMSG_ON;
 	}
 	return PMSG_ON;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM: Add resume event mapping for PMSG_POWEROFF
  2026-09-16 21:13 [PATCH] PM: Add resume event mapping for PMSG_POWEROFF Mario Limonciello (AMD)
@ 2026-09-25 19:29 ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-25 19:29 UTC (permalink / raw)
  To: Mario Limonciello (AMD)
  Cc: mario.limonciello, rafael, lenb, pavel, gregkh, dakr, Eric Naim,
	linux-pm, driver-core

On Wed, Sep 16, 2026 at 11:13 PM Mario Limonciello (AMD)
<superm1@kernel.org> wrote:
>
> PM_EVENT_POWEROFF (0x0800) and PMSG_POWEROFF were already defined in
> include/linux/pm.h. Add the resume_event() which is used when a shutdown
> sequence needs to be aborted and the system should return to normal
> operation.
>
> This completes the PMSG_POWEROFF infrastructure needed to support
> differentiating between hibernation and shutdown sequences when
> re-using callbacks for common code.
>
> Hibernation is started by writing a hibernation method (such as 'platform'
> 'shutdown', or 'reboot') to use into /sys/power/disk and writing 'disk' to
> /sys/power/state.
>
> Later shutdown will be initiated with the reboot() syscall with arguments
> on whether to halt the system or power it off.
>
> Tested-by: Eric Naim <dnaim@cachyos.org>
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
>  drivers/base/power/main.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index e130da4281410..7265553ba24ca 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -1472,6 +1472,8 @@ static pm_message_t resume_event(pm_message_t sleep_state)
>                 return PMSG_RECOVER;
>         case PM_EVENT_HIBERNATE:
>                 return PMSG_RESTORE;
> +       case PM_EVENT_POWEROFF:
> +               return PMSG_ON;

Why should it be PMSG_ON?

pm_op() doesn't actually take PM_EVENT_ON into account, so I'm not
sure how the change helps.

>         }
>         return PMSG_ON;
>  }
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-25 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16 21:13 [PATCH] PM: Add resume event mapping for PMSG_POWEROFF Mario Limonciello (AMD)
2026-09-25 19:29 ` Rafael J. Wysocki (Intel)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.