Skip to content

Commit

Permalink
x86/cpu: Add detect extended topology for Zhaoxin CPUs
Browse files Browse the repository at this point in the history
zhaoxin inclusion
category: feature

-------------------

Detect the extended topology information of Zhaoxin CPUs if available.

Signed-off-by: leoliu-oc <[email protected]>
  • Loading branch information
leoliu-oc committed Jul 3, 2024
1 parent d94181c commit 28abea9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion arch/x86/kernel/cpu/centaur.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ static void early_init_centaur(struct cpuinfo_x86 *c)

if (cpuid_eax(0xC0000000) >= 0xC0000006)
c->x86_capability[CPUID_C000_0006_EAX] = cpuid_eax(0xC0000006);

if (detect_extended_topology_early(c) < 0)
detect_ht_early(c);
}

static void init_centaur(struct cpuinfo_x86 *c)
Expand All @@ -130,11 +133,14 @@ static void init_centaur(struct cpuinfo_x86 *c)
clear_cpu_cap(c, 0*32+31);
#endif
early_init_centaur(c);
detect_extended_topology(c);
init_intel_cacheinfo(c);
detect_num_cpu_cores(c);
if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
detect_num_cpu_cores(c);
#ifdef CONFIG_X86_32
detect_ht(c);
#endif
}

if (c->cpuid_level > 9) {
unsigned int eax = cpuid_eax(10);
Expand Down
7 changes: 6 additions & 1 deletion arch/x86/kernel/cpu/zhaoxin.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,21 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
}

if (detect_extended_topology_early(c) < 0)
detect_ht_early(c);
}

static void init_zhaoxin(struct cpuinfo_x86 *c)
{
early_init_zhaoxin(c);
detect_extended_topology(c);
init_intel_cacheinfo(c);
detect_num_cpu_cores(c);
if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
detect_num_cpu_cores(c);
#ifdef CONFIG_X86_32
detect_ht(c);
#endif
}

if (c->cpuid_level > 9) {
unsigned int eax = cpuid_eax(10);
Expand Down

0 comments on commit 28abea9

Please sign in to comment.