lkml.org 
[lkml]   [2018]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] x86/CPU/AMD: Derive CPU topology from CPUID Fn0xB
From
Date
Hi All,

On 3/26/18 3:05 PM, Suravee Suthikulpanit wrote:
> Derive topology information from Extended Topology Enumeration
> (CPUID Fn0x0000000B) when the information is available.
>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> arch/x86/kernel/cpu/amd.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 2c1a9f2..2b40144 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -338,10 +338,18 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
> c->cu_id = ebx & 0xff;
>
> if (c->x86 >= 0x17) {
> - c->cpu_core_id = ebx & 0xff;
> + int err = detect_extended_topology(c);
>
> - if (smp_num_siblings > 1)
> - c->x86_max_cores /= smp_num_siblings;
> + if (err) {
> + c->cpu_core_id = ebx & 0xff;
> +
> + if (smp_num_siblings > 1)
> + c->x86_max_cores /= smp_num_siblings;
> + } else {
> + int bits = get_count_order(c->x86_max_cores);
> +
> + c->x86_coreid_bits = get_count_order(bits);
> + }
> }

I made a mistake here in the attempt to clean up the code. I'll send out V2 to fix this.

Thanks,
Suravee

\
 
 \ /
  Last update: 2018-03-27 14:06    [W:0.137 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site