From: Suravee Suthikulpanit Date: Fri, 27 Apr 2018 16:48:00 -0500 Subject: x86/CPU: Modify detect_extended_topology() to return result Git-commit: 6c4f5abaf3566dbf5b26e7b14f4392be400f12e3 Patch-mainline: v4.18-rc1 References: fate#324366, fate#324376 Current implementation does not communicate whether it can successfully detect CPUID function 0xB information. Therefore, modify the function to return success or error codes. This will be used by subsequent patches. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Reviewed-by: Borislav Petkov Link: http://lkml.kernel.org/r/1524865681-112110-2-git-send-email-suravee.suthikulpanit@amd.com Acked-by: Joerg Roedel --- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/cpu/topology.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -192,7 +192,7 @@ extern u32 get_scattered_cpuid_leaf(unsi extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); extern void init_amd_cacheinfo(struct cpuinfo_x86 *c); -extern void detect_extended_topology(struct cpuinfo_x86 *c); +extern int detect_extended_topology(struct cpuinfo_x86 *c); extern void detect_ht(struct cpuinfo_x86 *c); #ifdef CONFIG_X86_32 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -26,7 +26,7 @@ * exists, use it for populating initial_apicid and cpu topology * detection. */ -void detect_extended_topology(struct cpuinfo_x86 *c) +int detect_extended_topology(struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP unsigned int eax, ebx, ecx, edx, sub_index; @@ -35,7 +35,7 @@ void detect_extended_topology(struct cpu static bool printed; if (c->cpuid_level < 0xb) - return; + return -1; cpuid_count(0xb, SMT_LEVEL, &eax, &ebx, &ecx, &edx); @@ -43,7 +43,7 @@ void detect_extended_topology(struct cpu * check if the cpuid leaf 0xb is actually implemented. */ if (ebx == 0 || (LEAFB_SUBTYPE(ecx) != SMT_TYPE)) - return; + return -1; set_cpu_cap(c, X86_FEATURE_XTOPOLOGY); @@ -94,6 +94,6 @@ void detect_extended_topology(struct cpu c->cpu_core_id); printed = 1; } - return; #endif + return 0; }