Commit 43e0f91f authored by Xie Haocheng's avatar Xie Haocheng
Browse files

x86/cpufeatures: Fix cpu capabilities incorrect detection.

amd inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6A0G7


CVE: NA

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

Below AMD platform features are incorrect detected:

X86_FEATURE_SME,
X86_FEATURE_SEV,
X86_FEATURE_VM_PAGE_FLUSH,
X86_FEATURE_SEV_ES,
X86_FEATURE_SME_COHERENT

This bug is introduced by commit ac376dd8.
The definition and use of CPUID_8000_001F_EAX will cause c.x86_capability
get a conflict wrong value.

Signed-off-by: default avatarXie Haocheng <haocheng.xie@amd.com>
parent bbee829a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ enum cpuid_leafs
	CPUID_7_ECX,
	CPUID_8000_0007_EBX,
	CPUID_7_EDX,
	CPUID_8000_001F_EAX,
};

#ifdef CONFIG_X86_FEATURE_NAMES
+0 −3
Original line number Diff line number Diff line
@@ -963,9 +963,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
	if (c->extended_cpuid_level >= 0x8000000a)
		c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);

	if (c->extended_cpuid_level >= 0x8000001f)
		c->x86_capability[CPUID_8000_001F_EAX] = cpuid_eax(0x8000001f);

	init_scattered_cpuid_features(c);
	init_speculation_control(c);

+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ static const struct cpuid_bit cpuid_bits[] = {
	{ X86_FEATURE_PROC_FEEDBACK,    CPUID_EDX, 11, 0x80000007, 0 },
	{ X86_FEATURE_MBA,		CPUID_EBX,  6, 0x80000008, 0 },
	{ X86_FEATURE_PERFMON_V2,	CPUID_EAX,  0, 0x80000022, 0 },
	{ X86_FEATURE_SME,              CPUID_EAX,  0, 0x8000001f, 0 },
	{ X86_FEATURE_SEV,              CPUID_EAX,  1, 0x8000001f, 0 },
	{ X86_FEATURE_VM_PAGE_FLUSH,    CPUID_EAX,  2, 0x8000001f, 0 },
	{ X86_FEATURE_SEV_ES,           CPUID_EAX,  3, 0x8000001f, 0 },
	{ X86_FEATURE_SME_COHERENT,     CPUID_EAX, 10, 0x8000001f, 0 },
	{ 0, 0, 0, 0, 0 }
};