Skip to contentSkip to conversation

dt-bindings: cpufreq: Add big CPU supply

PATCH In review Nícolas F. R. A. Prado 5 participants 6 messages Dec 29, 2023 – Jan 9, 2024

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

PATCH 1/2 dt-bindings: cpufreq: Add big CPU supply

The performance-controller hardware block on MediaTek SoCs is responsible for controlling the frequency of the CPUs. As such, it needs any CPU regulator to have been configured prior to initializing. Add a phandle in the binding so this dependency can be described.

---

 .../devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml        | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml +2 -0
index d0aecde2b89b..d75b01d04998 100644
@@ -33,6 +33,8 @@ properties:
       performance domains.
     const: 1
 
+  big-cpus-supply: true
+
 required:
   - compatible
   - reg
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 arm64: dts: mediatek: cherry: Add CPU supply dependency to cpufreq-hw

When the mediatek-cpufreq-hw driver enables the hardware (by writing to REG_FREQ_ENABLE), if the regulator supplying the voltage to the big CPUs hasn't probed yet, the platform hangs shortly after and "rcu: INFO: rcu_preempt detected stalls on CPUs/tasks" are printed in the log.

To prevent this from happening, describe the big CPUs regulator in the performance-controller DT node, so that devlink ensures the regulator has been probed and configured before the frequency scaling hardware is probed and enabled.

---

 arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +4 -0
index dd5b89b73190..505da60eee90 100644
@@ -502,6 +502,10 @@ &pcie1 {
 	pinctrl-0 = <&pcie1_pins_default>;
 };
 
+&performance {
+	big-cpus-supply = <&mt6315_6_vbuck1>;
+};
+
 &pio {
 	mediatek,rsel-resistance-in-si-unit;
 	pinctrl-names = "default";
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 2/2] arm64: dts: mediatek: cherry: Add CPU supply dependency to cpufreq-hw

Quoted 23 lines · Nícolas F. R. A. Prado

When the mediatek-cpufreq-hw driver enables the hardware (by writing to REG_FREQ_ENABLE), if the regulator supplying the voltage to the big CPUs hasn't probed yet, the platform hangs shortly after and "rcu: INFO: rcu_preempt detected stalls on CPUs/tasks" are printed in the log.

To prevent this from happening, describe the big CPUs regulator in the performance-controller DT node, so that devlink ensures the regulator has been probed and configured before the frequency scaling hardware is probed and enabled.

---

 arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +0 -0
index dd5b89b73190..505da60eee90 100644

arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi &pcie1 { · line 511

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +4 -0
@@ -502,6 +502,10 @@ &pcie1 {
 	pinctrl-0 = <&pcie1_pins_default>;
 };
 
+&performance {
+	big-cpus-supply = <&mt6315_6_vbuck1>;
+};
+
 &pio {
 	mediatek,rsel-resistance-in-si-unit;
 	pinctrl-names = "default";

I think the regulator needs to be mentioned in the CPU's node and not here ?

Signature · 1 line
viresh
#3 lore raw

Re: [PATCH 2/2] arm64: dts: mediatek: cherry: Add CPU supply dependency to cpufreq-hw

Il 02/01/24 07:11, Viresh Kumar ha scritto:

Quoted 27 lines · Nícolas F. R. A. Prado
Quoted 26 lines

When the mediatek-cpufreq-hw driver enables the hardware (by writing to REG_FREQ_ENABLE), if the regulator supplying the voltage to the big CPUs hasn't probed yet, the platform hangs shortly after and "rcu: INFO: rcu_preempt detected stalls on CPUs/tasks" are printed in the log.

To prevent this from happening, describe the big CPUs regulator in the performance-controller DT node, so that devlink ensures the regulator has been probed and configured before the frequency scaling hardware is probed and enabled.

---

  arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +0 -0
index dd5b89b73190..505da60eee90 100644
@@ -502,6 +502,10 @@ &pcie1 {
  	pinctrl-0 = <&pcie1_pins_default>;
  };
 
Quoted 11 lines

arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi &pcie1 { · line 511

Quoted 7 lines
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +4 -0
+&performance {
+	big-cpus-supply = <&mt6315_6_vbuck1>;
+};
+
  &pio {
  	mediatek,rsel-resistance-in-si-unit;
  	pinctrl-names = "default";

I think the regulator needs to be mentioned in the CPU's node and not here ?

Even if the regulator voltage is being changed by firmware with cpufreq-hw, the actual regulators should go to each CPU node and not in the cpufreq driver node, I agree with Viresh.

Besides, that's the same thing that we're doing with mediatek-cpufreq as well... and since we're talking about that, we should also do something about this such that we stop declaring regulator-always-on for CPU cores in devicetree, but this is probably slightly out of context for what you're trying to do here, so, read that as an "extra consideration" :-)

Cheers,
Angelo

#4 lore raw
In reply to Nícolas F. R. A. Prado
Quoted 16 lines · Nícolas F. R. A. Prado

The performance-controller hardware block on MediaTek SoCs is responsible for controlling the frequency of the CPUs. As such, it needs any CPU regulator to have been configured prior to initializing. Add a phandle in the binding so this dependency can be described.

---

 .../devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml        | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml +0 -0
index d0aecde2b89b..d75b01d04998 100644

Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml properties: · line 36

Quoted 4 lines
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml +1 -0
@@ -33,6 +33,8 @@ properties:
       performance domains.
     const: 1
 
+  big-cpus-supply: true

Why big? Neither little nor medium need power? Why you do not need to provide all supplies?

About the naming, use something matching the devices, e.g. from their datasheet/manual.

Best regards,
Krzysztof

maintainer
#5 lore raw
In reply to Nícolas F. R. A. Prado
Quoted 16 lines · Nícolas F. R. A. Prado

The performance-controller hardware block on MediaTek SoCs is responsible for controlling the frequency of the CPUs. As such, it needs any CPU regulator to have been configured prior to initializing. Add a phandle in the binding so this dependency can be described.

---

 .../devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml        | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml +0 -0
index d0aecde2b89b..d75b01d04998 100644

Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml properties: · line 37

Quoted 5 lines
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml +2 -0
@@ -33,6 +33,8 @@ properties:
       performance domains.
     const: 1
 
+  big-cpus-supply: true
+

A CPU's supply belongs in the respective CPU nodes.

Rob