From: Wei Wang Subject: [PATCH v3 08/11] x86/intel_pstate: add a booting param to select the driver to load Date: Thu, 11 Jun 2015 16:28:26 +0800 Message-ID: <1434011306-17498-1-git-send-email-wei.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, jbeulich@suse.com Cc: andrew.cooper3@citrix.com, Wei Wang List-Id: xen-devel@lists.xenproject.org By default, the old P-state driver (acpi-freq) is used. Adding "intel_pstate" to the Xen booting param list to enable the use of intel_pstate. However, if intel_pstate is enabled on a machine which does not support the driver (e.g. Nehalem), the old P-state driver will be loaded due to the failure loading of intel_pstate. Signed-off-by: Wei Wang --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +++++--- xen/arch/x86/acpi/cpufreq/intel_pstate.c | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index fa3678d..3765fc4 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -650,9 +650,11 @@ static int __init cpufreq_driver_init(void) int ret = 0; if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) - ret = cpufreq_register_driver(&acpi_cpufreq_driver); - else if ((cpufreq_controller == FREQCTL_xen) && + (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) { + ret = intel_pstate_init(); + if (ret) + ret = cpufreq_register_driver(&acpi_cpufreq_driver); + } else if ((cpufreq_controller == FREQCTL_xen) && (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) ret = powernow_register_driver(); diff --git a/xen/arch/x86/acpi/cpufreq/intel_pstate.c b/xen/arch/x86/acpi/cpufreq/intel_pstate.c index 48bbc30..d1a6056 100644 --- a/xen/arch/x86/acpi/cpufreq/intel_pstate.c +++ b/xen/arch/x86/acpi/cpufreq/intel_pstate.c @@ -749,6 +749,9 @@ static struct cpufreq_driver intel_pstate_driver = { .name = "intel_pstate", }; +static bool_t __initdata load_intel_pstate; +boolean_param("intel_pstate", load_intel_pstate); + static int intel_pstate_msrs_not_valid(void) { if (!pstate_funcs.get_max() || @@ -785,6 +788,9 @@ int __init intel_pstate_init(void) const struct x86_cpu_id *id; struct cpu_defaults *cpu_info; + if (!load_intel_pstate) + return -ENODEV; + id = x86_match_cpu(intel_pstate_cpu_ids); if (!id) return -ENODEV; -- 1.9.1