From: Petr Oros <poros@redhat.com>
To: bp@alien8.de
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/microcode/intel: print previous microcode revision during early update
Date: Fri, 26 Jan 2018 11:34:50 +0100 [thread overview]
Message-ID: <20180126103451.16863-1-poros@redhat.com> (raw)
When kernel do early microcode update, code printing only
new microcode version. But in this case we no have chance
to check which version was in cpu from BIOS vendor.
Patch add this info into output message.
Signed-off-by: Petr Oros <poros@redhat.com>
---
arch/x86/kernel/cpu/microcode/intel.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index d9e460fc7a3b..78330d29cd4c 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -515,9 +515,11 @@ static bool load_builtin_intel_microcode(struct cpio_data *cp)
* Print ucode update info.
*/
static void
-print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
+print_ucode_info(struct ucode_cpu_info *uci, unsigned int date,
+ unsigned int prev_rev)
{
- pr_info_once("microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n",
+ pr_info_once("microcode updated early from revision 0x%x to 0x%x, date = %04x-%02x-%02x\n",
+ prev_rev,
uci->cpu_sig.rev,
date & 0xffff,
date >> 24,
@@ -528,6 +530,7 @@ print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
static int delay_ucode_info;
static int current_mc_date;
+static int prev_revision;
/*
* Print early updated ucode info after printk works. This is delayed info dump.
@@ -538,7 +541,7 @@ void show_ucode_info_early(void)
if (delay_ucode_info) {
collect_cpu_info_early(&uci);
- print_ucode_info(&uci, current_mc_date);
+ print_ucode_info(&uci, current_mc_date, prev_revision);
delay_ucode_info = 0;
}
}
@@ -547,11 +550,12 @@ void show_ucode_info_early(void)
* At this point, we can not call printk() yet. Delay printing microcode info in
* show_ucode_info_early() until printk() works.
*/
-static void print_ucode(struct ucode_cpu_info *uci)
+static void print_ucode(struct ucode_cpu_info *uci, unsigned int prev_rev)
{
struct microcode_intel *mc;
int *delay_ucode_info_p;
int *current_mc_date_p;
+ int *prev_revision_p;
mc = uci->mc;
if (!mc)
@@ -559,13 +563,16 @@ static void print_ucode(struct ucode_cpu_info *uci)
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date);
+ prev_revision_p = (int *)__pa_nodebug(&prev_revision);
*delay_ucode_info_p = 1;
*current_mc_date_p = mc->hdr.date;
+ *prev_revision_p = prev_rev;
}
#else
-static inline void print_ucode(struct ucode_cpu_info *uci)
+static inline void print_ucode(struct ucode_cpu_info *uci,
+ unsigned int prev_rev)
{
struct microcode_intel *mc;
@@ -573,19 +580,21 @@ static inline void print_ucode(struct ucode_cpu_info *uci)
if (!mc)
return;
- print_ucode_info(uci, mc->hdr.date);
+ print_ucode_info(uci, mc->hdr.date, prev_rev);
}
#endif
static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
{
struct microcode_intel *mc;
- u32 rev;
+ u32 rev, prev_rev;
mc = uci->mc;
if (!mc)
return 0;
+ prev_rev = intel_get_microcode_revision();
+
/* write microcode via MSR 0x79 */
native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);
@@ -596,9 +605,9 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
uci->cpu_sig.rev = rev;
if (early)
- print_ucode(uci);
+ print_ucode(uci, prev_rev);
else
- print_ucode_info(uci, mc->hdr.date);
+ print_ucode_info(uci, mc->hdr.date, prev_rev);
return 0;
}
--
2.16.1
next reply other threads:[~2018-01-26 10:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 10:34 Petr Oros [this message]
2018-01-26 10:41 ` Borislav Petkov
2018-01-26 11:45 ` Petr Oros
2018-01-26 11:58 ` Borislav Petkov
2018-01-26 13:50 ` Petr Oros
2018-01-26 14:49 ` Borislav Petkov
2018-02-01 18:40 ` Petr Oros
2018-02-07 14:02 ` Stanislav Kozina
2018-02-07 15:21 ` Borislav Petkov
2018-02-07 20:05 ` Stanislav Kozina
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=20180126103451.16863-1-poros@redhat.com \
--to=poros@redhat.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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
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
all inboxes | Powered by JetHome®