Commit 00b324ae authored by LeoLiu-oc's avatar LeoLiu-oc Committed by Zheng Zengkai
Browse files

Get locgical processors numbers bits per package

zhaoxin inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I40QDN


CVE: NA

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

Get locgical processors numbers bits per package by cpuid instruction
for some Zhaoxin CPUs which vendor is Centaur

Signed-off-by: default avatarLeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent bc45d070
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -109,6 +109,19 @@ 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);
	}
}

static void init_centaur(struct cpuinfo_x86 *c)