Skip to content
Snippets Groups Projects
Commit d8c7117f authored by LeoLiu-oc's avatar LeoLiu-oc Committed by Cheng Jian
Browse files

x86/cpu: Add detect extended topology for Zhaoxin CPUs

zhaoxin inclusion
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=19


CVE: NA

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

Detect the extended topology information of Zhaoxin CPUs if available.

The patch is scheduled to be submitted to the kernel mainline in 2021.

Signed-off-by: default avatarLeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Reviewed-by: default avatarLeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
parent 55f78ae6
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,21 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
}
if (c->cpuid_level >= 0x00000001) {
u32 eax, ebx, ecx, edx;
cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
/*
* If HTT (EDX[28]) is set EBX[16:23] contain the number of
* apicids which are reserved per package. Store the resulting
* shift value for the package management code.
*/
if (edx & (1U << 28))
c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff);
}
if (detect_extended_topology_early(c) < 0)
detect_ht_early(c);
}
static void centaur_detect_vmx_virtcap(struct cpuinfo_x86 *c)
......@@ -158,11 +173,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);
......
......@@ -85,6 +85,8 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c)
c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff);
}
if (detect_extended_topology_early(c) < 0)
detect_ht_early(c);
}
static void zhaoxin_detect_vmx_virtcap(struct cpuinfo_x86 *c)
......@@ -115,11 +117,14 @@ static void zhaoxin_detect_vmx_virtcap(struct cpuinfo_x86 *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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment