Re: [PATCH v2 4/5] x86/cpu: Add CPU type to struct cpuinfo_topology
From: Borislav Petkov
Date: Wed Oct 23 2024 - 11:59:53 EST
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