Skip to content

Commit be6abd3

Browse files
zhang-ruirafaeljw
authored andcommitted
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. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 54d9135 commit be6abd3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/thermal/intel/intel_tcc_cooling.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define TCC_SHIFT 24
1515
#define TCC_MASK (0x3fULL<<24)
1616
#define TCC_PROGRAMMABLE BIT(30)
17+
#define TCC_LOCKED BIT(31)
1718

1819
static struct thermal_cooling_device *tcc_cdev;
1920

@@ -108,6 +109,15 @@ static int __init tcc_cooling_init(void)
108109
if (!(val & TCC_PROGRAMMABLE))
109110
return -ENODEV;
110111

112+
err = rdmsrl_safe(MSR_IA32_TEMPERATURE_TARGET, &val);
113+
if (err)
114+
return err;
115+
116+
if (val & TCC_LOCKED) {
117+
pr_info("TCC Offset locked\n");
118+
return -ENODEV;
119+
}
120+
111121
pr_info("Programmable TCC Offset detected\n");
112122

113123
tcc_cdev =

0 commit comments

Comments
 (0)