Re: [PATCH 2/2] x86: calling early_init_xxx in init_xxx

Previous thread: ACPI video.c brightness handler conflicts with toshiba_acpi by Andrey Borzenkov on Saturday, September 6, 2008 - 12:08 am. (15 messages)

Next thread: Uniquely identify and Motherboard Model. by James Courtier-Dutton on Saturday, September 6, 2008 - 2:09 am. (2 messages)
From: Yinghai Lu
Date: Saturday, September 6, 2008 - 1:52 am

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 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(-)

Index: linux-2.6/arch/x86/kernel/cpu/amd.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd.c
+++ linux-2.6/arch/x86/kernel/cpu/amd.c
@@ -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:
 		/*
Index: linux-2.6/arch/x86/kernel/cpu/amd_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd_64.c
+++ linux-2.6/arch/x86/kernel/cpu/amd_64.c
@@ -157,8 +157,7 @@ static void __cpuinit init_amd(struct cp
 	if (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
Index: linux-2.6/arch/x86/kernel/cpu/centaur.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/centaur.c
+++ linux-2.6/arch/x86/kernel/cpu/centaur.c
@@ -289,7 +289,6 @@ static void __cpuinit init_c3(struct cpu
 	if (c->x86_model >= 6 && c->x86_model < 9)
 		set_cpu_cap(c, X86_FEATURE_3DNOW);
 
-	get_model_name(c);
 	display_cacheinfo(c);
 }
 
Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- ...
From: Yinghai Lu
Date: Saturday, September 6, 2008 - 1:52 am

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...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 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(-)

Index: linux-2.6/arch/x86/kernel/cpu/amd.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd.c
+++ linux-2.6/arch/x86/kernel/cpu/amd.c
@@ -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 ||
Index: linux-2.6/arch/x86/kernel/cpu/amd_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd_64.c
+++ linux-2.6/arch/x86/kernel/cpu/amd_64.c
@@ -140,6 +140,8 ...
From: Ingo Molnar
Date: Saturday, September 6, 2008 - 5:09 am

applied to tip/x86/unify-cpu-detect, thanks Yinghai.

	Ingo
--

From: Ingo Molnar
Date: Saturday, September 6, 2008 - 5:09 am

applied to tip/x86/unify-cpu-detect, thanks Yinghai.

	Ingo
--

Previous thread: ACPI video.c brightness handler conflicts with toshiba_acpi by Andrey Borzenkov on Saturday, September 6, 2008 - 12:08 am. (15 messages)

Next thread: Uniquely identify and Motherboard Model. by James Courtier-Dutton on Saturday, September 6, 2008 - 2:09 am. (2 messages)