From 833cc758ee987ed32be8e8c284571eb70a44baa8 Mon Sep 17 00:00:00 2001 From: Liao Xuan Date: Thu, 13 Mar 2025 23:34:43 -0400 Subject: [PATCH] anolis: x86/cpu/hygon: Refactor the CPU topology deriving method for Hygon ANBZ: #19177 Refactor the CPU topology deriving method to be compatible for all the processors since Hygon family 18h model 4h. Signed-off-by: Liao Xuan --- arch/x86/kernel/cpu/hygon.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index 55c4db713cd5..aba60d96ed6d 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -81,16 +81,11 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) if (smp_num_siblings > 1) c->x86_max_cores /= smp_num_siblings; - switch (c->x86_model) { - case 0x0 ... 0x3: - if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) - break; + if (c->x86 == 0x18 && c->x86_model < 0x4 && + !boot_cpu_has(X86_FEATURE_HYPERVISOR)) { /* Socket ID is ApicId[6] for these processors. */ c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; - break; - case 0x4: - case 0x5: - case 0x6: + } else { /* * In case leaf 0xB is available, use it to derive * topology information. @@ -100,9 +95,6 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) c->x86_coreid_bits = get_count_order(c->x86_max_cores); __max_die_per_package = nodes_per_socket; - break; - default: - break; } cacheinfo_hygon_init_llc_id(c, cpu); -- Gitee