mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 3/4] pmdomain: qcom: rpmhpd: Let genpd enforce the boot performance floor
Date: Tue, 13 Oct 2026 15:48:41 +0300	[thread overview]
Message-ID: <20261013-genpd-boot-performance-floor-v1-3-a765dc83e6d7@oss.qualcomm.com> (raw)
In-Reply-To: <20261013-genpd-boot-performance-floor-v1-0-a765dc83e6d7@oss.qualcomm.com>

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@oss.qualcomm.com>
---
 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


  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 until sync_state Abel Vesa
2026-10-13 12:48 ` [PATCH 1/4] pmdomain: core: Support a boot performance floor " Abel Vesa
2026-10-13 12:48 ` [PATCH 2/4] pmdomain: core: Prepare boot performance floors before system suspend Abel Vesa
2026-10-13 12:48 ` Abel Vesa [this message]
2026-10-13 12:48 ` [PATCH 4/4] pmdomain: qcom: rpmpd: Let genpd enforce the boot performance floor 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-3-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®