From: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
To: Sudeep Holla <sudeep.holla@kernel.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
linux-pm@vger.kernel.org
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Christian Loehle <christian.loehle@arm.com>,
Maulik Shah <maulik.shah@oss.qualcomm.com>,
Yuanfang Zhang <yuanfang.zhang@oss.qualcomm.com>,
Sneh Mankad <sneh.mankad@oss.qualcomm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] pmdomain: core: Add a genpd config to support unknown initial status
Date: Tue, 1 Sep 2026 13:14:06 +0200 [thread overview]
Message-ID: <20260901111441.122436-4-ulf.hansson@oss.qualcomm.com> (raw)
In-Reply-To: <20260901111441.122436-1-ulf.hansson@oss.qualcomm.com>
It's not always possible for a genpd provider to know the initial status
for its corresponding PM domain(s). To register the PM domain in a safe
state, the genpd provider driver may therefore have to initialize the
genpd's status to be powered off, as a way to prevent the PM domain from
being used when it actually could be powered off.
In these cases we may end up to power on a PM domain through the genpd
subsystem, while from the HW point of view it may already be powered on.
Under these circumstances, it may also be required to keep the PM domain
powered on until all the consumer devices have been probed. In other words,
until the ->sync_state() callback for the genpd provider in question have
been called.
To support this behaviour for a genpd provider, let's introduce a new genpd
configuration, GENPD_FLAG_POWER_UNKNOWN.
Reported-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
Link: https://lore.kernel.org/all/20260811-domain_off_ss3-v1-0-6a0a0fc023f5@oss.qualcomm.com/
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
---
Changes in v2:
- Rename the config to GENPD_FLAG_POWER_UNKNOWN.
---
drivers/pmdomain/core.c | 6 +++++-
include/linux/pm_domain.h | 9 +++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 97273ed2f825..ab6110885175 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -189,6 +189,7 @@ static const struct genpd_lock_ops genpd_raw_spin_ops = {
#define genpd_is_dev_name_fw(genpd) (genpd->flags & GENPD_FLAG_DEV_NAME_FW)
#define genpd_is_no_sync_state(genpd) (genpd->flags & GENPD_FLAG_NO_SYNC_STATE)
#define genpd_is_no_stay_on(genpd) (genpd->flags & GENPD_FLAG_NO_STAY_ON)
+#define genpd_is_power_unknown(genpd) (genpd->flags & GENPD_FLAG_POWER_UNKNOWN)
static inline bool irq_safe_dev_in_sleep_domain(struct device *dev,
const struct generic_pm_domain *genpd)
@@ -2446,7 +2447,10 @@ static void genpd_lock_init(struct generic_pm_domain *genpd)
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
static void genpd_set_stay_on(struct generic_pm_domain *genpd, bool is_off)
{
- genpd->stay_on = !genpd_is_no_stay_on(genpd) && !is_off;
+ if (genpd_is_power_unknown(genpd))
+ genpd->stay_on = is_off;
+ else
+ genpd->stay_on = !genpd_is_no_stay_on(genpd) && !is_off;
}
#else
static void genpd_set_stay_on(struct generic_pm_domain *genpd, bool is_off)
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index f925614aebdb..14e0e346c610 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -121,6 +121,14 @@ struct dev_pm_domain_list {
* powered-off until the ->sync_state() callback is
* invoked. This flag informs genpd to allow a
* power-off without waiting for ->sync_state().
+ *
+ * GENPD_FLAG_POWER_UNKNOWN: Use this flag to inform genpd that its initial
+ * status for the PM domain is set to powered off,
+ * which may not correctly reflect the state of the
+ * HW, as it's unknown. If the PM domain becomes
+ * powered on during boot, genpd will prevent it
+ * from being powered off until the ->sync_state
+ * callback is invoked for it.
*/
#define GENPD_FLAG_PM_CLK (1U << 0)
#define GENPD_FLAG_IRQ_SAFE (1U << 1)
@@ -133,6 +141,7 @@ struct dev_pm_domain_list {
#define GENPD_FLAG_DEV_NAME_FW (1U << 8)
#define GENPD_FLAG_NO_SYNC_STATE (1U << 9)
#define GENPD_FLAG_NO_STAY_ON (1U << 10)
+#define GENPD_FLAG_POWER_UNKNOWN (1U << 11)
enum gpd_status {
GENPD_STATE_ON = 0, /* PM domain is on */
--
2.43.0
next prev parent reply other threads:[~2026-09-01 11:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 11:14 [PATCH v2 0/5] pmdomain/cpuidle-psci: Fix behaviours for CPU PM domains Ulf Hansson
2026-09-01 11:14 ` [PATCH v2 1/5] pmdomain: core: Rename genpd_status_on() Ulf Hansson
2026-09-01 11:14 ` [PATCH v2 2/5] pmdomain: core: Allow a non-CPU device in a CPU PM domain to do power on Ulf Hansson
2026-09-01 11:14 ` Ulf Hansson [this message]
2026-09-01 11:14 ` [PATCH v2 4/5] cpuidle: psci: Initialize the PM domains in powered off state for OSI Ulf Hansson
2026-09-01 11:14 ` [PATCH v2 5/5] cpuidle: psci: Move initialization a bit earlier in the boot sequence Ulf Hansson
2026-09-01 12:00 ` Abel Vesa
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=20260901111441.122436-4-ulf.hansson@oss.qualcomm.com \
--to=ulf.hansson@oss.qualcomm.com \
--cc=abel.vesa@oss.qualcomm.com \
--cc=christian.loehle@arm.com \
--cc=daniel.lezcano@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=maulik.shah@oss.qualcomm.com \
--cc=rafael@kernel.org \
--cc=sneh.mankad@oss.qualcomm.com \
--cc=sudeep.holla@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuanfang.zhang@oss.qualcomm.com \
/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