Commit 9305bd6c authored by Thomas Gleixner's avatar Thomas Gleixner

x86/CPU: Move x86_cpuinfo::x86_max_cores assignment to detect_num_cpu_cores()

No point to have it at the call sites.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent a2aa578f
...@@ -161,7 +161,7 @@ static void init_centaur(struct cpuinfo_x86 *c) ...@@ -161,7 +161,7 @@ static void init_centaur(struct cpuinfo_x86 *c)
#endif #endif
early_init_centaur(c); early_init_centaur(c);
init_intel_cacheinfo(c); init_intel_cacheinfo(c);
c->x86_max_cores = detect_num_cpu_cores(c); detect_num_cpu_cores(c);
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
detect_ht(c); detect_ht(c);
#endif #endif
......
...@@ -584,18 +584,17 @@ static void get_model_name(struct cpuinfo_x86 *c) ...@@ -584,18 +584,17 @@ static void get_model_name(struct cpuinfo_x86 *c)
*(s + 1) = '\0'; *(s + 1) = '\0';
} }
int detect_num_cpu_cores(struct cpuinfo_x86 *c) void detect_num_cpu_cores(struct cpuinfo_x86 *c)
{ {
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
c->x86_max_cores = 1;
if (!IS_ENABLED(CONFIG_SMP) || c->cpuid_level < 4) if (!IS_ENABLED(CONFIG_SMP) || c->cpuid_level < 4)
return 1; return;
cpuid_count(4, 0, &eax, &ebx, &ecx, &edx); cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
if (eax & 0x1f) if (eax & 0x1f)
return (eax >> 26) + 1; c->x86_max_cores = (eax >> 26) + 1;
else
return 1;
} }
void cpu_detect_cache_sizes(struct cpuinfo_x86 *c) void cpu_detect_cache_sizes(struct cpuinfo_x86 *c)
......
...@@ -54,7 +54,7 @@ extern u32 get_scattered_cpuid_leaf(unsigned int level, ...@@ -54,7 +54,7 @@ extern u32 get_scattered_cpuid_leaf(unsigned int level,
extern void init_intel_cacheinfo(struct cpuinfo_x86 *c); extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
extern void init_amd_cacheinfo(struct cpuinfo_x86 *c); extern void init_amd_cacheinfo(struct cpuinfo_x86 *c);
extern int detect_num_cpu_cores(struct cpuinfo_x86 *c); extern void detect_num_cpu_cores(struct cpuinfo_x86 *c);
extern int detect_extended_topology(struct cpuinfo_x86 *c); extern int detect_extended_topology(struct cpuinfo_x86 *c);
extern void detect_ht(struct cpuinfo_x86 *c); extern void detect_ht(struct cpuinfo_x86 *c);
......
...@@ -651,7 +651,7 @@ static void init_intel(struct cpuinfo_x86 *c) ...@@ -651,7 +651,7 @@ static void init_intel(struct cpuinfo_x86 *c)
* let's use the legacy cpuid vector 0x1 and 0x4 for topology * let's use the legacy cpuid vector 0x1 and 0x4 for topology
* detection. * detection.
*/ */
c->x86_max_cores = detect_num_cpu_cores(c); detect_num_cpu_cores(c);
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
detect_ht(c); detect_ht(c);
#endif #endif
......
Markdown is supported
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