Skip to contentSkip to conversation

thermal/intel/intel_tcc_cooling: Detect TCC lock bit

PATCH Applied Zhang Rui 2 participants 3 messages Nov 8, 2022 – Nov 9, 2022 Thermal

lore
Share & tools
lore

Zhang Rui

author reviewer
#0 lore raw

PATCH 1/2 thermal/intel/intel_tcc_cooling: Detect TCC lock bit

When MSR_IA32_TEMPERATURE_TARGET is locked, TCC Offset can not be updated even if the PROGRAMMABE Bit is set.

Yield the driver on platforms with MSR_IA32_TEMPERATURE_TARGET locked.

---
Note that this patch is made based on this patch series
https://patchwork.kernel.org/project/linux-pm/list/?series=693050

---
 drivers/thermal/intel/intel_tcc_cooling.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/thermal/intel/intel_tcc_cooling.c +10 -0
index ccd62358d4d0..f17fa5c81034 100644
@@ -13,6 +13,7 @@
 #include <asm/cpu_device_id.h>
 
 #define TCC_PROGRAMMABLE	BIT(30)
+#define TCC_LOCKED		BIT(31)
 
 static struct thermal_cooling_device *tcc_cdev;
 
@@ -80,6 +81,15 @@ static int __init tcc_cooling_init(void)
 	if (!(val & TCC_PROGRAMMABLE))
 		return -ENODEV;
 
+	err = rdmsrl_safe(MSR_IA32_TEMPERATURE_TARGET, &val);
+	if (err)
+		return err;
+
+	if (val & TCC_LOCKED) {
+		pr_info("TCC Offset locked\n");
+		return -ENODEV;
+	}
+
 	pr_info("Programmable TCC Offset detected\n");
 
 	tcc_cdev =
Signature · 1 line
2.25.1
author reviewer
#1 lore raw

PATCH 2/2 thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S

Add RaptorLake to the list of processor models supported by the Intel TCC cooling driver.

---
 drivers/thermal/intel/intel_tcc_cooling.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/intel/intel_tcc_cooling.c +1 -0
index f17fa5c81034..ec66d32ab24f 100644
@@ -57,6 +57,7 @@ static const struct x86_cpu_id tcc_ids[] __initconst = {
 	X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL),
 	X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL),
 	X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL),
+	X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, NULL),
 	{}
 };
 
Signature · 1 line
2.25.1
maintainer Applied
#2 lore raw
In reply to Zhang Rui
Quoted 33 lines · Zhang Rui

When MSR_IA32_TEMPERATURE_TARGET is locked, TCC Offset can not be updated even if the PROGRAMMABE Bit is set.

Yield the driver on platforms with MSR_IA32_TEMPERATURE_TARGET locked.

---
Note that this patch is made based on this patch series
https://patchwork.kernel.org/project/linux-pm/list/?series=693050

---
 drivers/thermal/intel/intel_tcc_cooling.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/thermal/intel/intel_tcc_cooling.c +4 -0
index ccd62358d4d0..f17fa5c81034 100644
@@ -13,6 +13,7 @@
 #include <asm/cpu_device_id.h>
 
 #define TCC_PROGRAMMABLE       BIT(30)
+#define TCC_LOCKED             BIT(31)
 
 static struct thermal_cooling_device *tcc_cdev;
 
@@ -80,6 +81,15 @@ static int __init tcc_cooling_init(void)
        if (!(val & TCC_PROGRAMMABLE))
                return -ENODEV;
 
+       err = rdmsrl_safe(MSR_IA32_TEMPERATURE_TARGET, &val);
+       if (err)
+               return err;

drivers/thermal/intel/intel_tcc_cooling.c static int __init tcc_cooling_init(void)

Quoted 10 lines
drivers/thermal/intel/intel_tcc_cooling.c +6 -1
+
+       if (val & TCC_LOCKED) {
+               pr_info("TCC Offset locked\n");
+               return -ENODEV;
+       }
+
        pr_info("Programmable TCC Offset detected\n");
 
        tcc_cdev =
--

Applied as 6.2 material along with the [2/2], thanks!