From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: "Pavel Machek" <pavel@kernel.org>, "Len Brown" <lenb@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software
Suspend, aka swsusp)),
amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM
DRIVERS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS),
linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM),
linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM),
linux-usb@vger.kernel.org (open list:USB SUBSYSTEM),
linux-trace-kernel@vger.kernel.org (open list:TRACING),
"AceLan Kao" <acelan.kao@canonical.com>,
"Kai-Heng Feng" <kaihengf@nvidia.com>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Merthan Karakaş" <m3rthn.k@gmail.com>,
"Eric Naim" <dnaim@cachyos.org>,
"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH v6 01/11] PM: Introduce new PMSG_POWEROFF event
Date: Sun, 17 Aug 2025 21:00:51 -0500 [thread overview]
Message-ID: <20250818020101.3619237-2-superm1@kernel.org> (raw)
In-Reply-To: <20250818020101.3619237-1-superm1@kernel.org>
PMSG_POWEROFF will be used for the PM core to allow differentiating between
an S4 or S5 shutdown sequence when re-using callbacks.
This event should not have wakeups enabled so update PMSG_NO_WAKEUP() to
match it as well.
Tested-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
v5:
* Re-order and split
* Add tags
v4:
* https://lore.kernel.org/linux-pci/20250616175019.3471583-1-superm1@kernel.org/
---
drivers/base/power/main.c | 7 +++++++
include/linux/pm.h | 5 ++++-
include/trace/events/power.h | 3 ++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index dbf5456cd891b..c59ab5286d9a5 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -99,6 +99,8 @@ static const char *pm_verb(int event)
return "restore";
case PM_EVENT_RECOVER:
return "recover";
+ case PM_EVENT_POWEROFF:
+ return "poweroff";
default:
return "(unknown PM event)";
}
@@ -369,6 +371,7 @@ static pm_callback_t pm_op(const struct dev_pm_ops *ops, pm_message_t state)
case PM_EVENT_FREEZE:
case PM_EVENT_QUIESCE:
return ops->freeze;
+ case PM_EVENT_POWEROFF:
case PM_EVENT_HIBERNATE:
return ops->poweroff;
case PM_EVENT_THAW:
@@ -403,6 +406,7 @@ static pm_callback_t pm_late_early_op(const struct dev_pm_ops *ops,
case PM_EVENT_FREEZE:
case PM_EVENT_QUIESCE:
return ops->freeze_late;
+ case PM_EVENT_POWEROFF:
case PM_EVENT_HIBERNATE:
return ops->poweroff_late;
case PM_EVENT_THAW:
@@ -437,6 +441,7 @@ static pm_callback_t pm_noirq_op(const struct dev_pm_ops *ops, pm_message_t stat
case PM_EVENT_FREEZE:
case PM_EVENT_QUIESCE:
return ops->freeze_noirq;
+ case PM_EVENT_POWEROFF:
case PM_EVENT_HIBERNATE:
return ops->poweroff_noirq;
case PM_EVENT_THAW:
@@ -1370,6 +1375,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;
}
diff --git a/include/linux/pm.h b/include/linux/pm.h
index cc7b2dc28574c..892bd93f13dad 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -507,6 +507,7 @@ const struct dev_pm_ops name = { \
* RECOVER Creation of a hibernation image or restoration of the main
* memory contents from a hibernation image has failed, call
* ->thaw() and ->complete() for all devices.
+ * POWEROFF System will poweroff, call ->poweroff() for all devices.
*
* The following PM_EVENT_ messages are defined for internal use by
* kernel subsystems. They are never issued by the PM core.
@@ -537,6 +538,7 @@ const struct dev_pm_ops name = { \
#define PM_EVENT_USER 0x0100
#define PM_EVENT_REMOTE 0x0200
#define PM_EVENT_AUTO 0x0400
+#define PM_EVENT_POWEROFF 0x0800
#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
@@ -551,6 +553,7 @@ const struct dev_pm_ops name = { \
#define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
+#define PMSG_POWEROFF ((struct pm_message){ .event = PM_EVENT_POWEROFF, })
#define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, })
#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
@@ -568,7 +571,7 @@ const struct dev_pm_ops name = { \
#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
#define PMSG_NO_WAKEUP(msg) (((msg).event & \
- (PM_EVENT_FREEZE | PM_EVENT_QUIESCE)) != 0)
+ (PM_EVENT_FREEZE | PM_EVENT_QUIESCE | PM_EVENT_POWEROFF)) != 0)
/*
* Device run-time power management status.
*
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 82904291c2b81..370f8df2fdb4b 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -179,7 +179,8 @@ TRACE_EVENT(pstate_sample,
{ PM_EVENT_HIBERNATE, "hibernate" }, \
{ PM_EVENT_THAW, "thaw" }, \
{ PM_EVENT_RESTORE, "restore" }, \
- { PM_EVENT_RECOVER, "recover" })
+ { PM_EVENT_RECOVER, "recover" }, \
+ { PM_EVENT_POWEROFF, "poweroff" })
DEFINE_EVENT(cpu, cpu_frequency,
--
2.43.0
next prev parent reply other threads:[~2025-08-18 2:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 2:00 [PATCH v6 00/11] Improvements to S5 power consumption Mario Limonciello (AMD)
2025-08-18 2:00 ` Mario Limonciello (AMD) [this message]
2025-08-18 2:00 ` [PATCH v6 02/11] scsi: Add PM_EVENT_POWEROFF into suspend callbacks Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 03/11] usb: sl811-hcd: " Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 04/11] USB: Pass PMSG_POWEROFF event to suspend_common() for poweroff with S4 flow Mario Limonciello (AMD)
2025-08-18 10:50 ` Oliver Neukum
2025-08-18 11:24 ` Mario Limonciello
2025-08-18 2:00 ` [PATCH v6 05/11] PCI: PM: Disable device wakeups when halting system through " Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 06/11] PCI: PM: Split out code from pci_pm_suspend_noirq() into helper Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 07/11] PCI: PM: Run bridge power up actions as part of restore phase Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 08/11] PCI: PM: Use pci_power_manageable() in pci_pm_poweroff_noirq() Mario Limonciello (AMD)
2025-08-18 2:00 ` [PATCH v6 09/11] PCI: Put PCIe bridges with downstream devices into D3 at hibernate Mario Limonciello (AMD)
2025-08-18 2:01 ` [PATCH v6 10/11] drm/amd: Avoid evicting resources at S5 Mario Limonciello (AMD)
2025-08-18 2:01 ` [PATCH v6 11/11] PM: Use hibernate flows for system power off Mario Limonciello (AMD)
2025-09-03 4:41 ` [PATCH v6 00/11] Improvements to S5 power consumption Mario Limonciello
2025-09-03 11:14 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250818020101.3619237-2-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=acelan.kao@canonical.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dnaim@cachyos.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=kaihengf@nvidia.com \
--cc=lenb@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m3rthn.k@gmail.com \
--cc=martin.petersen@oracle.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).