Skip to content

Commit ef34ba6

Browse files
committed
Merge tag 'x86_microcode_for_5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 microcode update from Borislav Petkov: "A single fix for late microcode loading to handle the correct return value from stop_machine(), from Mihai Carabas" * tag 'x86_microcode_for_5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/microcode: Fix return value for microcode late loading
2 parents 8b11dd5 + 9adbf3c commit ef34ba6

File tree

1 file changed

+7
-8
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,7 @@ static int __wait_for_cpus(atomic_t *t, long long timeout)
545545
/*
546546
* Returns:
547547
* < 0 - on error
548-
* 0 - no update done
549-
* 1 - microcode was updated
548+
* 0 - success (no update done or microcode was updated)
550549
*/
551550
static int __reload_late(void *info)
552551
{
@@ -573,11 +572,11 @@ static int __reload_late(void *info)
573572
else
574573
goto wait_for_siblings;
575574

576-
if (err > UCODE_NFOUND) {
577-
pr_warn("Error reloading microcode on CPU %d\n", cpu);
575+
if (err >= UCODE_NFOUND) {
576+
if (err == UCODE_ERROR)
577+
pr_warn("Error reloading microcode on CPU %d\n", cpu);
578+
578579
ret = -1;
579-
} else if (err == UCODE_UPDATED || err == UCODE_OK) {
580-
ret = 1;
581580
}
582581

583582
wait_for_siblings:
@@ -608,7 +607,7 @@ static int microcode_reload_late(void)
608607
atomic_set(&late_cpus_out, 0);
609608

610609
ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
611-
if (ret > 0)
610+
if (ret == 0)
612611
microcode_check();
613612

614613
pr_info("Reload completed, microcode revision: 0x%x\n", boot_cpu_data.microcode);
@@ -649,7 +648,7 @@ static ssize_t reload_store(struct device *dev,
649648
put:
650649
put_online_cpus();
651650

652-
if (ret >= 0)
651+
if (ret == 0)
653652
ret = size;
654653

655654
return ret;

0 commit comments

Comments
 (0)