aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/intel.c
diff options
context:
space:
mode:
authorDavid Wang <davidwang@zhaoxin.com>2018-05-02 22:32:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2018-05-13 06:06:12 -0400
commit2cc61be60e37b1856a97ccbdcca3e86e593bf06a (patch)
treea4d2eae5b8d11c1b2dd1ca8afb2a4be3c99b4e52 /arch/x86/kernel/cpu/intel.c
parentb5cf8707e6c9d85819b4bee3218ec560953149f7 (diff)
x86/CPU: Make intel_num_cpu_cores() generic
intel_num_cpu_cores() is a static function in intel.c which can't be used by other files. Define another function called detect_num_cpu_cores() in common.c to replace this function so it can be reused. Signed-off-by: David Wang <davidwang@zhaoxin.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: lukelin@viacpu.com Cc: qiyuanwang@zhaoxin.com Cc: gregkh@linuxfoundation.org Cc: brucechang@via-alliance.com Cc: timguo@zhaoxin.com Cc: cooperyan@zhaoxin.com Cc: hpa@zytor.com Cc: benjaminpan@viatech.com Link: https://lkml.kernel.org/r/1525314766-18910-2-git-send-email-davidwang@zhaoxin.com
Diffstat (limited to 'arch/x86/kernel/cpu/intel.c')
-rw-r--r--arch/x86/kernel/cpu/intel.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index b9693b80fc21..b54535be254a 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -453,24 +453,6 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
453#endif 453#endif
454} 454}
455 455
456/*
457 * find out the number of processor cores on the die
458 */
459static int intel_num_cpu_cores(struct cpuinfo_x86 *c)
460{
461 unsigned int eax, ebx, ecx, edx;
462
463 if (!IS_ENABLED(CONFIG_SMP) || c->cpuid_level < 4)
464 return 1;
465
466 /* Intel has a non-standard dependency on %ecx for this CPUID level. */
467 cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
468 if (eax & 0x1f)
469 return (eax >> 26) + 1;
470 else
471 return 1;
472}
473
474static void detect_vmx_virtcap(struct cpuinfo_x86 *c) 456static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
475{ 457{
476 /* Intel VMX MSR indicated features */ 458 /* Intel VMX MSR indicated features */
@@ -671,7 +653,7 @@ static void init_intel(struct cpuinfo_x86 *c)
671 * let's use the legacy cpuid vector 0x1 and 0x4 for topology 653 * let's use the legacy cpuid vector 0x1 and 0x4 for topology
672 * detection. 654 * detection.
673 */ 655 */
674 c->x86_max_cores = intel_num_cpu_cores(c); 656 c->x86_max_cores = detect_num_cpu_cores(c);
675#ifdef CONFIG_X86_32 657#ifdef CONFIG_X86_32
676 detect_ht(c); 658 detect_ht(c);
677#endif 659#endif