0004-cpufreq-intel_pstate-ITMT-support-for-overclocked-sy.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From a6e9d2e9ec1a81ff2b45a986bc320f28dc155f1d Mon Sep 17 00:00:00 2001
  2. From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  3. Date: Thu, 18 Nov 2021 21:18:01 -0800
  4. Subject: [PATCH 4/6] cpufreq: intel_pstate: ITMT support for overclocked
  5. system
  6. On systems with overclocking enabled, CPPC Highest Performance can be
  7. hard coded to 0xff. In this case even if we have cores with different
  8. highest performance, ITMT can't be enabled as the current implementation
  9. depends on CPPC Highest Performance.
  10. On such systems we can use MSR_HWP_CAPABILITIES maximum performance field
  11. when CPPC.Highest Performance is 0xff.
  12. Due to legacy reasons, we can't solely depend on MSR_HWP_CAPABILITIES as
  13. in some older systems CPPC Highest Performance is the only way to identify
  14. different performing cores.
  15. Reported-by: Michael Larabel <Michael@MichaelLarabel.com>
  16. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  17. ---
  18. drivers/cpufreq/intel_pstate.c | 10 ++++++++++
  19. 1 file changed, 10 insertions(+)
  20. diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
  21. index e15c3bc17a55..8a2c6b58b652 100644
  22. --- a/drivers/cpufreq/intel_pstate.c
  23. +++ b/drivers/cpufreq/intel_pstate.c
  24. @@ -335,6 +335,8 @@ static void intel_pstste_sched_itmt_work_fn(struct work_struct *work)
  25. static DECLARE_WORK(sched_itmt_work, intel_pstste_sched_itmt_work_fn);
  26. +#define CPPC_MAX_PERF U8_MAX
  27. +
  28. static void intel_pstate_set_itmt_prio(int cpu)
  29. {
  30. struct cppc_perf_caps cppc_perf;
  31. @@ -345,6 +347,14 @@ static void intel_pstate_set_itmt_prio(int cpu)
  32. if (ret)
  33. return;
  34. + /*
  35. + * On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff.
  36. + * In this case we can't use CPPC.highest_perf to enable ITMT.
  37. + * In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide.
  38. + */
  39. + if (cppc_perf.highest_perf == CPPC_MAX_PERF)
  40. + cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached));
  41. +
  42. /*
  43. * The priorities can be set regardless of whether or not
  44. * sched_set_itmt_support(true) has been called and it is valid to
  45. --
  46. 2.34.1