diff options
| -rw-r--r-- | drivers/cpufreq/cpufreq-dt-platdev.c | 2 | ||||
| -rw-r--r-- | drivers/cpufreq/intel_pstate.c | 53 |
2 files changed, 33 insertions, 22 deletions
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index bc97b6a4b1cf..7fcaf26e8f81 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c | |||
| @@ -26,6 +26,8 @@ static const struct of_device_id machines[] __initconst = { | |||
| 26 | { .compatible = "allwinner,sun8i-a83t", }, | 26 | { .compatible = "allwinner,sun8i-a83t", }, |
| 27 | { .compatible = "allwinner,sun8i-h3", }, | 27 | { .compatible = "allwinner,sun8i-h3", }, |
| 28 | 28 | ||
| 29 | { .compatible = "apm,xgene-shadowcat", }, | ||
| 30 | |||
| 29 | { .compatible = "arm,integrator-ap", }, | 31 | { .compatible = "arm,integrator-ap", }, |
| 30 | { .compatible = "arm,integrator-cp", }, | 32 | { .compatible = "arm,integrator-cp", }, |
| 31 | 33 | ||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 6acbd4af632e..f91c25718d16 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -857,13 +857,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = { | |||
| 857 | NULL, | 857 | NULL, |
| 858 | }; | 858 | }; |
| 859 | 859 | ||
| 860 | static void intel_pstate_hwp_set(const struct cpumask *cpumask) | 860 | static void intel_pstate_hwp_set(struct cpufreq_policy *policy) |
| 861 | { | 861 | { |
| 862 | int min, hw_min, max, hw_max, cpu, range, adj_range; | 862 | int min, hw_min, max, hw_max, cpu, range, adj_range; |
| 863 | struct perf_limits *perf_limits = limits; | 863 | struct perf_limits *perf_limits = limits; |
| 864 | u64 value, cap; | 864 | u64 value, cap; |
| 865 | 865 | ||
| 866 | for_each_cpu(cpu, cpumask) { | 866 | for_each_cpu(cpu, policy->cpus) { |
| 867 | int max_perf_pct, min_perf_pct; | 867 | int max_perf_pct, min_perf_pct; |
| 868 | struct cpudata *cpu_data = all_cpu_data[cpu]; | 868 | struct cpudata *cpu_data = all_cpu_data[cpu]; |
| 869 | s16 epp; | 869 | s16 epp; |
| @@ -949,7 +949,7 @@ skip_epp: | |||
| 949 | static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) | 949 | static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy) |
| 950 | { | 950 | { |
| 951 | if (hwp_active) | 951 | if (hwp_active) |
| 952 | intel_pstate_hwp_set(policy->cpus); | 952 | intel_pstate_hwp_set(policy); |
| 953 | 953 | ||
| 954 | return 0; | 954 | return 0; |
| 955 | } | 955 | } |
| @@ -968,19 +968,28 @@ static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy) | |||
| 968 | 968 | ||
| 969 | static int intel_pstate_resume(struct cpufreq_policy *policy) | 969 | static int intel_pstate_resume(struct cpufreq_policy *policy) |
| 970 | { | 970 | { |
| 971 | int ret; | ||
| 972 | |||
| 971 | if (!hwp_active) | 973 | if (!hwp_active) |
| 972 | return 0; | 974 | return 0; |
| 973 | 975 | ||
| 976 | mutex_lock(&intel_pstate_limits_lock); | ||
| 977 | |||
| 974 | all_cpu_data[policy->cpu]->epp_policy = 0; | 978 | all_cpu_data[policy->cpu]->epp_policy = 0; |
| 975 | 979 | ||
| 976 | return intel_pstate_hwp_set_policy(policy); | 980 | ret = intel_pstate_hwp_set_policy(policy); |
| 981 | |||
| 982 | mutex_unlock(&intel_pstate_limits_lock); | ||
| 983 | |||
| 984 | return ret; | ||
| 977 | } | 985 | } |
| 978 | 986 | ||
| 979 | static void intel_pstate_hwp_set_online_cpus(void) | 987 | static void intel_pstate_update_policies(void) |
| 980 | { | 988 | { |
| 981 | get_online_cpus(); | 989 | int cpu; |
| 982 | intel_pstate_hwp_set(cpu_online_mask); | 990 | |
| 983 | put_online_cpus(); | 991 | for_each_possible_cpu(cpu) |
| 992 | cpufreq_update_policy(cpu); | ||
| 984 | } | 993 | } |
| 985 | 994 | ||
| 986 | /************************** debugfs begin ************************/ | 995 | /************************** debugfs begin ************************/ |
| @@ -1018,10 +1027,6 @@ static void __init intel_pstate_debug_expose_params(void) | |||
| 1018 | struct dentry *debugfs_parent; | 1027 | struct dentry *debugfs_parent; |
| 1019 | int i = 0; | 1028 | int i = 0; |
| 1020 | 1029 | ||
| 1021 | if (hwp_active || | ||
| 1022 | pstate_funcs.get_target_pstate == get_target_pstate_use_cpu_load) | ||
| 1023 | return; | ||
| 1024 | |||
| 1025 | debugfs_parent = debugfs_create_dir("pstate_snb", NULL); | 1030 | debugfs_parent = debugfs_create_dir("pstate_snb", NULL); |
| 1026 | if (IS_ERR_OR_NULL(debugfs_parent)) | 1031 | if (IS_ERR_OR_NULL(debugfs_parent)) |
| 1027 | return; | 1032 | return; |
| @@ -1105,11 +1110,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, | |||
| 1105 | 1110 | ||
| 1106 | limits->no_turbo = clamp_t(int, input, 0, 1); | 1111 | limits->no_turbo = clamp_t(int, input, 0, 1); |
| 1107 | 1112 | ||
| 1108 | if (hwp_active) | ||
| 1109 | intel_pstate_hwp_set_online_cpus(); | ||
| 1110 | |||
| 1111 | mutex_unlock(&intel_pstate_limits_lock); | 1113 | mutex_unlock(&intel_pstate_limits_lock); |
| 1112 | 1114 | ||
| 1115 | intel_pstate_update_policies(); | ||
| 1116 | |||
| 1113 | return count; | 1117 | return count; |
| 1114 | } | 1118 | } |
| 1115 | 1119 | ||
| @@ -1134,11 +1138,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, | |||
| 1134 | limits->max_perf_pct); | 1138 | limits->max_perf_pct); |
| 1135 | limits->max_perf = div_ext_fp(limits->max_perf_pct, 100); | 1139 | limits->max_perf = div_ext_fp(limits->max_perf_pct, 100); |
| 1136 | 1140 | ||
| 1137 | if (hwp_active) | ||
| 1138 | intel_pstate_hwp_set_online_cpus(); | ||
| 1139 | |||
| 1140 | mutex_unlock(&intel_pstate_limits_lock); | 1141 | mutex_unlock(&intel_pstate_limits_lock); |
| 1141 | 1142 | ||
| 1143 | intel_pstate_update_policies(); | ||
| 1144 | |||
| 1142 | return count; | 1145 | return count; |
| 1143 | } | 1146 | } |
| 1144 | 1147 | ||
| @@ -1163,11 +1166,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, | |||
| 1163 | limits->min_perf_pct); | 1166 | limits->min_perf_pct); |
| 1164 | limits->min_perf = div_ext_fp(limits->min_perf_pct, 100); | 1167 | limits->min_perf = div_ext_fp(limits->min_perf_pct, 100); |
| 1165 | 1168 | ||
| 1166 | if (hwp_active) | ||
| 1167 | intel_pstate_hwp_set_online_cpus(); | ||
| 1168 | |||
| 1169 | mutex_unlock(&intel_pstate_limits_lock); | 1169 | mutex_unlock(&intel_pstate_limits_lock); |
| 1170 | 1170 | ||
| 1171 | intel_pstate_update_policies(); | ||
| 1172 | |||
| 1171 | return count; | 1173 | return count; |
| 1172 | } | 1174 | } |
| 1173 | 1175 | ||
| @@ -2153,8 +2155,12 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) | |||
| 2153 | if (per_cpu_limits) | 2155 | if (per_cpu_limits) |
| 2154 | perf_limits = cpu->perf_limits; | 2156 | perf_limits = cpu->perf_limits; |
| 2155 | 2157 | ||
| 2158 | mutex_lock(&intel_pstate_limits_lock); | ||
| 2159 | |||
| 2156 | intel_pstate_update_perf_limits(policy, perf_limits); | 2160 | intel_pstate_update_perf_limits(policy, perf_limits); |
| 2157 | 2161 | ||
| 2162 | mutex_unlock(&intel_pstate_limits_lock); | ||
| 2163 | |||
| 2158 | return 0; | 2164 | return 0; |
| 2159 | } | 2165 | } |
| 2160 | 2166 | ||
| @@ -2487,7 +2493,10 @@ hwp_cpu_matched: | |||
| 2487 | if (rc) | 2493 | if (rc) |
| 2488 | goto out; | 2494 | goto out; |
| 2489 | 2495 | ||
| 2490 | intel_pstate_debug_expose_params(); | 2496 | if (intel_pstate_driver == &intel_pstate && !hwp_active && |
| 2497 | pstate_funcs.get_target_pstate != get_target_pstate_use_cpu_load) | ||
| 2498 | intel_pstate_debug_expose_params(); | ||
| 2499 | |||
| 2491 | intel_pstate_sysfs_expose_params(); | 2500 | intel_pstate_sysfs_expose_params(); |
| 2492 | 2501 | ||
| 2493 | if (hwp_active) | 2502 | if (hwp_active) |
