[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250704101233.347506-5-guoqing.zhang@amd.com>
Date: Fri, 4 Jul 2025 18:12:32 +0800
From: Samuel Zhang <guoqing.zhang@....com>
To: <alexander.deucher@....com>, <christian.koenig@....com>,
<rafael@...nel.org>, <len.brown@...el.com>, <pavel@...nel.org>,
<gregkh@...uxfoundation.org>, <dakr@...nel.org>, <airlied@...il.com>,
<simona@...ll.ch>, <ray.huang@....com>, <matthew.auld@...el.com>,
<matthew.brost@...el.com>, <maarten.lankhorst@...ux.intel.com>,
<mripard@...nel.org>, <tzimmermann@...e.de>
CC: <mario.limonciello@....com>, <lijo.lazar@....com>, <victor.zhao@....com>,
<haijun.chang@....com>, <Qing.Ma@....com>, <linux-pm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <amd-gfx@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>, Samuel Zhang <guoqing.zhang@....com>
Subject: [PATCH v2 4/5] PM: hibernate: export variable pm_transition
https://github.com/torvalds/linux/blob/v6.14/Documentation/power/pci.rst?plain=1#L588
Per this kernel doc, dev_pm_ops.thaw() is called mainly for resume
storage devices for saving the hibernation image. Other devices that not
involved in the image saving do not need to resume the device.
But dev_pm_ops.thaw() is also called to restore devices when hibernation
is aborted due to some error in hibernation image creation stage.
So there need to be a way to query in thaw() to know if hibernation is
aborted or not and conditionally resume devices. Exported pm_transition
is such a way. When thaw() is called, the value is:
- PM_EVENT_THAW: normal hibernate, no need to resume non-storage devices.
- PM_EVENT_RECOVER: cancelled hibernation, need to resume devices.
Signed-off-by: Samuel Zhang <guoqing.zhang@....com>
---
drivers/base/power/main.c | 3 ++-
include/linux/pm.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 40e1d8d8a589..d50f58c0121b 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -61,7 +61,8 @@ static LIST_HEAD(dpm_late_early_list);
static LIST_HEAD(dpm_noirq_list);
static DEFINE_MUTEX(dpm_list_mtx);
-static pm_message_t pm_transition;
+pm_message_t pm_transition;
+EXPORT_SYMBOL_GPL(pm_transition);
static int async_error;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 78855d794342..f01846852a90 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -657,6 +657,8 @@ struct pm_subsys_data {
#define DPM_FLAG_SMART_SUSPEND BIT(2)
#define DPM_FLAG_MAY_SKIP_RESUME BIT(3)
+extern pm_message_t pm_transition;
+
struct dev_pm_info {
pm_message_t power_state;
bool can_wakeup:1;
--
2.43.5
Powered by blists - more mailing lists