diff mbox series

[09/10] arm64: tegra: Rework SOCTHERM on Tegra132 and Tegra210

Message ID 20230414125721.1043589-10-thierry.reding@gmail.com
State Superseded
Headers show
Series thermal: tegra: Do not register cooling device | expand

Commit Message

Thierry Reding April 14, 2023, 12:57 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

The "heavy throttle" cooling device that SOCTHERM uses isn't a cooling
device in the traditional sense. It's an automatic mechanism that cannot
be actively controlled. Do not expose it as a cooling device and instead
of tying it to a specific trip point, hard-code the temperature at which
the automatic throttling will begin.

While at it, clean up the trip point names to reflect the names used by
the thermal device tree bindings.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra132.dtsi | 63 +++++-------------
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 83 +++++++-----------------
 2 files changed, 39 insertions(+), 107 deletions(-)

Comments

Thierry Reding April 17, 2023, 9:06 a.m. UTC | #1
On Mon, Apr 17, 2023 at 10:15:11AM +0200, Daniel Lezcano wrote:
> On 14/04/2023 14:57, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > The "heavy throttle" cooling device that SOCTHERM uses isn't a cooling
> > device in the traditional sense. It's an automatic mechanism that cannot
> > be actively controlled. Do not expose it as a cooling device and instead
> > of tying it to a specific trip point, hard-code the temperature at which
> > the automatic throttling will begin.
> > 
> > While at it, clean up the trip point names to reflect the names used by
> > the thermal device tree bindings.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >   arch/arm64/boot/dts/nvidia/tegra132.dtsi | 63 +++++-------------
> >   arch/arm64/boot/dts/nvidia/tegra210.dtsi | 83 +++++++-----------------
> >   2 files changed, 39 insertions(+), 107 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
> > index 8b78be8f4f9d..11ebf7517df1 100644
> > --- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi
> > +++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
> > @@ -876,11 +876,10 @@ soctherm: thermal-sensor@700e2000 {
> >   		#thermal-sensor-cells = <1>;
> >   		throttle-cfgs {
> > -			throttle_heavy: heavy {
> > +			heavy {
> >   				nvidia,priority = <100>;
> >   				nvidia,cpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
> > -
> > -				#cooling-cells = <2>;
> > +				temperature = <102000>;
> >   			};
> >   		};
> >   	};
> > @@ -1136,114 +1135,84 @@ cpu-thermal {
> >   			polling-delay-passive = <1000>;
> >   			polling-delay = <0>;
> > -			thermal-sensors =
> > -				<&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
> > +			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
> >   			trips {
> > -				cpu_shutdown_trip {
> > +				critical {
> >   					temperature = <105000>;
> >   					hysteresis = <1000>;
> >   					type = "critical";
> >   				};
> > -				cpu_throttle_trip: throttle-trip {
> > +				hot {
> >   					temperature = <102000>;
> >   					hysteresis = <1000>;
> >   					type = "hot";
> >   				};
> >   			};
> > -
> > -			cooling-maps {
> > -				map0 {
> > -					trip = <&cpu_throttle_trip>;
> > -					cooling-device = <&throttle_heavy 1 1>;
> > -				};
> > -			};
> 
> If the hardware mitigation is 'heavy', don't you want to have DVFS acting
> before hardware throttling ?

The throttling here is in fact some form of DVFS, but yes, generally we
would likely want to have additional forms of DVFS before we reach this
state. We could add CPU cooling devices and there's also a mechanism to
throttle the DRAM frequency on certain boards.

But those are mostly orthogonal to this series. The goal here is to get
rid of the throttling mechanism as a cooling device.

Thierry
Daniel Lezcano April 17, 2023, 9:15 a.m. UTC | #2
On 17/04/2023 11:06, Thierry Reding wrote:

[ ... ]

>>
>> If the hardware mitigation is 'heavy', don't you want to have DVFS acting
>> before hardware throttling ?
> 
> The throttling here is in fact some form of DVFS, but yes, generally we
> would likely want to have additional forms of DVFS before we reach this
> state. We could add CPU cooling devices and there's also a mechanism to
> throttle the DRAM frequency on certain boards.
> 
> But those are mostly orthogonal to this series. The goal here is to get
> rid of the throttling mechanism as a cooling device.

Right, thanks
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
index 8b78be8f4f9d..11ebf7517df1 100644
--- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi
@@ -876,11 +876,10 @@  soctherm: thermal-sensor@700e2000 {
 		#thermal-sensor-cells = <1>;
 
 		throttle-cfgs {
-			throttle_heavy: heavy {
+			heavy {
 				nvidia,priority = <100>;
 				nvidia,cpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
-
-				#cooling-cells = <2>;
+				temperature = <102000>;
 			};
 		};
 	};
@@ -1136,114 +1135,84 @@  cpu-thermal {
 			polling-delay-passive = <1000>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
 
 			trips {
-				cpu_shutdown_trip {
+				critical {
 					temperature = <105000>;
 					hysteresis = <1000>;
 					type = "critical";
 				};
 
-				cpu_throttle_trip: throttle-trip {
+				hot {
 					temperature = <102000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&cpu_throttle_trip>;
-					cooling-device = <&throttle_heavy 1 1>;
-				};
-			};
 		};
 
 		mem-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_MEM>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_MEM>;
 
 			trips {
-				mem_shutdown_trip {
+				critical {
 					temperature = <101000>;
 					hysteresis = <1000>;
 					type = "critical";
 				};
-				mem_throttle_trip {
+
+				hot {
 					temperature = <99000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				/*
-				 * There are currently no cooling maps,
-				 * because there are no cooling devices.
-				 */
-			};
 		};
 
 		gpu-thermal {
 			polling-delay-passive = <1000>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_GPU>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_GPU>;
 
 			trips {
-				gpu_shutdown_trip {
+				critical {
 					temperature = <101000>;
 					hysteresis = <1000>;
 					type = "critical";
 				};
 
-				gpu_throttle_trip: throttle-trip {
+				hot {
 					temperature = <99000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_throttle_trip>;
-					cooling-device = <&throttle_heavy 1 1>;
-				};
-			};
 		};
 
 		pllx-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_PLLX>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_PLLX>;
 
 			trips {
-				pllx_shutdown_trip {
+				critical {
 					temperature = <105000>;
 					hysteresis = <1000>;
 					type = "critical";
 				};
-				pllx_throttle_trip {
+
+				hot {
 					temperature = <99000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				/*
-				 * There are currently no cooling maps,
-				 * because there are no cooling devices.
-				 */
-			};
 		};
 	};
 
diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 0e463b3cbe01..af5460c74184 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -1331,12 +1331,11 @@  soctherm: thermal-sensor@700e2000 {
 		#thermal-sensor-cells = <1>;
 
 		throttle-cfgs {
-			throttle_heavy: heavy {
+			heavy {
 				nvidia,priority = <100>;
 				nvidia,cpu-throt-percent = <85>;
 				nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
-
-				#cooling-cells = <2>;
+				temperature = <98500>;
 			};
 		};
 	};
@@ -2032,73 +2031,53 @@  cpu-thermal {
 			polling-delay-passive = <1000>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
 
 			trips {
-				cpu-shutdown-trip {
+				critical {
 					temperature = <102500>;
 					hysteresis = <0>;
 					type = "critical";
 				};
 
-				cpu_throttle_trip: throttle-trip {
+				hot {
 					temperature = <98500>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&cpu_throttle_trip>;
-					cooling-device = <&throttle_heavy 1 1>;
-				};
-			};
 		};
 
 		mem-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_MEM>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_MEM>;
 
 			trips {
-				dram_nominal: mem-nominal-trip {
-					temperature = <50000>;
-					hysteresis = <1000>;
-					type = "passive";
-				};
-
-				dram_throttle: mem-throttle-trip {
-					temperature = <70000>;
-					hysteresis = <1000>;
-					type = "active";
+				critical {
+					temperature = <103000>;
+					hysteresis = <0>;
+					type = "critical";
 				};
 
-				mem-hot-trip {
+				hot {
 					temperature = <100000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 
-				mem-shutdown-trip {
-					temperature = <103000>;
-					hysteresis = <0>;
-					type = "critical";
+				emc_throttle_trip: passive {
+					temperature = <95000>;
+					hysteresis = <2000>;
+					type = "passive";
 				};
 			};
 
 			cooling-maps {
-				dram-passive {
-					cooling-device = <&emc 0 0>;
-					trip = <&dram_nominal>;
-				};
-
-				dram-active {
+				passive {
 					cooling-device = <&emc 1 1>;
-					trip = <&dram_throttle>;
+					trip = <&emc_throttle_trip>;
 				};
 			};
 		};
@@ -2107,58 +2086,42 @@  gpu-thermal {
 			polling-delay-passive = <1000>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_GPU>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_GPU>;
 
 			trips {
-				gpu-shutdown-trip {
+				critical {
 					temperature = <103000>;
 					hysteresis = <0>;
 					type = "critical";
 				};
 
-				gpu_throttle_trip: throttle-trip {
+				hot {
 					temperature = <100000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				map0 {
-					trip = <&gpu_throttle_trip>;
-					cooling-device = <&throttle_heavy 1 1>;
-				};
-			};
 		};
 
 		pllx-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 
-			thermal-sensors =
-				<&soctherm TEGRA124_SOCTHERM_SENSOR_PLLX>;
+			thermal-sensors = <&soctherm TEGRA124_SOCTHERM_SENSOR_PLLX>;
 
 			trips {
-				pllx-shutdown-trip {
+				critical {
 					temperature = <103000>;
 					hysteresis = <0>;
 					type = "critical";
 				};
 
-				pllx-throttle-trip {
+				hot {
 					temperature = <100000>;
 					hysteresis = <1000>;
 					type = "hot";
 				};
 			};
-
-			cooling-maps {
-				/*
-				 * There are currently no cooling maps,
-				 * because there are no cooling devices.
-				 */
-			};
 		};
 	};