]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.133/cpufreq-intel_pstate-enable-hwp-by-default.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.4.133 / cpufreq-intel_pstate-enable-hwp-by-default.patch
1 From 7791e4aa59ad724e0b4c8b4dea547a5735108972 Mon Sep 17 00:00:00 2001
2 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
3 Date: Thu, 25 Feb 2016 15:09:19 -0800
4 Subject: cpufreq: intel_pstate: Enable HWP by default
5
6 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
7
8 commit 7791e4aa59ad724e0b4c8b4dea547a5735108972 upstream.
9
10 If the processor supports HWP, enable it by default without checking
11 for the cpu model. This will allow to enable HWP in all supported
12 processors without driver change.
13
14 Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
15 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
16 Signed-off-by: Thomas Renninger <trenn@suse.de>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 drivers/cpufreq/intel_pstate.c | 34 ++++++++++++++++++++++------------
21 1 file changed, 22 insertions(+), 12 deletions(-)
22
23 --- a/drivers/cpufreq/intel_pstate.c
24 +++ b/drivers/cpufreq/intel_pstate.c
25 @@ -1361,6 +1361,11 @@ static inline bool intel_pstate_platform
26 static inline bool intel_pstate_has_acpi_ppc(void) { return false; }
27 #endif /* CONFIG_ACPI */
28
29 +static const struct x86_cpu_id hwp_support_ids[] __initconst = {
30 + { X86_VENDOR_INTEL, 6, X86_MODEL_ANY, X86_FEATURE_HWP },
31 + {}
32 +};
33 +
34 static int __init intel_pstate_init(void)
35 {
36 int cpu, rc = 0;
37 @@ -1370,17 +1375,16 @@ static int __init intel_pstate_init(void
38 if (no_load)
39 return -ENODEV;
40
41 + if (x86_match_cpu(hwp_support_ids) && !no_hwp) {
42 + copy_cpu_funcs(&core_params.funcs);
43 + hwp_active++;
44 + goto hwp_cpu_matched;
45 + }
46 +
47 id = x86_match_cpu(intel_pstate_cpu_ids);
48 if (!id)
49 return -ENODEV;
50
51 - /*
52 - * The Intel pstate driver will be ignored if the platform
53 - * firmware has its own power management modes.
54 - */
55 - if (intel_pstate_platform_pwr_mgmt_exists())
56 - return -ENODEV;
57 -
58 cpu_def = (struct cpu_defaults *)id->driver_data;
59
60 copy_pid_params(&cpu_def->pid_policy);
61 @@ -1389,17 +1393,20 @@ static int __init intel_pstate_init(void
62 if (intel_pstate_msrs_not_valid())
63 return -ENODEV;
64
65 +hwp_cpu_matched:
66 + /*
67 + * The Intel pstate driver will be ignored if the platform
68 + * firmware has its own power management modes.
69 + */
70 + if (intel_pstate_platform_pwr_mgmt_exists())
71 + return -ENODEV;
72 +
73 pr_info("Intel P-state driver initializing.\n");
74
75 all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
76 if (!all_cpu_data)
77 return -ENOMEM;
78
79 - if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp) {
80 - pr_info("intel_pstate: HWP enabled\n");
81 - hwp_active++;
82 - }
83 -
84 if (!hwp_active && hwp_only)
85 goto out;
86
87 @@ -1410,6 +1417,9 @@ static int __init intel_pstate_init(void
88 intel_pstate_debug_expose_params();
89 intel_pstate_sysfs_expose_params();
90
91 + if (hwp_active)
92 + pr_info("intel_pstate: HWP enabled\n");
93 +
94 return rc;
95 out:
96 get_online_cpus();