Re: [PATCH] cpufreq/intel_pstate: Load only on Intel hardware

From: Rafael J. Wysocki
Date: Tue Apr 02 2019 - 04:41:01 EST


On Monday, April 1, 2019 5:03:45 PM CEST Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> This driver is Intel-only so loading on anything which is not Intel is
> pointless. Prevent it from doing so.
>
> While at it, correct the "not supported" print statement to say CPU
> "model" which is what that test does.
>
> Suggested-by: Erwan Velu <e.velu@xxxxxxxxxx>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> Cc: Len Brown <lenb@xxxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> CC: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> drivers/cpufreq/intel_pstate.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index b599c7318aab..2986119dd31f 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -2596,6 +2596,9 @@ static int __init intel_pstate_init(void)
> const struct x86_cpu_id *id;
> int rc;
>
> + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
> + return -ENODEV;
> +
> if (no_load)
> return -ENODEV;
>
> @@ -2611,7 +2614,7 @@ static int __init intel_pstate_init(void)
> } else {
> id = x86_match_cpu(intel_pstate_cpu_ids);
> if (!id) {
> - pr_info("CPU ID not supported\n");
> + pr_info("CPU model not supported\n");
> return -ENODEV;
> }
>
>

Applied, thanks!