public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: clean up init_amd()
Date: Sat, 21 Jun 2008 01:14:27 -0700	[thread overview]
Message-ID: <200806210114.27610.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200806201611.21198.yhlu.kernel@gmail.com>


1. move out calling of check_enable_amd_mmconf_dmi out of setup_64.c
   put it into init_amd(), so don't need to make extra dmi check for
   system with other cpus.
2. 15 --> 0xf


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

---
 arch/x86/kernel/cpu/amd_64.c |   22 ++++++++++++++--------
 arch/x86/kernel/setup_64.c   |    4 ----
 2 files changed, 14 insertions(+), 12 deletions(-)

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
@@ -131,7 +131,7 @@ static void __cpuinit init_amd(struct cp
 	 * Errata 63 for SH-B3 steppings
 	 * Errata 122 for all steppings (F+ have it disabled by default)
 	 */
-	if (c->x86 == 15) {
+	if (c->x86 == 0xf) {
 		rdmsrl(MSR_K8_HWCR, value);
 		value |= 1 << 6;
 		wrmsrl(MSR_K8_HWCR, value);
@@ -143,10 +143,11 @@ static void __cpuinit init_amd(struct cp
 	clear_cpu_cap(c, 0*32+31);
 
 	/* On C+ stepping K8 rep microcode works well for copy/memset */
-	level = cpuid_eax(1);
-	if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) ||
-			     level >= 0x0f58))
-		set_cpu_cap(c, X86_FEATURE_REP_GOOD);
+	if (c->x86 == 0xf) {
+		level = cpuid_eax(1);
+		if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
+			set_cpu_cap(c, X86_FEATURE_REP_GOOD);
+	}
 	if (c->x86 == 0x10 || c->x86 == 0x11)
 		set_cpu_cap(c, X86_FEATURE_REP_GOOD);
 
@@ -157,7 +158,7 @@ static void __cpuinit init_amd(struct cp
 	level = get_model_name(c);
 	if (!level) {
 		switch (c->x86) {
-		case 15:
+		case 0xf:
 			/* Should distinguish Models here, but this is only
 			   a fallback anyways. */
 			strcpy(c->x86_model_id, "Hammer");
@@ -176,14 +177,19 @@ static void __cpuinit init_amd(struct cp
 	else
 		num_cache_leaves = 3;
 
-	if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11)
+	if (c->x86 >= 0xf && c->x86 <= 0x11)
 		set_cpu_cap(c, X86_FEATURE_K8);
 
 	/* MFENCE stops RDTSC speculation */
 	set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
 
-	if (c->x86 == 0x10)
+	if (c->x86 == 0x10) {
+		/* do this for boot cpu */
+		if (c == &boot_cpu_data)
+			check_enable_amd_mmconf_dmi();
+
 		fam10h_check_enable_mmcfg();
+	}
 
 	if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) {
 		unsigned long long tseg;
Index: linux-2.6/arch/x86/kernel/setup_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_64.c
+++ linux-2.6/arch/x86/kernel/setup_64.c
@@ -72,7 +72,6 @@
 #include <asm/topology.h>
 #include <asm/trampoline.h>
 #include <asm/pat.h>
-#include <asm/mmconfig.h>
 
 #include <mach_apic.h>
 #ifdef CONFIG_PARAVIRT
@@ -491,9 +490,6 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 #endif
-
-	/* do this before identify_cpu for boot cpu */
-	check_enable_amd_mmconf_dmi();
 }
 
 struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};

  reply	other threads:[~2008-06-21  8:13 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200805041823.57198.yhlu.kernel@gmail.com>
2008-05-06 17:38 ` [PATCH] x86: update mptable Yinghai Lu
2008-05-06 17:41   ` [PATCH] x86: fixed mtrr change WP to WB Yinghai Lu
2008-05-06 17:48     ` H. Peter Anvin
2008-05-06 18:24       ` Yinghai Lu
2008-05-06 18:31         ` H. Peter Anvin
2008-05-06 18:34           ` Yinghai Lu
2008-05-06 18:43             ` H. Peter Anvin
2008-05-06 19:05               ` Yinghai Lu
2008-05-06 19:08                 ` H. Peter Anvin
2008-05-06 19:15                   ` Yinghai Lu
2008-05-07  7:48   ` [PATCH] x86: update mptable v2 Yinghai Lu
2008-05-17  2:32     ` [PATCH] x86: update mptable v3 Yinghai Lu
2008-05-19 15:46       ` Ingo Molnar
2008-05-19 19:35       ` [PATCH] x86: update mptable v4 Yinghai Lu
2008-05-19 19:52         ` [PATCH] x86: update mptable v5 Yinghai Lu
2008-05-25 23:00           ` [PATCH] x86: update mptable v6 Yinghai Lu
2008-06-01 20:17             ` [PATCH] x86: update mptable v7 Yinghai Lu
2008-06-09  2:53               ` [PATCH] x86: update mptable v7 - fix Yinghai Lu
2008-06-09 10:13                 ` Ingo Molnar
2008-06-09 17:51                   ` Yinghai Lu
2008-06-09 18:11                     ` Maciej W. Rozycki
2008-06-09 19:09                     ` Ingo Molnar
2008-06-09 19:38                       ` Yinghai Lu
2008-06-09 19:46                         ` H. Peter Anvin
2008-06-09 19:49                       ` Maciej W. Rozycki
2008-06-18 21:32               ` [PATCH] x86: update mptable fix with no ioapic Yinghai Lu
2008-06-19  0:29                 ` [PATCH] x86: update mptable fix with no ioapic v2 Yinghai Lu
2008-06-19  7:18                   ` [PATCH] x86: let MPS support selectable Yinghai Lu
2008-06-19 12:13                     ` Ingo Molnar
2008-06-19 12:49                       ` Ingo Molnar
2008-06-19 15:10                     ` Maciej W. Rozycki
2008-06-19 17:39                       ` Yinghai Lu
2008-06-19 18:03                         ` Len Brown
2008-06-19 18:48                           ` Maciej W. Rozycki
2008-06-26  9:31                             ` Ingo Molnar
     [not found]                     ` <200806191213.10312.yhlu.kernel@gmail.com>
2008-06-19 19:15                       ` [PATCH] x86: fix compiling when CONFIG_X86_MPPARSE is not set Yinghai Lu
2008-06-20 14:42                         ` [PATCH] x86: check command line " Yinghai Lu
2008-06-20 15:01                           ` Ingo Molnar
2008-06-20 15:04                             ` Yinghai Lu
2008-06-20 15:36                             ` Maciej W. Rozycki
2008-06-20 23:11                           ` [PATCH] x86: check command line when CONFIG_X86_MPPARSE is not set v2 Yinghai Lu
2008-06-21  8:14                             ` Yinghai Lu [this message]
2008-06-24 12:12                           ` [PATCH] x86: check command line when CONFIG_X86_MPPARSE is not set Pavel Machek
2008-06-26  8:23                             ` Yinghai Lu
     [not found]                       ` <200806200733.31477.yhlu.kernel@gmail.com>
2008-06-20 15:03                         ` [PATCH] x86: simplify x86_mpparse dependency check Ingo Molnar
2008-06-20 15:31                         ` Maciej W. Rozycki
2008-06-19 12:13                   ` [PATCH] x86: update mptable fix with no ioapic v2 Ingo Molnar
2008-06-18 22:18               ` [PATCH] x86: update mptable v7 Len Brown
2008-06-18 22:32                 ` Yinghai Lu
2008-06-19  0:33                   ` Len Brown
2008-06-19  0:49                     ` Yinghai Lu
2008-06-19  4:32                       ` Eric W. Biederman
2008-06-19  5:09                         ` H. Peter Anvin
2008-06-19  5:11                         ` Yinghai Lu
2008-06-19  5:27                         ` Len Brown
2008-06-19  6:37                           ` Eric W. Biederman
2008-06-19  7:31                             ` Yinghai Lu
2008-06-19 18:16                               ` Len Brown
2008-06-20  6:47                                 ` Ingo Molnar
2008-06-20  7:20                                   ` Yinghai Lu
2008-06-20  9:12                                   ` Andi Kleen
2008-06-19  5:20                       ` Len Brown
2008-06-19  6:26                         ` Yinghai Lu
2008-06-19  6:28                           ` H. Peter Anvin
2008-06-19  6:35                             ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806210114.27610.yhlu.kernel@gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox