[PATCH 3/4] pmdomain: qcom: rpmhpd: Let genpd enforce the boot performance floor

From: Abel Vesa

Date: Tue Oct 13 2026 - 09:13:50 EST


RPMh power domains are registered as powered off without knowing their
initial hardware state. Until the provider's sync_state() callback runs,
rpmhpd_aggregate_corner() replaces requests with the highest supported
corner, leaving genpd unaware of this boot performance constraint.

Set GENPD_FLAG_POWER_UNKNOWN and provide the highest mapped performance
level as boot_performance_state. Reject an empty mapping before indexing
its last entry. Let genpd enforce the floor and retain consumer-enabled
domains while boot protection is active, instead of clamping corners
inside the provider.

Retain state_synced for the hardware-specific sleep-vote policy. Include
the supplied corner in sleep votes for active-only domains until the
provider's sync_state() callback releases that protection. This also
applies when translating an enabled peer's vote. Keep the existing sync
callback to reconcile votes for domains left software-OFF by genpd.

Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
drivers/pmdomain/qcom/rpmhpd.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/pmdomain/qcom/rpmhpd.c b/drivers/pmdomain/qcom/rpmhpd.c
index fa8fed5bd3e5..1488f31bcdda 100644
--- a/drivers/pmdomain/qcom/rpmhpd.c
+++ b/drivers/pmdomain/qcom/rpmhpd.c
@@ -40,7 +40,7 @@
* @res_name: Resource name used for cmd-db lookup
* @addr: Resource address as looped up using resource name from
* cmd-db
- * @state_synced: Indicator that sync_state has been invoked for the rpmhpd resource
+ * @state_synced: Whether boot protection of sleep votes has been released
*/
struct rpmhpd {
struct device *dev;
@@ -982,7 +982,7 @@ static void to_active_sleep(struct rpmhpd *pd, unsigned int corner,
{
*active = corner;

- if (pd->active_only)
+ if (pd->active_only && pd->state_synced)
*sleep = 0;
else
*sleep = *active;
@@ -1006,13 +1006,7 @@ static int rpmhpd_aggregate_corner(struct rpmhpd *pd, unsigned int corner)
unsigned int peer_active_corner = 0, peer_sleep_corner = 0;
unsigned int peer_enabled_corner;

- if (pd->state_synced) {
- to_active_sleep(pd, corner, &this_active_corner, &this_sleep_corner);
- } else {
- /* Clamp to highest corner if sync_state hasn't happened */
- this_active_corner = pd->level_count - 1;
- this_sleep_corner = pd->level_count - 1;
- }
+ to_active_sleep(pd, corner, &this_active_corner, &this_sleep_corner);

if (peer && peer->enabled) {
peer_enabled_corner = max(peer->corner, peer->enable_corner);
@@ -1210,10 +1204,15 @@ static int rpmhpd_probe(struct platform_device *pdev)
ret = rpmhpd_update_level_mapping(rpmhpds[i]);
if (ret)
return ret;
+ if (!rpmhpds[i]->level_count)
+ return -EINVAL;

rpmhpds[i]->pd.power_off = rpmhpd_power_off;
rpmhpds[i]->pd.power_on = rpmhpd_power_on;
rpmhpds[i]->pd.set_performance_state = rpmhpd_set_performance_state;
+ rpmhpds[i]->pd.flags |= GENPD_FLAG_POWER_UNKNOWN;
+ rpmhpds[i]->pd.boot_performance_state =
+ rpmhpds[i]->level[rpmhpds[i]->level_count - 1];
pm_genpd_init(&rpmhpds[i]->pd, NULL, true);

data->domains[i] = &rpmhpds[i]->pd;

--
2.54.0