From: Abel Vesa <abel.vesa@oss.qualcomm.com>
To: Ulf Hansson <ulfh@kernel.org>, "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Abel Vesa <abel.vesa@oss.qualcomm.com>
Subject: [PATCH 1/4] pmdomain: core: Support a boot performance floor until sync_state
Date: Tue, 13 Oct 2026 15:48:39 +0300 [thread overview]
Message-ID: <20261013-genpd-boot-performance-floor-v1-1-a765dc83e6d7@oss.qualcomm.com> (raw)
In-Reply-To: <20261013-genpd-boot-performance-floor-v1-0-a765dc83e6d7@oss.qualcomm.com>
Some providers retain conservative performance votes until their
sync_state() callbacks run to accommodate hardware configured by
firmware. Enforcing this policy inside the provider hides the floor
from genpd when aggregating performance requirements towards parents.
Add a provider-specified boot_performance_state for domains using
GENPD_FLAG_POWER_UNKNOWN. Clamp the effective domain vote without
changing individual consumer requests, and reaggregate those requests
when sync_state releases the floor. Zero imposes no additional floor.
Apply the floor before runtime power-on even without a preceding
performance request. Do not skip an unchanged consumer request if the
boot performance floor has yet to be applied.
Report sync-time performance errors and continue the normal power-off
attempt. Leave the provider sync callbacks and existing performance
error handling in place, without introducing retries or a new recovery
policy.
Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
---
drivers/pmdomain/core.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
include/linux/pm_domain.h | 6 ++++++
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 964e44c2f78f..6f2b406ce049 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -512,6 +512,10 @@ static int _genpd_set_performance_state(struct generic_pm_domain *genpd,
struct gpd_link *link = NULL;
int ret;
+ /* Keep consumer votes intact; clamp only the effective domain vote. */
+ if (genpd_is_power_unknown(genpd) && genpd->stay_on)
+ state = max(state, genpd->boot_performance_state);
+
if (state == genpd->performance_state)
return 0;
@@ -555,6 +559,12 @@ static int _genpd_set_performance_state(struct generic_pm_domain *genpd,
return ret;
}
+static bool genpd_needs_boot_performance_state(struct generic_pm_domain *genpd)
+{
+ return genpd_is_power_unknown(genpd) && genpd->stay_on &&
+ genpd->performance_state < genpd->boot_performance_state;
+}
+
static int genpd_set_performance_state(struct device *dev, unsigned int state)
{
struct generic_pm_domain *genpd = dev_to_genpd(dev);
@@ -563,7 +573,7 @@ static int genpd_set_performance_state(struct device *dev, unsigned int state)
int ret;
prev_state = gpd_data->performance_state;
- if (prev_state == state)
+ if (prev_state == state && !genpd_needs_boot_performance_state(genpd))
return 0;
gpd_data->performance_state = state;
@@ -1180,6 +1190,14 @@ static int genpd_power_on(struct generic_pm_domain *genpd, struct device *dev,
}
}
+ /* A consumer may enable a domain without first requesting an OPP. */
+ if (genpd_needs_boot_performance_state(genpd)) {
+ ret = _genpd_set_performance_state(genpd,
+ genpd->performance_state, depth);
+ if (ret)
+ goto err;
+ }
+
ret = _genpd_power_on(genpd, true);
if (ret)
goto err;
@@ -3794,6 +3812,25 @@ int of_genpd_parse_idle_states(struct device_node *dn,
}
EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states);
+/* Called with the domain lock held. */
+static void genpd_sync_boot_state(struct generic_pm_domain *genpd)
+{
+ unsigned int state;
+ int ret;
+
+ genpd->stay_on = false;
+ if (genpd_is_power_unknown(genpd) && genpd->boot_performance_state) {
+ /* Reaggregate real votes, excluding the boot performance floor. */
+ state = _genpd_reeval_performance_state(genpd, 0);
+ ret = _genpd_set_performance_state(genpd, state, 0);
+ if (ret)
+ pr_err("%s: Failed to sync boot performance state: %d\n",
+ genpd->name, ret);
+ }
+
+ genpd_power_off(genpd, false, 0);
+}
+
/**
* of_genpd_sync_state() - A common sync_state function for genpd providers
* @np: The device node the genpd provider is associated with.
@@ -3813,8 +3850,7 @@ void of_genpd_sync_state(struct device_node *np)
list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
if (genpd->provider == of_fwnode_handle(np)) {
genpd_lock(genpd);
- genpd->stay_on = false;
- genpd_power_off(genpd, false, 0);
+ genpd_sync_boot_state(genpd);
genpd_unlock(genpd);
}
}
@@ -3841,8 +3877,7 @@ static void genpd_provider_sync_state(struct device *dev)
case GENPD_SYNC_STATE_SIMPLE:
genpd_lock(genpd);
- genpd->stay_on = false;
- genpd_power_off(genpd, false, 0);
+ genpd_sync_boot_state(genpd);
genpd_unlock(genpd);
break;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 14e0e346c610..5927d9485054 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -129,6 +129,11 @@ struct dev_pm_domain_list {
* powered on during boot, genpd will prevent it
* from being powered off until the ->sync_state
* callback is invoked for it.
+ * Providers may also set boot_performance_state
+ * before pm_genpd_init() to specify a performance
+ * floor until sync_state. This must be a valid
+ * provider performance level, not a corner index.
+ * Zero disables the boot performance floor.
*/
#define GENPD_FLAG_PM_CLK (1U << 0)
#define GENPD_FLAG_IRQ_SAFE (1U << 1)
@@ -221,6 +226,7 @@ struct generic_pm_domain {
unsigned int suspended_count; /* System suspend device counter */
unsigned int prepared_count; /* Suspend counter of prepared devices */
unsigned int performance_state; /* Aggregated max performance state */
+ unsigned int boot_performance_state; /* Provider-specified boot floor */
cpumask_var_t cpus; /* A cpumask of the attached CPUs */
bool synced_poweroff; /* A consumer needs a synced poweroff */
bool stay_on; /* Stay powered-on during boot. */
--
2.54.0
next prev parent reply other threads:[~2026-10-13 12:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 12:48 [PATCH 0/4] pmdomain: Preserve boot performance constraints " Abel Vesa
2026-10-13 12:48 ` Abel Vesa [this message]
2026-10-13 12:48 ` [PATCH 2/4] pmdomain: core: Prepare boot performance floors before system suspend Abel Vesa
2026-10-13 12:48 ` [PATCH 3/4] pmdomain: qcom: rpmhpd: Let genpd enforce the boot performance floor Abel Vesa
2026-10-13 12:48 ` [PATCH 4/4] pmdomain: qcom: rpmpd: " 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=20261013-genpd-boot-performance-floor-v1-1-a765dc83e6d7@oss.qualcomm.com \
--to=abel.vesa@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=ulfh@kernel.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
all inboxes | Powered by JetHome®