All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Add check for P5 to microcode_intel_early
@ 2013-04-19 17:23 Bryan O'Donoghue
  2013-04-19 19:11 ` Borislav Petkov
  2013-04-20  0:20 ` [tip:x86/urgent] x86, microcode: Verify the family before dispatching microcode patching tip-bot for H. Peter Anvin
  0 siblings, 2 replies; 12+ messages in thread
From: Bryan O'Donoghue @ 2013-04-19 17:23 UTC (permalink / raw)
  To: hpa, linux-kernel, x86, fenghua.yu; +Cc: Bryan O'Donoghue

Architectural MSRs associated with microcode are for P6 or higher.
Add a check to early microcode to detect < P6.

Without a check for < P6 - we end up reading from unimplemented MSRs
on Pentium.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue.lkml@nexus-software.ie>
---
 arch/x86/kernel/microcode_intel_early.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c
index d893e8e..e1ff9bf 100644
--- a/arch/x86/kernel/microcode_intel_early.c
+++ b/arch/x86/kernel/microcode_intel_early.c
@@ -396,6 +396,9 @@ static int __cpuinit collect_cpu_info_early(struct ucode_cpu_info *uci)
 	x86 = get_x86_family(csig.sig);
 	x86_model = get_x86_model(csig.sig);
 
+	if (x86 < 6)
+		return UCODE_ERROR;
+
 	if ((x86_model >= 5) || (x86 > 6)) {
 		/* get processor flags from MSR 0x17 */
 		native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
@@ -428,9 +431,13 @@ static void __ref show_saved_mc(void)
 		pr_debug("no micorcode data saved.\n");
 		return;
 	}
-	pr_debug("Total microcode saved: %d\n", mc_saved_data.mc_saved_count);
 
-	collect_cpu_info_early(&uci);
+	if (collect_cpu_info_early(&uci) == UCODE_ERROR) {
+		pr_debug("microcode unavailable on this architecture\n");
+		return;
+	}
+
+	pr_debug("Total microcode saved: %d\n", mc_saved_data.mc_saved_count);
 
 	sig = uci.cpu_sig.sig;
 	pf = uci.cpu_sig.pf;
@@ -609,7 +616,8 @@ void __cpuinit show_ucode_info_early(void)
 	struct ucode_cpu_info uci;
 
 	if (delay_ucode_info) {
-		collect_cpu_info_early(&uci);
+		if (collect_cpu_info_early(&uci) == UCODE_ERROR)
+			return;
 		print_ucode_info(&uci, current_mc_date);
 		delay_ucode_info = 0;
 	}
@@ -724,7 +732,8 @@ _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,
 		      unsigned long initrd_end_early,
 		      struct ucode_cpu_info *uci)
 {
-	collect_cpu_info_early(uci);
+	if (collect_cpu_info_early(uci) == UCODE_ERROR)
+		return;
 	scan_microcode(initrd_start_early, initrd_end_early, mc_saved_data,
 		       mc_saved_in_initrd, uci);
 	load_microcode(mc_saved_data, mc_saved_in_initrd,
@@ -789,7 +798,9 @@ void __cpuinit load_ucode_intel_ap(void)
 	if (mc_saved_data_p->mc_saved_count == 0)
 		return;
 
-	collect_cpu_info_early(&uci);
+	if (collect_cpu_info_early(&uci) == UCODE_ERROR)
+		return;
+
 	load_microcode(mc_saved_data_p, mc_saved_in_initrd_p,
 		       initrd_start_addr, &uci);
 	apply_microcode_early(mc_saved_data_p, &uci);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-20 16:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-19 17:23 [PATCH] x86: Add check for P5 to microcode_intel_early Bryan O'Donoghue
2013-04-19 19:11 ` Borislav Petkov
2013-04-19 20:35   ` Bryan O'Donoghue
2013-04-19 20:55     ` Borislav Petkov
2013-04-19 21:25       ` Borislav Petkov
2013-04-19 21:44         ` Bryan O'Donoghue
2013-04-19 22:02           ` H. Peter Anvin
2013-04-19 23:13           ` H. Peter Anvin
2013-04-20  9:24             ` Bryan O'Donoghue
2013-04-20 15:52               ` H. Peter Anvin
2013-04-20  0:20 ` [tip:x86/urgent] x86, microcode: Verify the family before dispatching microcode patching tip-bot for H. Peter Anvin
2013-04-20 16:21   ` Bryan O'Donoghue

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.