Re: [PATCH v2 4/5] x86/cpu: Add CPU type to struct cpuinfo_topology

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux