public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit
@ 2022-11-08  8:12 Zhang Rui
  2022-11-08  8:12 ` [PATCH 2/2] thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S Zhang Rui
  2022-11-09 14:00 ` [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Rui @ 2022-11-08  8:12 UTC (permalink / raw)
  To: rjw, daniel.lezcano; +Cc: linux-pm, srinivas.pandruvada

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 =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S
  2022-11-08  8:12 [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Zhang Rui
@ 2022-11-08  8:12 ` Zhang Rui
  2022-11-09 14:00 ` [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2022-11-08  8:12 UTC (permalink / raw)
  To: rjw, daniel.lezcano; +Cc: linux-pm, srinivas.pandruvada

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

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/intel/intel_tcc_cooling.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c
index f17fa5c81034..ec66d32ab24f 100644
--- a/drivers/thermal/intel/intel_tcc_cooling.c
+++ b/drivers/thermal/intel/intel_tcc_cooling.c
@@ -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),
 	{}
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit
  2022-11-08  8:12 [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Zhang Rui
  2022-11-08  8:12 ` [PATCH 2/2] thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S Zhang Rui
@ 2022-11-09 14:00 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-11-09 14:00 UTC (permalink / raw)
  To: Zhang Rui; +Cc: rjw, daniel.lezcano, linux-pm, srinivas.pandruvada

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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-09 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08  8:12 [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Zhang Rui
2022-11-08  8:12 ` [PATCH 2/2] thermal/intel_tcc_cooling: Add TCC cooling support for RaptorLake-S Zhang Rui
2022-11-09 14:00 ` [PATCH 1/2] thermal/intel/intel_tcc_cooling: Detect TCC lock bit Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox