[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240626171421.GRZnxMbcI83xe1SLtB@fat_crate.local>
Date: Wed, 26 Jun 2024 19:14:21 +0200
From: Borislav Petkov <bp@...en8.de>
To: Mario Limonciello <mario.limonciello@....com>
Cc: "Gautham R . Shenoy" <gautham.shenoy@....com>,
Perry Yuan <perry.yuan@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
"H . Peter Anvin" <hpa@...or.com>, Huang Rui <ray.huang@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Nikolay Borisov <nik.borisov@...e.com>,
Peter Zijlstra <peterz@...radead.org>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>,
"open list:AMD PSTATE DRIVER" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH 1/2] x86/cpu/amd: Clarify amd_get_highest_perf()
On Tue, Jun 25, 2024 at 11:20:42PM -0500, Mario Limonciello wrote:
> static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
> {
> u32 gprs[8] = { 0 };
> @@ -1194,15 +1198,27 @@ u32 amd_get_highest_perf(void)
> {
> struct cpuinfo_x86 *c = &boot_cpu_data;
>
> - if (c->x86 == 0x17 && ((c->x86_model >= 0x30 && c->x86_model < 0x40) ||
> - (c->x86_model >= 0x70 && c->x86_model < 0x80)))
> - return 166;
> + if (cpu_feature_enabled(X86_FEATURE_ZEN2)) {
> + switch (c->x86_model) {
> + case 0x30 ... 0x40:
> + case 0x70 ... 0x80:
Well, it was < 0x40 and < 0x80
You're making it <=.
> + return CPPC_HIGHEST_PERF_DEFAULT;
> + default:
> + return CPPC_HIGHEST_PERF_MAX;
> + }
> + }
>
> - if (c->x86 == 0x19 && ((c->x86_model >= 0x20 && c->x86_model < 0x30) ||
> - (c->x86_model >= 0x40 && c->x86_model < 0x70)))
> - return 166;
> + if (cpu_feature_enabled(X86_FEATURE_ZEN3)) {
> + switch (c->x86_model) {
> + case 0x20 ... 0x30:
> + case 0x40 ... 0x70:
Ditto.
Also, ontop:
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 73559db78433..5d496de4e141 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1204,7 +1204,7 @@ u32 amd_get_highest_perf(void)
case 0x70 ... 0x80:
return CPPC_HIGHEST_PERF_DEFAULT;
default:
- return CPPC_HIGHEST_PERF_MAX;
+ break;
}
}
@@ -1214,7 +1214,7 @@ u32 amd_get_highest_perf(void)
case 0x40 ... 0x70:
return CPPC_HIGHEST_PERF_DEFAULT;
default:
- return CPPC_HIGHEST_PERF_MAX;
+ break;
}
}
so that you don't have so many redundant returns in the function.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists