arm64: zynqmp: Add thermal zones
Subsystems (2)
cover arm64: zynqmp: Add thermal zones
At the moment, the ZynqMP Analog Monitoring System (AMS) is only used sporadically. As it is built into the SoC and doesn't depend on external hardware, it can be exposed to userspace for all boards. Additionally, we can use it to implement thermal zones.
Sean Anderson (3):
arm64: zynqmp: Enable AMS for all boards
arm64: zynqmp: Expose AMS to userspace as HWMON
arm64: zynqmp: Add thermal zones
.../boot/dts/xilinx/zynqmp-sm-k26-revA.dts | 18 ---- .../boot/dts/xilinx/zynqmp-zcu100-revC.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu102-revA.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu104-revA.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu104-revC.dts | 4 - arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 101 +++++++++++++++++- 6 files changed, 100 insertions(+), 35 deletions(-)
Signature · 1 line
2.35.1.1320.gc452695387.dirty
PATCH 1/3 arm64: zynqmp: Enable AMS for all boards
The AMS does not rely on external hardware or features, so it can be enabled unconditionally.
---
arch/arm64/boot/dts/xilinx/zynqmp-sm-k26-revA.dts | 4 ---- arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts | 4 ---- arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts | 4 ---- arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts | 4 ---- arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts | 4 ---- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 1 - 6 files changed, 21 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp-sm-k26-revA.dts +0 -4
@@ -366,10 +366,6 @@ &gpio { "", "", "", ""; /* 170 - 173 */ }; -&xilinx_ams { - status = "okay"; -}; - &ams_ps { status = "okay"; };
arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts +0 -4
@@ -590,10 +590,6 @@ &watchdog0 { status = "okay"; }; -&xilinx_ams { - status = "okay"; -}; - &ams_ps { status = "okay"; };
arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts +0 -4
@@ -1027,10 +1027,6 @@ &watchdog0 { status = "okay"; }; -&xilinx_ams { - status = "okay"; -}; - &ams_ps { status = "okay"; };
arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts +0 -4
@@ -511,10 +511,6 @@ &watchdog0 { status = "okay"; }; -&xilinx_ams { - status = "okay"; -}; - &ams_ps { status = "okay"; };
arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts +0 -4
@@ -523,10 +523,6 @@ &watchdog0 { status = "okay"; }; -&xilinx_ams { - status = "okay"; -}; - &ams_ps { status = "okay"; };
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +0 -1
@@ -1157,7 +1157,6 @@ lpd_watchdog: watchdog@ff150000 { xilinx_ams: ams@ffa50000 { compatible = "xlnx,zynqmp-ams"; - status = "disabled"; interrupt-parent = <&gic>; interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; reg = <0x0 0xffa50000 0x0 0x800>;
Signature · 1 line
2.35.1.1320.gc452695387.dirty
PATCH 2/3 arm64: zynqmp: Expose AMS to userspace as HWMON
In reply to Sean AndersonExpose the AMS to userspace, allowing monitoring of internal voltages and temperatures. For compatibility, we keep the node name the same as on the SM-K26, and we keep the ZCU100 Rev C. around (since it is named differently).
---
arch/arm64/boot/dts/xilinx/zynqmp-sm-k26-revA.dts | 14 -------------- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp-sm-k26-revA.dts +0 -14
@@ -90,20 +90,6 @@ ds36-led { }; }; - ams { - compatible = "iio-hwmon"; - io-channels = <&xilinx_ams 0>, <&xilinx_ams 1>, <&xilinx_ams 2>, - <&xilinx_ams 3>, <&xilinx_ams 4>, <&xilinx_ams 5>, - <&xilinx_ams 6>, <&xilinx_ams 7>, <&xilinx_ams 8>, - <&xilinx_ams 9>, <&xilinx_ams 10>, <&xilinx_ams 11>, - <&xilinx_ams 12>, <&xilinx_ams 13>, <&xilinx_ams 14>, - <&xilinx_ams 15>, <&xilinx_ams 16>, <&xilinx_ams 17>, - <&xilinx_ams 18>, <&xilinx_ams 19>, <&xilinx_ams 20>, - <&xilinx_ams 21>, <&xilinx_ams 22>, <&xilinx_ams 23>, - <&xilinx_ams 24>, <&xilinx_ams 25>, <&xilinx_ams 26>, - <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; - }; - pwm-fan { compatible = "pwm-fan"; status = "okay";
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +14 -0
@@ -392,6 +392,20 @@ r5f@1 { }; }; + ams { + compatible = "iio-hwmon"; + io-channels = <&xilinx_ams 0>, <&xilinx_ams 1>, <&xilinx_ams 2>, + <&xilinx_ams 3>, <&xilinx_ams 4>, <&xilinx_ams 5>, + <&xilinx_ams 6>, <&xilinx_ams 7>, <&xilinx_ams 8>, + <&xilinx_ams 9>, <&xilinx_ams 10>, <&xilinx_ams 11>, + <&xilinx_ams 12>, <&xilinx_ams 13>, <&xilinx_ams 14>, + <&xilinx_ams 15>, <&xilinx_ams 16>, <&xilinx_ams 17>, + <&xilinx_ams 18>, <&xilinx_ams 19>, <&xilinx_ams 20>, + <&xilinx_ams 21>, <&xilinx_ams 22>, <&xilinx_ams 23>, + <&xilinx_ams 24>, <&xilinx_ams 25>, <&xilinx_ams 26>, + <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; + }; + amba: axi { compatible = "simple-bus"; bootph-all;
Signature · 1 line
2.35.1.1320.gc452695387.dirty
PATCH 3/3 arm64: zynqmp: Add thermal zones
In reply to Sean AndersonAdd some thermal trip points. We can't undervolt the CPUs to save power when we underclock them, so there isn't really a point in throttling them until we are about to overheat. As such, the passive trip point is right below the critical trip point.
The critical trip point is the extended/industrial-grade maximum junction temperature of 100C minus the maximum temperature sensor error of 3.5C (in the range -55C to 110C). Automotive- and military-grade parts can go up to 125C, but as far as I can tell there is no way to detect them at runtime. Userspace can adjust the trip points at runtime, but this may not be viable when booting above 100C. I think it's reasonable to ask automotive/military users to edit their device trees to bump the trip points, but if that proves to be an issue we can always go with no default temperatures. However, that wouldn't be too nice for the majority of extended/industrial users.
---
arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +86 -0
@@ -18,6 +18,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/power/xlnx-zynqmp-power.h> #include <dt-bindings/reset/xlnx-zynqmp-resets.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "xlnx,zynqmp";
@@ -36,6 +37,7 @@ cpus { #size-cells = <0>; cpu0: cpu@0 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";
@@ -46,6 +48,7 @@ cpu0: cpu@0 { }; cpu1: cpu@1 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";
@@ -56,6 +59,7 @@ cpu1: cpu@1 { }; cpu2: cpu@2 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";
@@ -66,6 +70,7 @@ cpu2: cpu@2 { }; cpu3: cpu@3 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";
@@ -406,6 +411,87 @@ ams { <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; }; + + tsens_apu: thermal-sensor-apu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 7>; + io-channel-names = "sensor-channel"; + }; + + tsens_rpu: thermal-sensor-rpu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 8>; + io-channel-names = "sensor-channel"; + }; + + tsens_pl: thermal-sensor-pl { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 20>; + io-channel-names = "sensor-channel"; + }; + + thermal-zones { + apu-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>; + thermal-sensors = <&tsens_apu>; + + trips { + apu_passive: passive { + temperature = <93000>; + hysteresis = <3500>; + type = "passive"; + }; + + apu_critical: critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&apu_passive>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + rpu-thermal { + polling-delay = <10000>; + thermal-sensors = <&tsens_rpu>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + }; + + pl-thermal { + polling-delay = <10000>; + thermal-sensors = <&tsens_pl>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + }; + }; + amba: axi { compatible = "simple-bus"; bootph-all;
Signature · 1 line
2.35.1.1320.gc452695387.dirty
Hi Sean,
Please find my review comments inline.
Thanks,
Senthil.
Quoted 98 lines
-----Original Message-----
From: Sean Anderson <[email protected]>
Sent: Monday, August 12, 2024 2:51 PM
To: Simek, Michal <[email protected]>; linux-arm- [email protected]
Cc: Rob Herring <[email protected]>; Conor Dooley <[email protected]>; Krzysztof Kozlowski <[email protected]>; [email protected]; [email protected]; Sean Anderson <[email protected]>
Subject: [PATCH 3/3] arm64: zynqmp: Add thermal zonesAdd some thermal trip points. We can't undervolt the CPUs to save power when we underclock them, so there isn't really a point in throttling them until we are about to overheat. As such, the passive trip point is right below the critical trip point.
The critical trip point is the extended/industrial-grade maximum junction temperature of 100C minus the maximum temperature sensor error of 3.5C (in the range -55C to 110C). Automotive- and military-grade parts can go up to 125C, but as far as I can tell there is no way to detect them at runtime. Userspace can adjust the trip points at runtime, but this may not be viable when booting above 100C. I think it's reasonable to ask automotive/military users to edit their device trees to bump the trip points, but if that proves to be an issue we can always go with no default temperatures. However, that wouldn't be too nice for the majority of extended/industrial users.
Signed-off-by Sean Anderson <[email protected]>---
arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+)arch/arm64/boot/dts/xilinx/zynqmp.dtsi +21
-0@@ -18,6 +18,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/power/xlnx-zynqmp-power.h> #include <dt-bindings/reset/xlnx-zynqmp-resets.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "xlnx,zynqmp";@@ -36,6 +37,7 @@ cpus { #size-cells = <0>; cpu0: cpu@0 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -46,6 +48,7 @@ cpu0: cpu@0 { }; cpu1: cpu@1 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -56,6 +59,7 @@ cpu1: cpu@1 { }; cpu2: cpu@2 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -66,6 +70,7 @@ cpu2: cpu@2 { }; cpu3: cpu@3 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -406,6 +411,87 @@ ams { <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; }; + + tsens_apu: thermal-sensor-apu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 7>; + io-channel-names = "sensor-channel"; + }; + + tsens_rpu: thermal-sensor-rpu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 8>; + io-channel-names = "sensor-channel"; + }; + + tsens_pl: thermal-sensor-pl {
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 440
Quoted 10 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +10
-0+ compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 20>; + io-channel-names = "sensor-channel"; + }; + + thermal-zones { + apu-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>;
How did we arrive at these delays, 1000 and 5000 ? could you please clarify ?
Quoted 28 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +23
-0+ thermal-sensors = <&tsens_apu>; + + trips { + apu_passive: passive { + temperature = <93000>; + hysteresis = <3500>; + type = "passive"; + }; + + apu_critical: critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&apu_passive>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>,arch/arm64/boot/dts/xilinx/zynqmp.dtsi +1
-0+ <&cpu3 THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>;
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 469
Quoted 6 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +6
-0+ }; + }; + }; + + rpu-thermal { + polling-delay = <10000>;
Same questions, how did we come up with number 10000
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 477
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +8
-0+ thermal-sensors = <&tsens_rpu>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + };
Any reason why we haven't defined for passive trip point for RPU ?
Quoted 4 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +4
-0+ }; + }; + + pl-thermal {
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 491
Quoted 10 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +10
-0+ polling-delay = <10000>; + thermal-sensors = <&tsens_pl>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + };
Same question, any reason why we haven't defined for passive trip point for PL ?
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +3
-1+ }; + }; + amba: axi { compatible = "simple-bus"; bootph-all; --2.35.1.1320.gc452695387.dirty
Quoted 109 lines · Senthil Nathan
Hi Sean,
Please find my review comments inline.
Thanks,
Senthil.Quoted 102 lines
-----Original Message-----
From: Sean Anderson <[email protected]>
Sent: Monday, August 12, 2024 2:51 PM
To: Simek, Michal <[email protected]>; linux-arm- [email protected]
Cc: Rob Herring <[email protected]>; Conor Dooley <[email protected]>; Krzysztof Kozlowski <[email protected]>; [email protected]; [email protected]; Sean Anderson <[email protected]>
Subject: [PATCH 3/3] arm64: zynqmp: Add thermal zonesAdd some thermal trip points. We can't undervolt the CPUs to save power when we underclock them, so there isn't really a point in throttling them until we are about to overheat. As such, the passive trip point is right below the critical trip point.
The critical trip point is the extended/industrial-grade maximum junction temperature of 100C minus the maximum temperature sensor error of 3.5C (in the range -55C to 110C). Automotive- and military-grade parts can go up to 125C, but as far as I can tell there is no way to detect them at runtime. Userspace can adjust the trip points at runtime, but this may not be viable when booting above 100C. I think it's reasonable to ask automotive/military users to edit their device trees to bump the trip points, but if that proves to be an issue we can always go with no default temperatures. However, that wouldn't be too nice for the majority of extended/industrial users.
Signed-off-by Sean Anderson <[email protected]>---
arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+)arch/arm64/boot/dts/xilinx/zynqmp.dtsi +25
-0@@ -18,6 +18,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/power/xlnx-zynqmp-power.h> #include <dt-bindings/reset/xlnx-zynqmp-resets.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "xlnx,zynqmp";@@ -36,6 +37,7 @@ cpus { #size-cells = <0>; cpu0: cpu@0 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -46,6 +48,7 @@ cpu0: cpu@0 { }; cpu1: cpu@1 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -56,6 +59,7 @@ cpu1: cpu@1 { }; cpu2: cpu@2 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -66,6 +70,7 @@ cpu2: cpu@2 { }; cpu3: cpu@3 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci";@@ -406,6 +411,87 @@ ams { <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; }; + + tsens_apu: thermal-sensor-apu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 7>; + io-channel-names = "sensor-channel"; + }; + + tsens_rpu: thermal-sensor-rpu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 8>; + io-channel-names = "sensor-channel"; + }; + + tsens_pl: thermal-sensor-pl { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 20>; + io-channel-names = "sensor-channel";
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 439
Quoted 6 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +6
-0+ }; + + thermal-zones { + apu-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>;How did we arrive at these delays, 1000 and 5000 ? could you please clarify ?
They're just arbitrary. Feel free to suggest other numbers. I could find no guidance on this matter (or anything else thermal-related).
Quoted 37 lines
Quoted 28 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +23
-0+ thermal-sensors = <&tsens_apu>; + + trips { + apu_passive: passive { + temperature = <93000>; + hysteresis = <3500>; + type = "passive"; + }; + + apu_critical: critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&apu_passive>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>,arch/arm64/boot/dts/xilinx/zynqmp.dtsi +1
-0+ <&cpu3 THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>;arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 469
Quoted 6 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +6
-0+ }; + }; + }; + + rpu-thermal { + polling-delay = <10000>;Same questions, how did we come up with number 10000
Quoted 10 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 477
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +8
-0+ thermal-sensors = <&tsens_rpu>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + };Any reason why we haven't defined for passive trip point for RPU ?
What is there to do? It is up to the RPU software to do something if the RPU is going to overheat. But the more-likely occurrence is that the APU is overheating and the heat is spreading to the RPU. In which case, the APU passive trip point will handle things.
Quoted 24 lines
Quoted 4 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +4
-0+ }; + }; + + pl-thermal {arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 491
Quoted 10 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +10
-0+ polling-delay = <10000>; + thermal-sensors = <&tsens_pl>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + };Same question, any reason why we haven't defined for passive trip point for PL ?
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +3
-1+ }; + }; + amba: axi { compatible = "simple-bus"; bootph-all; --2.35.1.1320.gc452695387.dirty
Hi Sean,
Thank you for your response.
Unfortunately, I’m not the right person to recommend the thermal polling delay. I’m looping Matthew into this thread for further assistance.
Hi Matthew,
Could you or your team please provide a recommendation on this?
Thanks,
Senthil
Quoted 218 lines
-----Original Message-----
From: Sean Anderson <[email protected]>
Sent: Tuesday, September 3, 2024 7:28 AM
To: Thangaraj, Senthil Nathan <[email protected]>; Simek, Michal <[email protected]>; [email protected]
Cc: Rob Herring <[email protected]>; Conor Dooley <[email protected]>; Krzysztof Kozlowski <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH 3/3] arm64: zynqmp: Add thermal zonesCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 27 lines · Senthil Nathan
Hi Sean,
Please find my review comments inline.
Thanks,
Senthil.Quoted 20 lines
-----Original Message-----
From: Sean Anderson <[email protected]>
Sent: Monday, August 12, 2024 2:51 PM
To: Simek, Michal <[email protected]>; linux-arm- [email protected]
Cc: Rob Herring <[email protected]>; Conor Dooley <[email protected]>; Krzysztof Kozlowski <[email protected]>; [email protected]; [email protected]; Sean Anderson <[email protected]>
Subject: [PATCH 3/3] arm64: zynqmp: Add thermal zonesAdd some thermal trip points. We can't undervolt the CPUs to save power when we underclock them, so there isn't really a point in throttling them until we are about to overheat. As such, the passive trip point is right below the critical trip point.
The critical trip point is the extended/industrial-grade maximum junction temperature of 100C minus the maximum temperature sensor error of 3.5C (in the range -55C to 110C). Automotive- and military-grade parts can go up to 125C, but as far as I can tell there is no
way to detect them at runtime.
Quoted 5 lines
Quoted 5 lines
Userspace can adjust the trip points at runtime, but this may not be viable when booting above 100C. I think it's reasonable to ask automotive/military users to edit their device trees to bump the trip points, but if that proves to be an issue we can always go with no default temperatures. However, that wouldn't be too nice for the majority
of extended/industrial users.
Quoted 78 lines
Quoted 78 lines
Signed-off-by Sean Anderson <[email protected]>---
arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+)arch/arm64/boot/dts/xilinx/zynqmp.dtsi +2
-0@@ -18,6 +18,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/power/xlnx-zynqmp-power.h> #include <dt-bindings/reset/xlnx-zynqmp-resets.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "xlnx,zynqmp";@@ -36,6 +37,7 @@ cpus { #size-cells = <0>; cpu0: cpu@0 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci"; @@ -46,6 +48,7 @@ cpu0:cpu@0 { }; cpu1: cpu@1 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci"; @@ -56,6 +59,7 @@ cpu1: cpu@1 { }; cpu2: cpu@2 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci"; @@ -66,6 +70,7 @@ cpu2: cpu@2 { }; cpu3: cpu@3 { + #cooling-cells = <2>; compatible = "arm,cortex-a53"; device_type = "cpu"; enable-method = "psci"; @@ -406,6 +411,87 @@ ams { <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; };arch/arm64/boot/dts/xilinx/zynqmp.dtsi +20
-0+ + tsens_apu: thermal-sensor-apu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 7>; + io-channel-names = "sensor-channel"; + }; + + tsens_rpu: thermal-sensor-rpu { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 8>; + io-channel-names = "sensor-channel"; + }; + + tsens_pl: thermal-sensor-pl { + compatible = "generic-adc-thermal"; + #thermal-sensor-cells = <0>; + io-channels = <&xilinx_ams 20>; + io-channel-names = "sensor-channel";Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 439
Quoted 6 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +6
-0+ }; + + thermal-zones { + apu-thermal { + polling-delay-passive = <1000>; + polling-delay = <5000>;How did we arrive at these delays, 1000 and 5000 ? could you please clarify
?
They're just arbitrary. Feel free to suggest other numbers. I could find no guidance on this matter (or anything else thermal-related).
Quoted 46 lines
Quoted 28 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +21
-0+ thermal-sensors = <&tsens_apu>; + + trips { + apu_passive: passive { + temperature = <93000>; + hysteresis = <3500>; + type = "passive"; + }; + + apu_critical: critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&apu_passive>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>,
+ <&cpu1THERMAL_NO_LIMITTHERMAL_NO_LIMIT>,
+ <&cpu2THERMAL_NO_LIMITTHERMAL_NO_LIMIT>,
+ <&cpu3THERMAL_NO_LIMITTHERMAL_NO_LIMIT>;arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 469
Quoted 6 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +6
-0+ }; + }; + }; + + rpu-thermal { + polling-delay = <10000>;Same questions, how did we come up with number 10000
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 477
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +8
-0+ thermal-sensors = <&tsens_rpu>; + + trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + };Quoted 1 line
Any reason why we haven't defined for passive trip point for RPU ?
What is there to do? It is up to the RPU software to do something if the RPU is going to overheat. But the more-likely occurrence is that the APU is overheating and the heat is spreading to the RPU. In which case, the APU passive trip point will handle things.
Quoted 7 lines
Quoted 7 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +7
-0+ }; + }; + + pl-thermal { + polling-delay = <10000>; + thermal-sensors = <&tsens_pl>; +Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi ams { · line 478
Quoted 7 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +7
-0+ trips { + critical { + temperature = <96500>; + hysteresis = <3500>; + type = "critical"; + }; + };Same question, any reason why we haven't defined for passive trip point for
PL ?
Quoted 9 lines
Quoted 8 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +3
-1+ }; + }; + amba: axi { compatible = "simple-bus"; bootph-all; --2.35.1.1320.gc452695387.dirty
Michal Simek
maintainerQuoted 9 lines · Senthil Nathan
Hi Sean,
Thank you for your response.
Unfortunately, I’m not the right person to recommend the thermal polling delay. I’m looping Matthew into this thread for further assistance.
Hi Matthew,
Could you or your team please provide a recommendation on this?
Any update on this? If not I will take merge it.
Thanks,
Michal
Quoted 11 lines · Sean Anderson
At the moment, the ZynqMP Analog Monitoring System (AMS) is only used sporadically. As it is built into the SoC and doesn't depend on external hardware, it can be exposed to userspace for all boards. Additionally, we can use it to implement thermal zones.
Sean Anderson (3):
arm64: zynqmp: Enable AMS for all boards
arm64: zynqmp: Expose AMS to userspace as HWMON
arm64: zynqmp: Add thermal zones
Quoted 8 lines
.../boot/dts/xilinx/zynqmp-sm-k26-revA.dts | 18 ---- .../boot/dts/xilinx/zynqmp-zcu100-revC.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu102-revA.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu104-revA.dts | 4 - .../boot/dts/xilinx/zynqmp-zcu104-revC.dts | 4 - arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 101 +++++++++++++++++- 6 files changed, 100 insertions(+), 35 deletions(-)
Applied.
M