Skip to contentSkip to conversation

interconnect: qcom: rpm: fix msm8996 interconnect registration

PATCH In review Johan Hovold 4 participants 10 messages Mar 13, 2023 – Mar 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover interconnect: qcom: rpm: fix msm8996 interconnect registration

Christophe noticed that a recent patch adding a missing clock disable to one of the Qualcomm rpm driver error paths was broken. This would lead to the provider not being registered on msm8996 which is the only platform using this code path.

Turns out, however, that the power domain attach during probe is bogus and would always succeed as any power domain would already have been attached by the platform bus code.

Georgi, the offending commit is currently in your icc-next (and local icc-fixes) branch. Perhaps you can fold in the fixup unless you prefer applying it on top.

The bogus PM domain lookup is redundant and confusing but should otherwise be benign so the removal could be applied to either branch.

Johan

Johan Hovold (2):
interconnect: qcom: rpm: fix msm8996 interconnect registration
interconnect: qcom: rpm: drop bogus pm domain attach

 drivers/interconnect/qcom/icc-rpm.c | 5 -----
 drivers/interconnect/qcom/icc-rpm.h | 1 -
 drivers/interconnect/qcom/msm8996.c | 1 -
 3 files changed, 7 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 interconnect: qcom: rpm: fix msm8996 interconnect registration

A recent commit broke interconnect provider registration for the msm8996 platform by accidentally removing a conditional when adding the missing clock disable in the power-domain lookup error path.

Fixes b6edcc7570b2 ("interconnect: qcom: rpm: fix probe PM domain error handling")
---
 drivers/interconnect/qcom/icc-rpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/interconnect/qcom/icc-rpm.c +2 -1
index 4d0997b210f7..3b055cd893ea 100644
@@ -498,7 +498,8 @@ int qnoc_probe(struct platform_device *pdev)
 
 	if (desc->has_bus_pd) {
 		ret = dev_pm_domain_attach(dev, true);
-		goto err_disable_clks;
+		if (ret)
+			goto err_disable_clks;
 	}
 
 	provider = &qp->provider;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/2
#2 lore raw
Quoted 5 lines · Johan Hovold

A recent commit broke interconnect provider registration for the msm8996 platform by accidentally removing a conditional when adding the missing clock disable in the power-domain lookup error path.

Fixes b6edcc7570b2 ("interconnect: qcom: rpm: fix probe PM domain error handling")

The hash seems to be different:

https://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc.git/commit/?h=icc-next&id=9038710161f0f028e36ef383fca59080f48420ee

Quoted 13 lines
---
 drivers/interconnect/qcom/icc-rpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/interconnect/qcom/icc-rpm.c +0 -0
index 4d0997b210f7..3b055cd893ea 100644

drivers/interconnect/qcom/icc-rpm.c int qnoc_probe(struct platform_device *pdev) · line 502

Quoted 6 lines
drivers/interconnect/qcom/icc-rpm.c +2 -1
@@ -498,7 +498,8 @@ int qnoc_probe(struct platform_device *pdev)
 
 	if (desc->has_bus_pd) {
 		ret = dev_pm_domain_attach(dev, true);
-		goto err_disable_clks;
+		if (ret)
+			goto err_disable_clks;

*wipes glasses*.. right..

Konrad

Quoted 3 lines
drivers/interconnect/qcom/icc-rpm.c +0 -0
 	}
 
 	provider = &qp->provider;
#3 lore raw
Quoted 9 lines · Konrad Dybcio
Quoted 5 lines · Johan Hovold

A recent commit broke interconnect provider registration for the msm8996 platform by accidentally removing a conditional when adding the missing clock disable in the power-domain lookup error path.

Fixes b6edcc7570b2 ("interconnect: qcom: rpm: fix probe PM domain error handling")

The hash seems to be different:

https://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc.git/commit/?h=icc-next&id=9038710161f0f028e36ef383fca59080f48420ee

Bah, thanks for catching that.

Georgi, can you change this to:

Fixes a8f1b7ca53c2 ("interconnect: qcom: rpm: fix probe PM domain error handling")

unless you decide to fold this fixup in?

Quoted 4 lines
Quoted 4 lines

Johan

#4 lore raw

PATCH 2/2 interconnect: qcom: rpm: drop bogus pm domain attach

In reply to Johan Hovold

Any power domain would already have been attached by the platform bus code so drop the bogus power domain attach which always succeeds from probe.

This effectively reverts commit 7de109c0abe9 ("interconnect: icc-rpm:
Add support for bus power domain").

Fixes 7de109c0abe9 ("interconnect: icc-rpm: Add support for bus power domain")
Cc Yassine Oudjana <[email protected]>
---
 drivers/interconnect/qcom/icc-rpm.c | 6 ------
 drivers/interconnect/qcom/icc-rpm.h | 1 -
 drivers/interconnect/qcom/msm8996.c | 1 -
 3 files changed, 8 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +0 -6
index 3b055cd893ea..c303ce22a7cd 100644
@@ -496,12 +496,6 @@ int qnoc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (desc->has_bus_pd) {
-		ret = dev_pm_domain_attach(dev, true);
-		if (ret)
-			goto err_disable_clks;
-	}
-
 	provider = &qp->provider;
 	provider->dev = dev;
 	provider->set = qcom_icc_set;
drivers/interconnect/qcom/icc-rpm.h +0 -1
index a49af844ab13..02257b0d3d5c 100644
@@ -91,7 +91,6 @@ struct qcom_icc_desc {
 	size_t num_nodes;
 	const char * const *clocks;
 	size_t num_clocks;
-	bool has_bus_pd;
 	enum qcom_icc_type type;
 	const struct regmap_config *regmap_cfg;
 	unsigned int qos_offset;
drivers/interconnect/qcom/msm8996.c +0 -1
index 25a1a32bc611..14efd2761b7a 100644
@@ -1823,7 +1823,6 @@ static const struct qcom_icc_desc msm8996_a0noc = {
 	.num_nodes = ARRAY_SIZE(a0noc_nodes),
 	.clocks = bus_a0noc_clocks,
 	.num_clocks = ARRAY_SIZE(bus_a0noc_clocks),
-	.has_bus_pd = true,
 	.regmap_cfg = &msm8996_a0noc_regmap_config
 };
 
Signature · 1 line
2.39.2
Tested-by Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] interconnect: qcom: rpm: drop bogus pm domain attach

Quoted 11 lines · Johan Hovold

Any power domain would already have been attached by the platform bus code so drop the bogus power domain attach which always succeeds from probe.

This effectively reverts commit 7de109c0abe9 ("interconnect: icc-rpm:
Add support for bus power domain").

Fixes 7de109c0abe9 ("interconnect: icc-rpm: Add support for bus power domain")
Cc Yassine Oudjana <[email protected]>

---

Running Friday's -next (so, without your cleanups):

cat /sys/kernel/debug/pm_genpd/aggre0_noc/current_state

Quoted 1 line

on

Removing the pd attach:

cat /sys/kernel/debug/pm_genpd/aggre0_noc/current_state

Quoted 1 line

on

Also removing the other consumer of this genpd, the simple-pm-bus hosting PCIe:

cat /sys/kernel/debug/pm_genpd/aggre0_noc/current_state

Quoted 1 line

on

So it looks like that's the case!

Konrad

Quoted 46 lines
 drivers/interconnect/qcom/icc-rpm.c | 6 ------
 drivers/interconnect/qcom/icc-rpm.h | 1 -
 drivers/interconnect/qcom/msm8996.c | 1 -
 3 files changed, 8 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +0 -6
index 3b055cd893ea..c303ce22a7cd 100644
@@ -496,12 +496,6 @@ int qnoc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (desc->has_bus_pd) {
-		ret = dev_pm_domain_attach(dev, true);
-		if (ret)
-			goto err_disable_clks;
-	}
-
 	provider = &qp->provider;
 	provider->dev = dev;
 	provider->set = qcom_icc_set;
drivers/interconnect/qcom/icc-rpm.h +0 -1
index a49af844ab13..02257b0d3d5c 100644
@@ -91,7 +91,6 @@ struct qcom_icc_desc {
 	size_t num_nodes;
 	const char * const *clocks;
 	size_t num_clocks;
-	bool has_bus_pd;
 	enum qcom_icc_type type;
 	const struct regmap_config *regmap_cfg;
 	unsigned int qos_offset;
drivers/interconnect/qcom/msm8996.c +0 -1
index 25a1a32bc611..14efd2761b7a 100644
@@ -1823,7 +1823,6 @@ static const struct qcom_icc_desc msm8996_a0noc = {
 	.num_nodes = ARRAY_SIZE(a0noc_nodes),
 	.clocks = bus_a0noc_clocks,
 	.num_clocks = ARRAY_SIZE(bus_a0noc_clocks),
-	.has_bus_pd = true,
 	.regmap_cfg = &msm8996_a0noc_regmap_config
 };
 
maintainer
#6 lore raw

Re: [PATCH 2/2] interconnect: qcom: rpm: drop bogus pm domain attach

In reply to Johan Hovold

Hi Johan,

Quoted 49 lines · Johan Hovold

Any power domain would already have been attached by the platform bus code so drop the bogus power domain attach which always succeeds from probe.

This effectively reverts commit 7de109c0abe9 ("interconnect: icc-rpm:
Add support for bus power domain").

Fixes 7de109c0abe9 ("interconnect: icc-rpm: Add support for bus power domain")
Cc Yassine Oudjana <[email protected]>
---
  drivers/interconnect/qcom/icc-rpm.c | 6 ------
  drivers/interconnect/qcom/icc-rpm.h | 1 -
  drivers/interconnect/qcom/msm8996.c | 1 -
  3 files changed, 8 deletions(-)

drivers/interconnect/qcom/icc-rpm.c

Quoted 1 line
drivers/interconnect/qcom/icc-rpm.c +0 -0

index 3b055cd893ea..c303ce22a7cd 100644

drivers/interconnect/qcom/icc-rpm.c +0 -6
@@ -496,12 +496,6 @@ int qnoc_probe(struct platform_device *pdev)
  	if (ret)
  		return ret;
 
-	if (desc->has_bus_pd) {
-		ret = dev_pm_domain_attach(dev, true);
-		if (ret)
-			goto err_disable_clks;
-	}
-
  	provider = &qp->provider;
  	provider->dev = dev;
  	provider->set = qcom_icc_set;
drivers/interconnect/qcom/icc-rpm.h +0 -1
index a49af844ab13..02257b0d3d5c 100644
@@ -91,7 +91,6 @@ struct qcom_icc_desc {
  	size_t num_nodes;
  	const char * const *clocks;
  	size_t num_clocks;
-	bool has_bus_pd;
  	enum qcom_icc_type type;
  	const struct regmap_config *regmap_cfg;
  	unsigned int qos_offset;
drivers/interconnect/qcom/msm8996.c +0 -0
index 25a1a32bc611..14efd2761b7a 100644

drivers/interconnect/qcom/msm8996.c static const struct qcom_icc_desc msm8996_a0noc = { · line 1828

Quoted 7 lines
drivers/interconnect/qcom/msm8996.c +0 -1
@@ -1823,7 +1823,6 @@ static const struct qcom_icc_desc msm8996_a0noc = {
  	.num_nodes = ARRAY_SIZE(a0noc_nodes),
  	.clocks = bus_a0noc_clocks,
  	.num_clocks = ARRAY_SIZE(bus_a0noc_clocks),
-	.has_bus_pd = true,
  	.regmap_cfg = &msm8996_a0noc_regmap_config
  };
 

To make it a complete revert, I'll fold this in:

drivers/interconnect/qcom/icc-rpm.c +0 -1
index 0badd2c75161..c80819557923 100644
@@ -11,7 +11,6 @@
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
-#include <linux/pm_domain.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 

Thanks,
Georgi

#7 lore raw

Re: [PATCH 2/2] interconnect: qcom: rpm: drop bogus pm domain attach

Quoted 21 lines · Georgi Djakov

Hi Johan,

Quoted 10 lines · Johan Hovold

Any power domain would already have been attached by the platform bus code so drop the bogus power domain attach which always succeeds from probe.

This effectively reverts commit 7de109c0abe9 ("interconnect: icc-rpm:
Add support for bus power domain").

Fixes 7de109c0abe9 ("interconnect: icc-rpm: Add support for bus power domain")
Cc Yassine Oudjana <[email protected]>

To make it a complete revert, I'll fold this in:

drivers/interconnect/qcom/icc-rpm.c +0 -0
index 0badd2c75161..c80819557923 100644

drivers/interconnect/qcom/icc-rpm.c line 15

Quoted 6 lines
drivers/interconnect/qcom/icc-rpm.c +0 -1
@@ -11,7 +11,6 @@
  #include <linux/of_device.h>
  #include <linux/of_platform.h>
  #include <linux/platform_device.h>
-#include <linux/pm_domain.h>
  #include <linux/regmap.h>
  #include <linux/slab.h>

Thanks for catching that!

Johan

maintainer
#8 lore raw
In reply to Johan Hovold

Hi Johan,

Thank you for all the fixes!

Quoted 4 lines · Johan Hovold

Christophe noticed that a recent patch adding a missing clock disable to one of the Qualcomm rpm driver error paths was broken. This would lead to the provider not being registered on msm8996 which is the only platform using this code path.

Thanks Christophe for catching this!

Quoted 3 lines

Turns out, however, that the power domain attach during probe is bogus and would always succeed as any power domain would already have been attached by the platform bus code.

Thanks Konrad for testing and confirming!

Quoted 6 lines

Georgi, the offending commit is currently in your icc-next (and local icc-fixes) branch. Perhaps you can fold in the fixup unless you prefer applying it on top.

The bogus PM domain lookup is redundant and confusing but should otherwise be benign so the removal could be applied to either branch.

Maybe then I'll just drop this:
interconnect: qcom: rpm: fix probe PM domain error handling
and apply this one instead:
interconnect: qcom: rpm: drop bogus pm domain attach

BR,
Georgi

Quoted 13 lines

Johan

Johan Hovold (2):
interconnect: qcom: rpm: fix msm8996 interconnect registration
interconnect: qcom: rpm: drop bogus pm domain attach

  drivers/interconnect/qcom/icc-rpm.c | 5 -----
  drivers/interconnect/qcom/icc-rpm.h | 1 -
  drivers/interconnect/qcom/msm8996.c | 1 -
  3 files changed, 7 deletions(-)
#9 lore raw
Quoted 11 lines · Georgi Djakov
Quoted 6 lines

Georgi, the offending commit is currently in your icc-next (and local icc-fixes) branch. Perhaps you can fold in the fixup unless you prefer applying it on top.

The bogus PM domain lookup is redundant and confusing but should otherwise be benign so the removal could be applied to either branch.

Maybe then I'll just drop this:
interconnect: qcom: rpm: fix probe PM domain error handling
and apply this one instead:
interconnect: qcom: rpm: drop bogus pm domain attach

Sure, that works too. Wasn't sure whether you preferred incremental fixes on top or not.

I've checked the end result in linux-next against my local branch and everything looks good.

Thanks for getting that sorted.

Johan