[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241023155916.GCZxkdVGlNTr461XG4@fat_crate.local>
Date: Wed, 23 Oct 2024 17:59:16 +0200
From: Borislav Petkov <bp@...en8.de>
To: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
Cc: Mario Limonciello <mario.limonciello@....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>,
"Rafael J . Wysocki" <rafael@...nel.org>,
"Gautham R . Shenoy" <gautham.shenoy@....com>,
Perry Yuan <perry.yuan@....com>,
Brijesh Singh <brijesh.singh@....com>,
Peter Zijlstra <peterz@...radead.org>,
Li RongQing <lirongqing@...du.com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>,
"open list:ACPI" <linux-acpi@...r.kernel.org>,
"open list:AMD PSTATE DRIVER" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2 4/5] x86/cpu: Add CPU type to struct cpuinfo_topology
On Tue, Oct 22, 2024 at 09:40:15PM -0700, Pawan Gupta wrote:
> get_generic_cpu_type(struct cpuinfo_x86 *c)
> {
> enum x86_topology_cpu_type type;
>
> if (c->x86_vendor == X86_VENDOR_INTEL) {
> switch (c->topo.intel_type) {
> case 0x20: return TOPO_CPU_TYPE_EFFICIENCY;
> case 0x40: return TOPO_CPU_TYPE_PERFORMANCE;
> }
> if (c->x86_vendor == X86_VENDOR_AMD) {
> switch (c->topo.amd_type) {
> case 0: return TOPO_CPU_TYPE_PERFORMANCE;
> case 1: return TOPO_CPU_TYPE_EFFICIENCY;
> }
>
> return TOPO_CPU_TYPE_UNKNOWN;
> }
Ok...
> get_intel_cpu_type(struct cpuinfo_x86 *c)
> {
> return c->topo.intel_type;
> }
>
> get_amd_cpu_type(struct cpuinfo_x86 *c)
> {
> return c->topo.amd_type;
... except those silly wrappers can go. There's a reason cpuinfo_x86 has
well-defined members which can be used directly.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists