Skip to contentSkip to conversation

thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature

PATCH Applied Zhang Rui 2 participants 2 messages May 19, 2025 Thermal

lore
Share & tools
lore

Zhang Rui

author reviewer
#0 lore raw

PATCH 1/1 thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature

The tj_max value obtained from the Intel TCC library are in Celsius, whereas the thermal subsystem operates in milli-Celsius. This discrepancy leads to incorrect trip temperature calculations.

Fix bogus trip temperature by converting tj_max to milli-Celsius Unit.

---
Commit 983eb370cb87 ("thermal/x86_pkg_temp_thermal: Use Intel TCC library") converts tj_max to use the standard API without switching the Unit, which is a bug. This was mitigated by the next commit 58374a3970a0 ("thermal/x86_pkg_temp_thermal: Add support for handling dynamic tjmax") which uses the Celsius tj_max for failure check only.

This may confuse the maintainer and the bug was introduced by commit 8ef0ca4a177d ("Merge back other thermal control material for 6.3."), when addressing the conflicts with commit d3ecaf17b586 ("thermal/drivers/intel: Use generic thermal_zone_get_trip() function").

---
 drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/intel/x86_pkg_temp_thermal.c +1 -0
index 4894a26b1e4e..3fc679b6f11b 100644
@@ -330,6 +330,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
 	tj_max = intel_tcc_get_tjmax(cpu);
 	if (tj_max < 0)
 		return tj_max;
+	tj_max *= 1000;
 
 	zonedev = kzalloc(sizeof(*zonedev), GFP_KERNEL);
 	if (!zonedev)
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 32 lines · Zhang Rui

The tj_max value obtained from the Intel TCC library are in Celsius, whereas the thermal subsystem operates in milli-Celsius. This discrepancy leads to incorrect trip temperature calculations.

Fix bogus trip temperature by converting tj_max to milli-Celsius Unit.

---
Commit 983eb370cb87 ("thermal/x86_pkg_temp_thermal: Use Intel TCC library") converts tj_max to use the standard API without switching the Unit, which is a bug. This was mitigated by the next commit 58374a3970a0 ("thermal/x86_pkg_temp_thermal: Add support for handling dynamic tjmax") which uses the Celsius tj_max for failure check only.

This may confuse the maintainer and the bug was introduced by commit 8ef0ca4a177d ("Merge back other thermal control material for 6.3."), when addressing the conflicts with commit d3ecaf17b586 ("thermal/drivers/intel: Use generic thermal_zone_get_trip() function").

---
 drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/intel/x86_pkg_temp_thermal.c +0 -0
index 4894a26b1e4e..3fc679b6f11b 100644

drivers/thermal/intel/x86_pkg_temp_thermal.c static int pkg_temp_thermal_device_add(unsigned int cpu)

Quoted 8 lines
drivers/thermal/intel/x86_pkg_temp_thermal.c +1 -1
@@ -330,6 +330,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
        tj_max = intel_tcc_get_tjmax(cpu);
        if (tj_max < 0)
                return tj_max;
+       tj_max *= 1000;
 
        zonedev = kzalloc(sizeof(*zonedev), GFP_KERNEL);
        if (!zonedev)
--

Applied as 6.15-rc material, thanks!