From: Yinghai Lu <yinghai@kernel.org>
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: print out microcode patch level
Date: Sun, 27 Sep 2009 00:15:47 -0700 [thread overview]
Message-ID: <4ABF1123.5030703@kernel.org> (raw)
warning if there are not consistent between cpus
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/cpu/amd.c | 27 +++++++++++++++++++++++++++
arch/x86/kernel/cpu/intel.c | 27 +++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
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
@@ -439,6 +439,31 @@ static void __cpuinit early_init_amd(str
#endif
}
+static u32 __cpuinitdata boot_cpu_microcode_level;
+
+static void __cpuinit check_amd_microcode_level(struct cpuinfo_x86 *c)
+{
+ u32 level, dummy;
+ unsigned int cpu_index = 0;
+
+#ifdef CONFIG_SMP
+ cpu_index = c->cpu_index;
+#endif
+
+ rdmsr(MSR_AMD64_PATCH_LEVEL, level, dummy);
+
+ printk(KERN_INFO "CPU %d microcode level: 0x%x\n", cpu_index, level);
+
+#ifdef CONFIG_SMP
+ if (cpu_index == boot_cpu_id)
+ boot_cpu_microcode_level = level;
+ else if (boot_cpu_microcode_level != level)
+ printk(KERN_WARNING
+ "CPU %d microcode level 0x%x is not same to boot cpu\n",
+ cpu_index, level);
+#endif
+}
+
static void __cpuinit init_amd(struct cpuinfo_x86 *c)
{
#ifdef CONFIG_SMP
@@ -562,6 +587,8 @@ static void __cpuinit init_amd(struct cp
set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
}
+ check_amd_microcode_level(c);
+
#ifdef CONFIG_X86_64
if (c->x86 == 0x10) {
/* do this for boot cpu */
Index: linux-2.6/arch/x86/kernel/cpu/intel.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/intel.c
+++ linux-2.6/arch/x86/kernel/cpu/intel.c
@@ -327,6 +327,31 @@ static void __cpuinit detect_vmx_virtcap
}
}
+static u32 __cpuinitdata boot_cpu_microcode_level;
+
+static void __cpuinit check_intel_microcode_level(struct cpuinfo_x86 *c)
+{
+ u32 level, dummy;
+ unsigned int cpu_index = 0;
+
+#ifdef CONFIG_SMP
+ cpu_index = c->cpu_index;
+#endif
+
+ rdmsr(MSR_IA32_UCODE_REV, dummy, level);
+
+ printk(KERN_INFO "CPU %d microcode level: 0x%x\n", cpu_index, level);
+
+#ifdef CONFIG_SMP
+ if (cpu_index == boot_cpu_id)
+ boot_cpu_microcode_level = level;
+ else if (boot_cpu_microcode_level != level)
+ printk(KERN_WARNING
+ "CPU %d microcode level 0x%x is not same to boot cpu\n",
+ cpu_index, level);
+#endif
+}
+
static void __cpuinit init_intel(struct cpuinfo_x86 *c)
{
unsigned int l2 = 0;
@@ -432,6 +457,8 @@ static void __cpuinit init_intel(struct
/* Work around errata */
srat_detect_node(c);
+ check_intel_microcode_level(c);
+
if (cpu_has(c, X86_FEATURE_VMX))
detect_vmx_virtcap(c);
}
reply other threads:[~2009-09-27 7:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4ABF1123.5030703@kernel.org \
--to=yinghai@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.