Skip to content

Commit 174f1b9

Browse files
ashok-rajbp3tk0v
authored andcommitted
x86/microcode/intel: Pass the microcode revision to print_ucode_info() directly
print_ucode_info() takes a struct ucode_cpu_info pointer as parameter. Its sole purpose is to print the microcode revision. The only available ucode_cpu_info always describes the currently loaded microcode revision. After a microcode update is successful, this is the new revision, or on failure it is the original revision. In preparation for future changes, replace the struct ucode_cpu_info pointer parameter with a plain integer which contains the revision number and adjust the call sites accordingly. No functional change. [ bp: - Fix + cleanup commit message. - Revert arbitrary, unrelated change. ] 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 6eab3ab commit 174f1b9

File tree

1 file changed

+9
-21
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+9
-21
lines changed

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

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,10 @@ static bool load_builtin_intel_microcode(struct cpio_data *cp)
308308
/*
309309
* Print ucode update info.
310310
*/
311-
static void
312-
print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
311+
static void print_ucode_info(unsigned int new_rev, unsigned int date)
313312
{
314313
pr_info_once("microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n",
315-
uci->cpu_sig.rev,
314+
new_rev,
316315
date & 0xffff,
317316
date >> 24,
318317
(date >> 16) & 0xff);
@@ -332,7 +331,7 @@ void show_ucode_info_early(void)
332331

333332
if (delay_ucode_info) {
334333
intel_cpu_collect_info(&uci);
335-
print_ucode_info(&uci, current_mc_date);
334+
print_ucode_info(uci.cpu_sig.rev, current_mc_date);
336335
delay_ucode_info = 0;
337336
}
338337
}
@@ -341,33 +340,22 @@ void show_ucode_info_early(void)
341340
* At this point, we can not call printk() yet. Delay printing microcode info in
342341
* show_ucode_info_early() until printk() works.
343342
*/
344-
static void print_ucode(struct ucode_cpu_info *uci)
343+
static void print_ucode(int new_rev, int date)
345344
{
346-
struct microcode_intel *mc;
347345
int *delay_ucode_info_p;
348346
int *current_mc_date_p;
349347

350-
mc = uci->mc;
351-
if (!mc)
352-
return;
353-
354348
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
355349
current_mc_date_p = (int *)__pa_nodebug(&current_mc_date);
356350

357351
*delay_ucode_info_p = 1;
358-
*current_mc_date_p = mc->hdr.date;
352+
*current_mc_date_p = date;
359353
}
360354
#else
361355

362-
static inline void print_ucode(struct ucode_cpu_info *uci)
356+
static inline void print_ucode(int new_rev, int date)
363357
{
364-
struct microcode_intel *mc;
365-
366-
mc = uci->mc;
367-
if (!mc)
368-
return;
369-
370-
print_ucode_info(uci, mc->hdr.date);
358+
print_ucode_info(new_rev, date);
371359
}
372360
#endif
373361

@@ -407,9 +395,9 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
407395
uci->cpu_sig.rev = rev;
408396

409397
if (early)
410-
print_ucode(uci);
398+
print_ucode(uci->cpu_sig.rev, mc->hdr.date);
411399
else
412-
print_ucode_info(uci, mc->hdr.date);
400+
print_ucode_info(uci->cpu_sig.rev, mc->hdr.date);
413401

414402
return 0;
415403
}

0 commit comments

Comments
 (0)