Skip to content

Commit a45ee4d

Browse files
committed
cpufreq: intel_pstate: Change intel_pstate_get_hwp_max() argument
All of the callers of intel_pstate_get_hwp_max() access the struct cpudata object that corresponds to the given CPU already and the function itself needs to access that object (in order to update hwp_cap_cached), so modify the code to pass a struct cpudata pointer to it instead of the CPU number. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com>
1 parent 9dd04ec commit a45ee4d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎drivers/cpufreq/intel_pstate.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = {
819819
NULL,
820820
};
821821

822-
static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max,
822+
static void intel_pstate_get_hwp_max(struct cpudata *cpu, int *phy_max,
823823
int *current_max)
824824
{
825825
u64 cap;
826826

827-
rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
828-
WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap);
827+
rdmsrl_on_cpu(cpu->cpu, MSR_HWP_CAPABILITIES, &cap);
828+
WRITE_ONCE(cpu->hwp_cap_cached, cap);
829829
if (global.no_turbo || global.turbo_disabled)
830830
*current_max = HWP_GUARANTEED_PERF(cap);
831831
else
@@ -1213,7 +1213,7 @@ static void update_qos_request(enum freq_qos_req_type type)
12131213
continue;
12141214

12151215
if (hwp_active)
1216-
intel_pstate_get_hwp_max(i, &turbo_max, &max_state);
1216+
intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state);
12171217
else
12181218
turbo_max = cpu->pstate.turbo_pstate;
12191219

@@ -1723,7 +1723,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
17231723
if (hwp_active && !hwp_mode_bdw) {
17241724
unsigned int phy_max, current_max;
17251725

1726-
intel_pstate_get_hwp_max(cpu->cpu, &phy_max, &current_max);
1726+
intel_pstate_get_hwp_max(cpu, &phy_max, &current_max);
17271727
cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
17281728
cpu->pstate.turbo_pstate = phy_max;
17291729
} else {
@@ -2208,7 +2208,7 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu,
22082208
* rather than pure ratios.
22092209
*/
22102210
if (hwp_active) {
2211-
intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state);
2211+
intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state);
22122212
} else {
22132213
max_state = global.no_turbo || global.turbo_disabled ?
22142214
cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
@@ -2323,7 +2323,7 @@ static void intel_pstate_verify_cpu_policy(struct cpudata *cpu,
23232323
if (hwp_active) {
23242324
int max_state, turbo_max;
23252325

2326-
intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state);
2326+
intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state);
23272327
max_freq = max_state * cpu->pstate.scaling;
23282328
} else {
23292329
max_freq = intel_pstate_get_max_freq(cpu);
@@ -2710,7 +2710,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy)
27102710
if (hwp_active) {
27112711
u64 value;
27122712

2713-
intel_pstate_get_hwp_max(policy->cpu, &turbo_max, &max_state);
2713+
intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state);
27142714
policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP;
27152715
rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value);
27162716
WRITE_ONCE(cpu->hwp_req_cached, value);

0 commit comments

Comments
 (0)