From: "Bryan O'Donoghue" <bryan.odonoghue.lkml@nexus-software.ie>
To: hpa@zytor.com, linux-kernel@vger.kernel.org, x86@kernel.org,
fenghua.yu@intel.com
Cc: "Bryan O'Donoghue" <bryan.odonoghue.lkml@nexus-software.ie>
Subject: [PATCH] x86: Add check for P5 to microcode_intel_early
Date: Fri, 19 Apr 2013 18:23:03 +0100
Message-ID: <1366392183-4149-1-git-send-email-bryan.odonoghue.lkml@nexus-software.ie> (raw)
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
next reply index
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 17:23 Bryan O'Donoghue [this message]
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
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=1366392183-4149-1-git-send-email-bryan.odonoghue.lkml@nexus-software.ie \
--to=bryan.odonoghue.lkml@nexus-software.ie \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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
LKML Archive on lore.kernel.org
Archives are clonable:
git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
linux-kernel@vger.kernel.org
public-inbox-index lkml
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git