diff options
author | Andi Kleen <ak@suse.de> | 2005-04-16 18:25:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:25:15 -0400 |
commit | 3dd9d514846cdca1dcef2e4fce666d85e199e844 (patch) | |
tree | 28e60a8b733db213e88b0aee8ef3861a93a6fa48 /arch/i386/kernel/cpu/common.c | |
parent | f2ea2750fbe56867bc8e0eb595115b14195a3e5e (diff) |
[PATCH] x86_64: add support for Intel dual-core detection and displaying
Appended patch adds the support for Intel dual-core detection and displaying
the core related information in /proc/cpuinfo.
It adds two new fields "core id" and "cpu cores" to x86 /proc/cpuinfo and the
"core id" field for x86_64("cpu cores" field is already present in x86_64).
Number of processor cores in a die is detected using cpuid(4) and this is
documented in IA-32 Intel Architecture Software Developer's Manual (vol 2a)
(http://developer.intel.com/design/pentium4/manuals/index_new.htm#sdm_vol2a)
This patch also adds cpu_core_map similar to cpu_sibling_map.
Slightly hacked by AK.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu/common.c')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index ebd5d8247faa..ed4c9c3fe667 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -434,7 +434,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) | |||
434 | void __init detect_ht(struct cpuinfo_x86 *c) | 434 | void __init detect_ht(struct cpuinfo_x86 *c) |
435 | { | 435 | { |
436 | u32 eax, ebx, ecx, edx; | 436 | u32 eax, ebx, ecx, edx; |
437 | int index_lsb, index_msb, tmp; | 437 | int index_msb, tmp; |
438 | int cpu = smp_processor_id(); | 438 | int cpu = smp_processor_id(); |
439 | 439 | ||
440 | if (!cpu_has(c, X86_FEATURE_HT)) | 440 | if (!cpu_has(c, X86_FEATURE_HT)) |
@@ -446,7 +446,6 @@ void __init detect_ht(struct cpuinfo_x86 *c) | |||
446 | if (smp_num_siblings == 1) { | 446 | if (smp_num_siblings == 1) { |
447 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); | 447 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); |
448 | } else if (smp_num_siblings > 1 ) { | 448 | } else if (smp_num_siblings > 1 ) { |
449 | index_lsb = 0; | ||
450 | index_msb = 31; | 449 | index_msb = 31; |
451 | 450 | ||
452 | if (smp_num_siblings > NR_CPUS) { | 451 | if (smp_num_siblings > NR_CPUS) { |
@@ -455,21 +454,34 @@ void __init detect_ht(struct cpuinfo_x86 *c) | |||
455 | return; | 454 | return; |
456 | } | 455 | } |
457 | tmp = smp_num_siblings; | 456 | tmp = smp_num_siblings; |
458 | while ((tmp & 1) == 0) { | ||
459 | tmp >>=1 ; | ||
460 | index_lsb++; | ||
461 | } | ||
462 | tmp = smp_num_siblings; | ||
463 | while ((tmp & 0x80000000 ) == 0) { | 457 | while ((tmp & 0x80000000 ) == 0) { |
464 | tmp <<=1 ; | 458 | tmp <<=1 ; |
465 | index_msb--; | 459 | index_msb--; |
466 | } | 460 | } |
467 | if (index_lsb != index_msb ) | 461 | if (smp_num_siblings & (smp_num_siblings - 1)) |
468 | index_msb++; | 462 | index_msb++; |
469 | phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); | 463 | phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); |
470 | 464 | ||
471 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 465 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", |
472 | phys_proc_id[cpu]); | 466 | phys_proc_id[cpu]); |
467 | |||
468 | smp_num_siblings = smp_num_siblings / c->x86_num_cores; | ||
469 | |||
470 | tmp = smp_num_siblings; | ||
471 | index_msb = 31; | ||
472 | while ((tmp & 0x80000000) == 0) { | ||
473 | tmp <<=1 ; | ||
474 | index_msb--; | ||
475 | } | ||
476 | |||
477 | if (smp_num_siblings & (smp_num_siblings - 1)) | ||
478 | index_msb++; | ||
479 | |||
480 | cpu_core_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); | ||
481 | |||
482 | if (c->x86_num_cores > 1) | ||
483 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | ||
484 | cpu_core_id[cpu]); | ||
473 | } | 485 | } |
474 | } | 486 | } |
475 | #endif | 487 | #endif |