Re: [PATCH 2/2] cpufreq: amd-pstate: Use amd_get_highest_perf() to lookup perf values

Borislav Petkov
2024-06-26T17:18:32Z

On Tue, Jun 25, 2024 at 11:20:43PM -0500, Mario Limonciello wrote:
> + /*
> + * For AMD CPUs with Family ID 19H and Model ID range 0x70 to 0x7f,
> + * the highest performance level is set to 196.
> + * https://bugzilla.kernel.org/show_bug.cgi?id=218759
> + */
> + if (cpu_feature_enabled(X86_FEATURE_ZEN4)) {
> + switch (c->x86_model) {
> + case 0x70 ... 0x7f:

Aha, so here it is non-inclusive - "<" and not "<=".

So you need to check the model ranges first.

> + return CPPC_HIGHEST_PERF_PERFORMANCE;
> + default:
> + return CPPC_HIGHEST_PERF_DEFAULT;

As for patch 1.

> + }
> + }
> +
> + return CPPC_HIGHEST_PERF_DEFAULT;
> }
> EXPORT_SYMBOL_GPL(amd_get_highest_perf);
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 80eaa58f1405..f468d8562e17 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -52,8 +52,6 @@
> #define AMD_PSTATE_TRANSITION_LATENCY 20000
> #define AMD_PSTATE_TRANSITION_DELAY 1000
> #define AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY 600
> -#define CPPC_HIGHEST_PERF_PERFORMANCE 196
> -#define CPPC_HIGHEST_PERF_DEFAULT 166
>
> #define AMD_CPPC_EPP_PERFORMANCE 0x00
> #define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80

This already doesn't apply:

checking file arch/x86/kernel/cpu/amd.c
checking file drivers/cpufreq/amd-pstate.c
Hunk #1 FAILED at 52.

--
Regards/Gruss,
Boris.