Skip to content

Commit

Permalink
thermal: intel: intel_tcc_cooling: Detect TCC lock bit
Browse files Browse the repository at this point in the history
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 <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Zhang Rui authored and Rafael J. Wysocki committed Nov 9, 2022
1 parent 54d9135 commit be6abd3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/thermal/intel/intel_tcc_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define TCC_SHIFT 24
#define TCC_MASK (0x3fULL<<24)
#define TCC_PROGRAMMABLE BIT(30)
#define TCC_LOCKED BIT(31)

static struct thermal_cooling_device *tcc_cdev;

Expand Down Expand Up @@ -108,6 +109,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 =
Expand Down

0 comments on commit be6abd3

Please sign in to comment.