From: Ashok Raj <ashok.raj@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86-kernel <x86@kernel.org>,
LKML Mailing List <linux-kernel@vger.kernel.org>,
Ashok Raj <ashok.raj@intel.com>,
Dave Hansen <dave.hansen@intel.com>,
Tony Luck <tony.luck@intel.com>,
alison.schofield@intel.com, reinette.chatre@intel.com
Subject: [Patch V1 7/7] x86/microcode/intel: Print when early microcode loading fails
Date: Tue, 29 Nov 2022 13:08:32 -0800 [thread overview]
Message-ID: <20221129210832.107850-8-ashok.raj@intel.com> (raw)
In-Reply-To: <20221129210832.107850-1-ashok.raj@intel.com>
Currently when early microcode loading fails there is no way for user to
know that the update failed.
Store the failed status and pass it to print_ucode_info() to let early
loading failures to captured in console log.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
---
arch/x86/kernel/cpu/microcode/intel.c | 29 ++++++++++++++++-----------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 3dbcf457f45d..3b299f437e35 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -309,13 +309,14 @@ static bool load_builtin_intel_microcode(struct cpio_data *cp)
* Print ucode update info.
*/
static void
-print_ucode_info(int old_rev, int new_rev, unsigned int date)
+print_ucode_info(bool failed, int old_rev, int new_rev, unsigned int date)
{
- pr_info_once("early update: 0x%x -> 0x%x, date = %04x-%02x-%02x\n",
+ pr_info_once("early update: 0x%x -> 0x%x, date = %04x-%02x-%02x %s\n",
old_rev, new_rev,
date & 0xffff,
date >> 24,
- (date >> 16) & 0xff);
+ (date >> 16) & 0xff,
+ failed ? "FAILED" : "");
}
#ifdef CONFIG_X86_32
@@ -323,6 +324,7 @@ print_ucode_info(int old_rev, int new_rev, unsigned int date)
static int delay_ucode_info;
static int current_mc_date;
static int early_old_rev;
+static bool early_failed;
/*
* Print early updated ucode info after printk works. This is delayed info dump.
@@ -333,7 +335,7 @@ void show_ucode_info_early(void)
if (delay_ucode_info) {
intel_cpu_collect_info(&uci);
- print_ucode_info(early_old_rev, uci.cpu_sig.rev, current_mc_date);
+ print_ucode_info(early_failed, early_old_rev, uci.cpu_sig.rev, current_mc_date);
delay_ucode_info = 0;
}
}
@@ -342,26 +344,28 @@ 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(int old_rev, int new_rev, int date)
+static void print_ucode(bool failed, int old_rev, int new_rev, int date)
{
- struct microcode_intel *mc;
int *delay_ucode_info_p;
int *current_mc_date_p;
int *early_old_rev_p;
+ bool *early_failed_p;
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date);
early_old_rev_p = (int *)__pa_nodebug(&early_old_rev);
+ early_failed_p = (int *)__pa_nodebug(&early_failed);
*delay_ucode_info_p = 1;
*current_mc_date_p = date;
*early_old_rev_p = old_rev;
+ *early_failed_p = failed;
}
#else
-static inline void print_ucode(int old_rev, int new_rev, int date)
+static inline void print_ucode(bool failed, int old_rev, int new_rev, int date)
{
- print_ucode_info(old_rev, new_rev, date);
+ print_ucode_info(failed, old_rev, new_rev, date);
}
#endif
@@ -369,6 +373,7 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
{
struct microcode_intel *mc;
u32 rev, old_rev;
+ int retval = 0;
mc = uci->mc;
if (!mc)
@@ -397,16 +402,16 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
old_rev = rev;
rev = intel_get_microcode_revision();
if (rev != mc->hdr.rev)
- return -1;
+ retval = -1;
uci->cpu_sig.rev = rev;
if (early)
- print_ucode(old_rev, uci->cpu_sig.rev, mc->hdr.date);
+ print_ucode(retval, old_rev, mc->hdr.rev, mc->hdr.date);
else
- print_ucode_info(old_rev, uci->cpu_sig.rev, mc->hdr.date);
+ print_ucode_info(retval, old_rev, uci->cpu_sig.rev, mc->hdr.date);
- return 0;
+ return retval;
}
int __init save_microcode_in_initrd_intel(void)
--
2.34.1
next prev parent reply other threads:[~2022-11-29 21:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 21:08 [Patch V1 0/7] x86/microcode: Some cleanups and fixes for microcode Ashok Raj
2022-11-29 21:08 ` [Patch V1 1/7] x86/microcode/intel: Remove redundant microcode rev pr_info()s Ashok Raj
2022-12-02 18:58 ` Thomas Gleixner
2022-12-03 0:26 ` Ashok Raj
2022-12-03 13:42 ` Borislav Petkov
2022-11-29 21:08 ` [Patch V1 2/7] x86/microcode/intel: Remove retries on early microcode load Ashok Raj
2022-12-02 19:01 ` Thomas Gleixner
2022-12-03 1:48 ` Ashok Raj
2022-12-02 23:53 ` Sohil Mehta
2022-12-03 1:47 ` Ashok Raj
2022-12-05 12:18 ` Borislav Petkov
2022-12-05 16:42 ` Ashok Raj
2022-12-05 20:53 ` [tip: x86/microcode] x86/microcode/intel: Do not retry microcode reloading on the APs tip-bot2 for Ashok Raj
2022-11-29 21:08 ` [Patch V1 3/7] x86/microcode/core: Move microcode_check() to cpu/microcode/core.c Ashok Raj
2022-12-02 19:02 ` Thomas Gleixner
2022-12-02 20:57 ` Sohil Mehta
2022-12-03 0:21 ` Ashok Raj
2022-12-05 16:25 ` Borislav Petkov
2022-12-05 17:05 ` Ashok Raj
2022-12-05 21:27 ` Borislav Petkov
2022-11-29 21:08 ` [Patch V1 4/7] x86/microcode/core: Take a snapshot before and after applying microcode Ashok Raj
2022-12-02 19:09 ` Thomas Gleixner
2022-12-03 1:57 ` Ashok Raj
2022-12-07 20:25 ` Borislav Petkov
2022-12-08 0:05 ` Ashok Raj
2022-11-29 21:08 ` [Patch V1 5/7] x86/microcode/intel: Prepare the print_ucode_rev to simply take a rev to print Ashok Raj
2022-12-02 19:23 ` Thomas Gleixner
2022-11-29 21:08 ` [Patch V1 6/7] x86/microcode/intel: Print old and new rev during early boot Ashok Raj
2022-12-02 19:29 ` Thomas Gleixner
2022-11-29 21:08 ` Ashok Raj [this message]
2022-12-02 19:30 ` [Patch V1 7/7] x86/microcode/intel: Print when early microcode loading fails Thomas Gleixner
2022-12-05 18:19 ` Ashok Raj
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=20221129210832.107850-8-ashok.raj@intel.com \
--to=ashok.raj@intel.com \
--cc=alison.schofield@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--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®