Skip to content

Commit a9a5cac

Browse files
ashok-rajbp3tk0v
authored andcommitted
x86/microcode/intel: Print old and new revision during early boot
Make early loading message match late loading message and print both old and new revisions. This is helpful to know what the BIOS loaded revision is before an early update. Cache the early BIOS revision before the microcode update and have print_ucode_info() print both the old and new revision in the same format as microcode_reload_late(). [ bp: Massage, remove useless comment. ] Signed-off-by: Ashok Raj <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 174f1b9 commit a9a5cac

File tree

1 file changed

+16
-12
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+16
-12
lines changed

arch/x86/kernel/cpu/microcode/intel.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,10 @@ static bool load_builtin_intel_microcode(struct cpio_data *cp)
305305
return false;
306306
}
307307

308-
/*
309-
* Print ucode update info.
310-
*/
311-
static void print_ucode_info(unsigned int new_rev, unsigned int date)
308+
static void print_ucode_info(int old_rev, int new_rev, unsigned int date)
312309
{
313-
pr_info_once("microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n",
310+
pr_info_once("updated early: 0x%x -> 0x%x, date = %04x-%02x-%02x\n",
311+
old_rev,
314312
new_rev,
315313
date & 0xffff,
316314
date >> 24,
@@ -321,6 +319,7 @@ static void print_ucode_info(unsigned int new_rev, unsigned int date)
321319

322320
static int delay_ucode_info;
323321
static int current_mc_date;
322+
static int early_old_rev;
324323

325324
/*
326325
* Print early updated ucode info after printk works. This is delayed info dump.
@@ -331,7 +330,7 @@ void show_ucode_info_early(void)
331330

332331
if (delay_ucode_info) {
333332
intel_cpu_collect_info(&uci);
334-
print_ucode_info(uci.cpu_sig.rev, current_mc_date);
333+
print_ucode_info(early_old_rev, uci.cpu_sig.rev, current_mc_date);
335334
delay_ucode_info = 0;
336335
}
337336
}
@@ -340,29 +339,32 @@ void show_ucode_info_early(void)
340339
* At this point, we can not call printk() yet. Delay printing microcode info in
341340
* show_ucode_info_early() until printk() works.
342341
*/
343-
static void print_ucode(int new_rev, int date)
342+
static void print_ucode(int old_rev, int new_rev, int date)
344343
{
345344
int *delay_ucode_info_p;
346345
int *current_mc_date_p;
346+
int *early_old_rev_p;
347347

348348
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
349349
current_mc_date_p = (int *)__pa_nodebug(&current_mc_date);
350+
early_old_rev_p = (int *)__pa_nodebug(&early_old_rev);
350351

351352
*delay_ucode_info_p = 1;
352353
*current_mc_date_p = date;
354+
*early_old_rev_p = old_rev;
353355
}
354356
#else
355357

356-
static inline void print_ucode(int new_rev, int date)
358+
static inline void print_ucode(int old_rev, int new_rev, int date)
357359
{
358-
print_ucode_info(new_rev, date);
360+
print_ucode_info(old_rev, new_rev, date);
359361
}
360362
#endif
361363

362364
static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
363365
{
364366
struct microcode_intel *mc;
365-
u32 rev;
367+
u32 rev, old_rev;
366368

367369
mc = uci->mc;
368370
if (!mc)
@@ -379,6 +381,8 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
379381
return UCODE_OK;
380382
}
381383

384+
old_rev = rev;
385+
382386
/*
383387
* Writeback and invalidate caches before updating microcode to avoid
384388
* internal issues depending on what the microcode is updating.
@@ -395,9 +399,9 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
395399
uci->cpu_sig.rev = rev;
396400

397401
if (early)
398-
print_ucode(uci->cpu_sig.rev, mc->hdr.date);
402+
print_ucode(old_rev, uci->cpu_sig.rev, mc->hdr.date);
399403
else
400-
print_ucode_info(uci->cpu_sig.rev, mc->hdr.date);
404+
print_ucode_info(old_rev, uci->cpu_sig.rev, mc->hdr.date);
401405

402406
return 0;
403407
}

0 commit comments

Comments
 (0)