[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240118120513.1018808-1-srinivas.pandruvada@linux.intel.com>
Date: Thu, 18 Jan 2024 04:05:13 -0800
From: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
To: rafael@...nel.org,
viresh.kumar@...aro.org
Cc: linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Subject: [PATCH] cpufreq: intel_pstate: Directly use stored ratios for max frequencies
Avoid unnecessary calculation for converting frequency to performance
ratio by using a scaling factor for the maximum non turbo and turbo
frequency. Here the driver already stored performance ratios for max
non turbo and turbo frequency by reading from MSR_HWP_CAPABILITIES.
Directly use those ratios without any calculations.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
---
drivers/cpufreq/intel_pstate.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2ca70b0b5fdc..6bbc21ca96e0 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2532,7 +2532,14 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu,
int freq;
freq = max_policy_perf * perf_ctl_scaling;
- max_policy_perf = DIV_ROUND_UP(freq, scaling);
+
+ if (freq == cpu->pstate.turbo_freq)
+ max_policy_perf = cpu->pstate.turbo_pstate;
+ else if (freq == cpu->pstate.max_freq)
+ max_policy_perf = cpu->pstate.max_pstate;
+ else
+ max_policy_perf = DIV_ROUND_UP(freq, scaling);
+
freq = min_policy_perf * perf_ctl_scaling;
min_policy_perf = DIV_ROUND_UP(freq, scaling);
}
--
2.40.1
Powered by blists - more mailing lists