Message ID | 20221108081220.7070-1-rui.zhang@intel.com |
---|---|
State | Accepted |
Commit | be6abd3ed65678f8c7bd212808a9841785c2d5ca |
Headers | show |
Series | [1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit | expand |
On Tue, Nov 8, 2022 at 9:10 AM Zhang Rui <rui.zhang@intel.com> wrote: > > 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> > --- > 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(+) > > diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c > index ccd62358d4d0..f17fa5c81034 100644 > --- a/drivers/thermal/intel/intel_tcc_cooling.c > +++ b/drivers/thermal/intel/intel_tcc_cooling.c > @@ -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 = > -- Applied as 6.2 material along with the [2/2], thanks!
diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c index ccd62358d4d0..f17fa5c81034 100644 --- a/drivers/thermal/intel/intel_tcc_cooling.c +++ b/drivers/thermal/intel/intel_tcc_cooling.c @@ -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 =
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> --- 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(+)