Skip to content

Commit 28abea9

Browse files
committed
x86/cpu: Add detect extended topology for Zhaoxin CPUs
zhaoxin inclusion category: feature ------------------- Detect the extended topology information of Zhaoxin CPUs if available. Signed-off-by: leoliu-oc <[email protected]>
1 parent d94181c commit 28abea9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

arch/x86/kernel/cpu/centaur.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
112112

113113
if (cpuid_eax(0xC0000000) >= 0xC0000006)
114114
c->x86_capability[CPUID_C000_0006_EAX] = cpuid_eax(0xC0000006);
115+
116+
if (detect_extended_topology_early(c) < 0)
117+
detect_ht_early(c);
115118
}
116119

117120
static void init_centaur(struct cpuinfo_x86 *c)
@@ -130,11 +133,14 @@ static void init_centaur(struct cpuinfo_x86 *c)
130133
clear_cpu_cap(c, 0*32+31);
131134
#endif
132135
early_init_centaur(c);
136+
detect_extended_topology(c);
133137
init_intel_cacheinfo(c);
134-
detect_num_cpu_cores(c);
138+
if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
139+
detect_num_cpu_cores(c);
135140
#ifdef CONFIG_X86_32
136141
detect_ht(c);
137142
#endif
143+
}
138144

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

arch/x86/kernel/cpu/zhaoxin.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,21 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c)
6666
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
6767
}
6868

69+
if (detect_extended_topology_early(c) < 0)
70+
detect_ht_early(c);
6971
}
7072

7173
static void init_zhaoxin(struct cpuinfo_x86 *c)
7274
{
7375
early_init_zhaoxin(c);
76+
detect_extended_topology(c);
7477
init_intel_cacheinfo(c);
75-
detect_num_cpu_cores(c);
78+
if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
79+
detect_num_cpu_cores(c);
7680
#ifdef CONFIG_X86_32
7781
detect_ht(c);
7882
#endif
83+
}
7984

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

0 commit comments

Comments
 (0)