x86: remove duplicated get_mode_name calling
PATCH 1/2 x86: remove duplicated get_mode_name calling
--- arch/x86/kernel/cpu/amd.c | 3 --- arch/x86/kernel/cpu/amd_64.c | 3 +-- arch/x86/kernel/cpu/centaur.c | 1 - arch/x86/kernel/cpu/common.c | 9 +++------ arch/x86/kernel/cpu/cpu.h | 1 - arch/x86/kernel/cpu/cyrix.c | 1 - arch/x86/kernel/cpu/transmeta.c | 1 - 7 files changed, 4 insertions(+), 15 deletions(-)
arch/x86/kernel/cpu/amd.c +0 -3
@@ -42,7 +42,6 @@ static void __cpuinit init_amd(struct cp {u32 l, h;int mbytes = num_physpages >> (20 -PAGE_SHIFT ); -int r;#ifdef CONFIG_SMP unsigned long long value;
@@ -75,8 +74,6 @@ static void __cpuinit init_amd(struct cp*/ clear_cpu_cap (c,0 *32 +31 ); - r =get_model_name (c); -switch (c->x86) {case 4 :/*
arch/x86/kernel/cpu/amd_64.c +1 -2
@@ -157,8 +157,7 @@ static void __cpuinit init_amd(struct cpif (c->x86 >=6 )set_cpu_cap (c,X86_FEATURE_FXSAVE_LEAK ); - level =get_model_name (c); -if (!level) { +if (!c->x86_model_id[0 ]) {switch (c->x86) {case 0xf :/* Should distinguish Models here, but this is only
arch/x86/kernel/cpu/centaur.c +0 -1
@@ -289,7 +289,6 @@ static void __cpuinit init_c3(struct cpuif (c->x86_model >=6 && c->x86_model <9 )set_cpu_cap (c,X86_FEATURE_3DNOW ); -get_model_name (c);display_cacheinfo (c); }
arch/x86/kernel/cpu/common.c +3 -6
@@ -252,13 +252,13 @@ static struct cpu_dev __cpuinitdata defa .c_x86_vendor = X86_VENDOR_UNKNOWN, }; -int __cpuinit get_model_name (struct cpuinfo_x86 *c) +static void __cpuinit get_model_name (struct cpuinfo_x86 *c) {unsigned int *v;char *p, *q;if (c->extended_cpuid_level <0x80000004 ) -return 0 ; +return ; v = (unsigned int *) c->x86_model_id;cpuid (0x80000002 , &v[0 ], &v[1 ], &v[2 ], &v[3 ]);
@@ -277,8 +277,6 @@ int __cpuinit get_model_name(struct cpuiwhile (q <= &c->x86_model_id[48 ]) *q++ ='\0' ;/* Zero-pad the rest */ } - -return 1 ; }void __cpuinit display_cacheinfo (struct cpuinfo_x86 *c)
@@ -610,8 +608,7 @@ static void __cpuinit generic_identify(s#endif } -if (c->extended_cpuid_level >=0x80000004 ) -get_model_name (c);/* Default name */ +get_model_name (c);/* Default name */ init_scattered_cpuid_features (c);detect_nopl (c);
arch/x86/kernel/cpu/cpu.h +0 -1
@@ -31,7 +31,6 @@ struct cpu_dev {extern struct cpu_dev *__x86_cpu_dev_start[], *__x86_cpu_dev_end[]; -extern int get_model_name (struct cpuinfo_x86 *c);extern void display_cacheinfo (struct cpuinfo_x86 *c);#endif
arch/x86/kernel/cpu/cyrix.c +0 -1
@@ -301,7 +301,6 @@ static void __cpuinit init_cyrix(struct*/ if ((0x30 <= dir1 && dir1 <=0x6f ) || (0x80 <= dir1 && dir1 <=0x8f ))geode_configure (); -get_model_name (c);/* get CPU marketing name */ return ; }else {/* MediaGX */ Cx86_cb[2 ] = (dir0_lsn &1 ) ?'3' :'4' ;
arch/x86/kernel/cpu/transmeta.c +0 -1
@@ -12,7 +12,6 @@ static void __cpuinit init_transmeta(strunsigned int cpu_rev, cpu_freq =0 , cpu_flags, new_cpu_rev;char cpu_info[65 ]; -get_model_name (c);/* Same as AMD/Cyrix */ display_cacheinfo (c);/* Print CMS and CPU revision */
PATCH 2/2 x86: calling early_init_xxx in init_xxx
so
1. could set some cap to ap
2. restore some cap after memset in identify_cpu for boot cpu
esp for CONSTANT_TSC
before this patch:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow rep_good nopl pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs
after this patch:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl pni monitor cx16 lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs
constant_tsc is back...
--- arch/x86/kernel/cpu/amd.c | 7 ++----- arch/x86/kernel/cpu/amd_64.c | 2 ++ arch/x86/kernel/cpu/centaur_64.c | 2 ++ arch/x86/kernel/cpu/common.c | 7 ++++--- arch/x86/kernel/cpu/intel_64.c | 2 ++ 5 files changed, 12 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/amd.c +2 -5
@@ -26,11 +26,8 @@ __asm__(".align 4\nvide: ret");static void __cpuinit early_init_amd (struct cpuinfo_x86 *c) { -if (cpuid_eax (0x80000000 ) >=0x80000007 ) { - c->x86_power =cpuid_edx (0x80000007 ); -if (c->x86_power & (1 <<8 )) -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); - } +if (c->x86_power & (1 <<8 )) +set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC );/* Set MTRR capability flag if appropriate */ if (c->x86_model == 13 || c->x86_model == 9 ||
arch/x86/kernel/cpu/amd_64.c +2 -0
@@ -140,6 +140,8 @@ static void __cpuinit init_amd(struct cp }#endif +early_init_amd (c); +/* Bit 31 in normal CPUID used for nonstandard 3DNow ID; 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ clear_cpu_cap (c,0 *32 +31 );
arch/x86/kernel/cpu/centaur_64.c +2 -0
@@ -16,6 +16,8 @@ static void __cpuinit early_init_centaurstatic void __cpuinit init_centaur (struct cpuinfo_x86 *c) { +early_init_centaur (c); +if (c->x86 ==0x6 && c->x86_model >=0xf ) { c->x86_cache_alignment = c->x86_clflush_size *2 ;set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC );
arch/x86/kernel/cpu/common.c +4 -3
@@ -473,9 +473,6 @@ static void __cpuinit get_cpu_cap(struct c->x86_capability[2 ] =cpuid_edx (0x80860001 ); } -if (c->extended_cpuid_level >=0x80000007 ) - c->x86_power =cpuid_edx (0x80000007 ); -if (c->extended_cpuid_level >=0x80000008 ) {u32 eax =cpuid_eax (0x80000008 );
@@ -483,6 +480,10 @@ static void __cpuinit get_cpu_cap(struct c->x86_phys_bits = eax & 0xff; }#endif + +if (c->extended_cpuid_level >=0x80000007 ) + c->x86_power =cpuid_edx (0x80000007 ); + }/* * Do minimum CPU detection early.
arch/x86/kernel/cpu/intel_64.c +2 -0
@@ -54,6 +54,8 @@ static void __cpuinit srat_detect_node(vstatic void __cpuinit init_intel (struct cpuinfo_x86 *c) { +early_init_intel (c); +init_intel_cacheinfo (c);if (c->cpuid_level >9 ) {unsigned eax =cpuid_eax (10 );
Ingo Molnar
AppliedRe: [PATCH 2/2] x86: calling early_init_xxx in init_xxx
Quoted 6 lines · Yinghai Lu
so
1. could set some cap to ap
2. restore some cap after memset inidentify_cpufor boot cpuesp for
CONSTANT_TSC
Quoted 7 lines
before this patch:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxextfxsr_optpdpe1gb rdtscp lm 3dnowext 3dnowrep_goodnopl pni monitor cx16lahf_lmcmp_legacysvm extapiccr8_legacyabm sse4a misalignsse 3dnowprefetch osvw ibsafter this patch:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxextfxsr_optpdpe1gb rdtscp lm 3dnowext 3dnowconstant_tscrep_goodnopl pni monitor cx16lahf_lmcmp_legacysvm extapiccr8_legacyabm sse4a misalignsse 3dnowprefetch osvw ibs
constant_tscis back...
applied to tip/x86/unify-cpu-detect, thanks Yinghai.
Ingo
Ingo Molnar
AppliedQuoted 11 lines · Yinghai Lu
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/cpu/amd.c | 3 --- arch/x86/kernel/cpu/amd_64.c | 3 +-- arch/x86/kernel/cpu/centaur.c | 1 - arch/x86/kernel/cpu/common.c | 9 +++------ arch/x86/kernel/cpu/cpu.h | 1 - arch/x86/kernel/cpu/cyrix.c | 1 - arch/x86/kernel/cpu/transmeta.c | 1 - 7 files changed, 4 insertions(+), 15 deletions(-)
applied to tip/x86/unify-cpu-detect, thanks Yinghai.
Ingo