Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization
@ 2026-11-09 15:53 Sudeep Holla
  2026-11-09 15:53 ` [PATCH RESEND 2/2] pmdomain: arm_scmi: Propagate domain hierarchy setup failures Sudeep Holla
  2026-11-11 12:11 ` [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Sudeep Holla @ 2026-11-09 15:53 UTC (permalink / raw)
  To: arm-scmi, linux-arm-kernel
  Cc: Sudeep Holla, Ulf Hansson, Cristian Marussi, Kevin Hilman,
	Ulf Hansson

pm_genpd_init() can fail while allocating generic power-domain state.
The SCMI driver ignores that error and stores the partially initialized
domain in the onecell array. Provider registration then fails because that
domain was never added to the global genpd list.

Preserve support for partially available SCMI power domains. Log the
failure and leave the corresponding onecell entry NULL so the other
initialized domains remain available. Explicitly skip empty slots when
unwinding provider registration failures.

Fixes: 898216c97ed2 ("firmware: arm_scmi: add device power domain support using genpd")
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
 drivers/pmdomain/arm/scmi_pm_domain.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Resending
https://lore.kernel.org/all/20260923101608.4180057-1-sudeep.holla@kernel.org/

diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/scmi_pm_domain.c
index fff7b4f438ca..b95b24470ba5 100644
--- a/drivers/pmdomain/arm/scmi_pm_domain.c
+++ b/drivers/pmdomain/arm/scmi_pm_domain.c
@@ -99,8 +99,13 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 		scmi_pd->genpd.power_on = scmi_pd_power_on;
 		scmi_pd->genpd.flags = GENPD_FLAG_ACTIVE_WAKEUP;
 
-		pm_genpd_init(&scmi_pd->genpd, NULL,
-			      state == SCMI_POWER_STATE_GENERIC_OFF);
+		ret = pm_genpd_init(&scmi_pd->genpd, NULL,
+				    state == SCMI_POWER_STATE_GENERIC_OFF);
+		if (ret) {
+			dev_warn(dev, "failed to initialize domain %d: %d\n",
+				 i, ret);
+			continue;
+		}
 
 		domains[i] = &scmi_pd->genpd;
 	}
@@ -126,8 +131,11 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 
 	return 0;
 err_rm_genpds:
-	for (i = num_domains - 1; i >= 0; i--)
+	for (i = num_domains - 1; i >= 0; i--) {
+		if (!domains[i])
+			continue;
 		pm_genpd_remove(domains[i]);
+	}
 
 	return ret;
 }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND 2/2] pmdomain: arm_scmi: Propagate domain hierarchy setup failures
  2026-11-09 15:53 [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla
@ 2026-11-09 15:53 ` Sudeep Holla
  2026-11-11 12:11 ` [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2026-11-09 15:53 UTC (permalink / raw)
  To: arm-scmi, linux-arm-kernel
  Cc: Sudeep Holla, Ulf Hansson, Cristian Marussi, Kevin Hilman,
	Ulf Hansson

of_genpd_add_child_ids() uses all-or-nothing semantics and reports an
error if any relationship cannot be established. The SCMI driver
currently only logs that error and completes probe, leaving domains
registered without their DT-described parent relationships.

Treat hierarchy setup failures as probe failures. Translate -ENOENT to
-EPROBE_DEFER so external parent providers can register first, remove the
onecell provider before unwinding domains, and publish driver data only
after hierarchy setup succeeds.

Fixes: fba9c703c184 ("pmdomain: arm_scmi: add support for domain hierarchies")
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
 drivers/pmdomain/arm/scmi_pm_domain.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/scmi_pm_domain.c
index b95b24470ba5..95857bebc444 100644
--- a/drivers/pmdomain/arm/scmi_pm_domain.c
+++ b/drivers/pmdomain/arm/scmi_pm_domain.c
@@ -117,19 +117,24 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 	if (ret)
 		goto err_rm_genpds;
 
-	dev_set_drvdata(dev, scmi_pd_data);
-
 	/*
 	 * Parse (optional) power-domains-child-ids property to establish
 	 * parent-child relationships.
 	*/
 	ret = of_genpd_add_child_ids(np, scmi_pd_data);
-	if (ret < 0)
-		dev_err(dev, "Failed to add child domain hierarchy: %d\n", ret);
+	if (ret < 0) {
+		ret = dev_err_probe(dev, ret == -ENOENT ? -EPROBE_DEFER : ret,
+				    "failed to add child domain hierarchy\n");
+		goto err_del_provider;
+	}
+
+	dev_set_drvdata(dev, scmi_pd_data);
 
 	dev_info(dev, "Initialized %d power domains", num_domains);
 
 	return 0;
+err_del_provider:
+	of_genpd_del_provider(np);
 err_rm_genpds:
 	for (i = num_domains - 1; i >= 0; i--) {
 		if (!domains[i])
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization
  2026-11-09 15:53 [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla
  2026-11-09 15:53 ` [PATCH RESEND 2/2] pmdomain: arm_scmi: Propagate domain hierarchy setup failures Sudeep Holla
@ 2026-11-11 12:11 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2026-11-11 12:11 UTC (permalink / raw)
  To: arm-scmi, linux-arm-kernel, Ulf Hansson
  Cc: Ulf Hansson, Cristian Marussi, Kevin Hilman

On Mon, Nov 09, 2026 at 03:53:31PM +0000, Sudeep Holla wrote:
> pm_genpd_init() can fail while allocating generic power-domain state.
> The SCMI driver ignores that error and stores the partially initialized
> domain in the onecell array. Provider registration then fails because that
> domain was never added to the global genpd list.
> 
> Preserve support for partially available SCMI power domains. Log the
> failure and leave the corresponding onecell entry NULL so the other
> initialized domains remain available. Explicitly skip empty slots when
> unwinding provider registration failures.
> 
> Fixes: 898216c97ed2 ("firmware: arm_scmi: add device power domain support using genpd")
> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
> ---
>  drivers/pmdomain/arm/scmi_pm_domain.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> Resending
> https://lore.kernel.org/all/20260923101608.4180057-1-sudeep.holla@kernel.org/
> 

Hi Ulf,

Gentle ping, not sure if it is landing somewhere else in you mailbox,
just putting your address in To: now and trying.

-- 
Regards,
Sudeep


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-11 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 15:53 [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla
2026-11-09 15:53 ` [PATCH RESEND 2/2] pmdomain: arm_scmi: Propagate domain hierarchy setup failures Sudeep Holla
2026-11-11 12:11 ` [PATCH RESEND 1/2] pmdomain: arm_scmi: Skip domains that fail initialization Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox