Re: [PATCH PATCH 1/9] x86/cpu/topology: Add x86_cpu_type to struct cpuinfo_topology

Pawan Gupta
2024-06-17T17:52:22Z

On Mon, Jun 17, 2024 at 10:35:15AM +0100, Andrew Cooper wrote:
> On 17/06/2024 10:11 am, Pawan Gupta wrote:
> > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> > index cb4f6c513c48..f310a7fb4e00 100644
> > --- a/arch/x86/include/asm/processor.h
> > +++ b/arch/x86/include/asm/processor.h
> > @@ -95,6 +95,9 @@ struct cpuinfo_topology {
> > // Core ID relative to the package
> > u32 core_id;
> >
> > + // CPU-type e.g. performance, efficiency etc.
> > + u8 cpu_type;
> > +
>
> End of the structure?  At least that way new additions are less likely
> to add more padding.

Right, I will move it to the end of the structure.

> > diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c
> > index 9a6069e7133c..be82c8769bb2 100644
> > --- a/arch/x86/kernel/cpu/topology_common.c
> > +++ b/arch/x86/kernel/cpu/topology_common.c
> > @@ -140,6 +140,14 @@ static void parse_topology(struct topo_scan *tscan, bool early)
> > }
> > }
> >
> > +static void topo_set_cpu_type(struct cpuinfo_x86 *c)
> > +{
> > + c->topo.cpu_type = X86_CPU_TYPE_UNKNOWN;
> > +
> > + if (c->x86_vendor == X86_VENDOR_INTEL && cpuid_eax(0) >= 0x1a)
>
> c->cpuid_level ?

Will do.