diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-01-30 07:30:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:39 -0500 |
commit | a860b63c41f241c685245127a3d32f352cb04c12 (patch) | |
tree | 54399000186258aa4c11b03faca8211172c97340 /arch | |
parent | 8c4385d7f5b77415156c9b900016cc8161d49f17 (diff) |
x86: store core id bits in cpuinfo_x8
We need to store core id bits to cpuinfo_x86 in early_identify_cpu. So we
use it to create acpiid_to_node array in k8topolgy.c
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/setup_64.c | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 62db062ba138..84f66b7b4d2e 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -542,18 +542,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
542 | int node = 0; | 542 | int node = 0; |
543 | unsigned apicid = hard_smp_processor_id(); | 543 | unsigned apicid = hard_smp_processor_id(); |
544 | #endif | 544 | #endif |
545 | unsigned ecx = cpuid_ecx(0x80000008); | 545 | bits = c->x86_coreid_bits; |
546 | |||
547 | c->x86_max_cores = (ecx & 0xff) + 1; | ||
548 | |||
549 | /* CPU telling us the core id bits shift? */ | ||
550 | bits = (ecx >> 12) & 0xF; | ||
551 | |||
552 | /* Otherwise recompute */ | ||
553 | if (bits == 0) { | ||
554 | while ((1 << bits) < c->x86_max_cores) | ||
555 | bits++; | ||
556 | } | ||
557 | 546 | ||
558 | /* Low order bits define the core id (index of core in socket) */ | 547 | /* Low order bits define the core id (index of core in socket) */ |
559 | c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1); | 548 | c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1); |
@@ -591,6 +580,33 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
591 | #endif | 580 | #endif |
592 | } | 581 | } |
593 | 582 | ||
583 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | ||
584 | { | ||
585 | #ifdef CONFIG_SMP | ||
586 | unsigned bits, ecx; | ||
587 | |||
588 | /* Multi core CPU? */ | ||
589 | if (c->extended_cpuid_level < 0x80000008) | ||
590 | return; | ||
591 | |||
592 | ecx = cpuid_ecx(0x80000008); | ||
593 | |||
594 | c->x86_max_cores = (ecx & 0xff) + 1; | ||
595 | |||
596 | /* CPU telling us the core id bits shift? */ | ||
597 | bits = (ecx >> 12) & 0xF; | ||
598 | |||
599 | /* Otherwise recompute */ | ||
600 | if (bits == 0) { | ||
601 | while ((1 << bits) < c->x86_max_cores) | ||
602 | bits++; | ||
603 | } | ||
604 | |||
605 | c->x86_coreid_bits = bits; | ||
606 | |||
607 | #endif | ||
608 | } | ||
609 | |||
594 | #define ENABLE_C1E_MASK 0x18000000 | 610 | #define ENABLE_C1E_MASK 0x18000000 |
595 | #define CPUID_PROCESSOR_SIGNATURE 1 | 611 | #define CPUID_PROCESSOR_SIGNATURE 1 |
596 | #define CPUID_XFAM 0x0ff00000 | 612 | #define CPUID_XFAM 0x0ff00000 |
@@ -858,7 +874,7 @@ struct cpu_model_info { | |||
858 | below. */ | 874 | below. */ |
859 | static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | 875 | static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) |
860 | { | 876 | { |
861 | u32 tfms; | 877 | u32 tfms, xlvl; |
862 | 878 | ||
863 | c->loops_per_jiffy = loops_per_jiffy; | 879 | c->loops_per_jiffy = loops_per_jiffy; |
864 | c->x86_cache_size = -1; | 880 | c->x86_cache_size = -1; |
@@ -869,6 +885,7 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
869 | c->x86_clflush_size = 64; | 885 | c->x86_clflush_size = 64; |
870 | c->x86_cache_alignment = c->x86_clflush_size; | 886 | c->x86_cache_alignment = c->x86_clflush_size; |
871 | c->x86_max_cores = 1; | 887 | c->x86_max_cores = 1; |
888 | c->x86_coreid_bits = 0; | ||
872 | c->extended_cpuid_level = 0; | 889 | c->extended_cpuid_level = 0; |
873 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 890 | memset(&c->x86_capability, 0, sizeof c->x86_capability); |
874 | 891 | ||
@@ -905,18 +922,6 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
905 | #ifdef CONFIG_SMP | 922 | #ifdef CONFIG_SMP |
906 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; | 923 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; |
907 | #endif | 924 | #endif |
908 | } | ||
909 | |||
910 | /* | ||
911 | * This does the hard work of actually picking apart the CPU stuff... | ||
912 | */ | ||
913 | void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | ||
914 | { | ||
915 | int i; | ||
916 | u32 xlvl; | ||
917 | |||
918 | early_identify_cpu(c); | ||
919 | |||
920 | /* AMD-defined flags: level 0x80000001 */ | 925 | /* AMD-defined flags: level 0x80000001 */ |
921 | xlvl = cpuid_eax(0x80000000); | 926 | xlvl = cpuid_eax(0x80000000); |
922 | c->extended_cpuid_level = xlvl; | 927 | c->extended_cpuid_level = xlvl; |
@@ -937,6 +942,23 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
937 | c->x86_capability[2] = cpuid_edx(0x80860001); | 942 | c->x86_capability[2] = cpuid_edx(0x80860001); |
938 | } | 943 | } |
939 | 944 | ||
945 | switch (c->x86_vendor) { | ||
946 | case X86_VENDOR_AMD: | ||
947 | early_init_amd(c); | ||
948 | break; | ||
949 | } | ||
950 | |||
951 | } | ||
952 | |||
953 | /* | ||
954 | * This does the hard work of actually picking apart the CPU stuff... | ||
955 | */ | ||
956 | void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | ||
957 | { | ||
958 | int i; | ||
959 | |||
960 | early_identify_cpu(c); | ||
961 | |||
940 | init_scattered_cpuid_features(c); | 962 | init_scattered_cpuid_features(c); |
941 | 963 | ||
942 | c->apicid = phys_pkg_id(0); | 964 | c->apicid = phys_pkg_id(0); |