浏览代码

cpufreq: intel_pstate: Enable HWP by default

If the processor supports HWP, enable it by default without checking
for the cpu model. This will allow to enable HWP in all supported
processors without driver change.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Srinivas Pandruvada 9 年之前
父节点
当前提交
7791e4aa59
共有 1 个文件被更改,包括 22 次插入12 次删除
  1. 22 12
      drivers/cpufreq/intel_pstate.c

+ 22 - 12
drivers/cpufreq/intel_pstate.c

@@ -1400,6 +1400,11 @@ static inline bool intel_pstate_platform_pwr_mgmt_exists(void) { return false; }
 static inline bool intel_pstate_has_acpi_ppc(void) { return false; }
 static inline bool intel_pstate_has_acpi_ppc(void) { return false; }
 #endif /* CONFIG_ACPI */
 #endif /* CONFIG_ACPI */
 
 
+static const struct x86_cpu_id hwp_support_ids[] __initconst = {
+	{ X86_VENDOR_INTEL, 6, X86_MODEL_ANY, X86_FEATURE_HWP },
+	{}
+};
+
 static int __init intel_pstate_init(void)
 static int __init intel_pstate_init(void)
 {
 {
 	int cpu, rc = 0;
 	int cpu, rc = 0;
@@ -1409,17 +1414,16 @@ static int __init intel_pstate_init(void)
 	if (no_load)
 	if (no_load)
 		return -ENODEV;
 		return -ENODEV;
 
 
+	if (x86_match_cpu(hwp_support_ids) && !no_hwp) {
+		copy_cpu_funcs(&core_params.funcs);
+		hwp_active++;
+		goto hwp_cpu_matched;
+	}
+
 	id = x86_match_cpu(intel_pstate_cpu_ids);
 	id = x86_match_cpu(intel_pstate_cpu_ids);
 	if (!id)
 	if (!id)
 		return -ENODEV;
 		return -ENODEV;
 
 
-	/*
-	 * The Intel pstate driver will be ignored if the platform
-	 * firmware has its own power management modes.
-	 */
-	if (intel_pstate_platform_pwr_mgmt_exists())
-		return -ENODEV;
-
 	cpu_def = (struct cpu_defaults *)id->driver_data;
 	cpu_def = (struct cpu_defaults *)id->driver_data;
 
 
 	copy_pid_params(&cpu_def->pid_policy);
 	copy_pid_params(&cpu_def->pid_policy);
@@ -1428,17 +1432,20 @@ static int __init intel_pstate_init(void)
 	if (intel_pstate_msrs_not_valid())
 	if (intel_pstate_msrs_not_valid())
 		return -ENODEV;
 		return -ENODEV;
 
 
+hwp_cpu_matched:
+	/*
+	 * The Intel pstate driver will be ignored if the platform
+	 * firmware has its own power management modes.
+	 */
+	if (intel_pstate_platform_pwr_mgmt_exists())
+		return -ENODEV;
+
 	pr_info("Intel P-state driver initializing.\n");
 	pr_info("Intel P-state driver initializing.\n");
 
 
 	all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
 	all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
 	if (!all_cpu_data)
 	if (!all_cpu_data)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp) {
-		pr_info("intel_pstate: HWP enabled\n");
-		hwp_active++;
-	}
-
 	if (!hwp_active && hwp_only)
 	if (!hwp_active && hwp_only)
 		goto out;
 		goto out;
 
 
@@ -1449,6 +1456,9 @@ static int __init intel_pstate_init(void)
 	intel_pstate_debug_expose_params();
 	intel_pstate_debug_expose_params();
 	intel_pstate_sysfs_expose_params();
 	intel_pstate_sysfs_expose_params();
 
 
+	if (hwp_active)
+		pr_info("intel_pstate: HWP enabled\n");
+
 	return rc;
 	return rc;
 out:
 out:
 	get_online_cpus();
 	get_online_cpus();