80 lines
2.5 KiB
Diff
80 lines
2.5 KiB
Diff
From f19ca27f91db6320d02ba1cd28751a217616e282 Mon Sep 17 00:00:00 2001
|
|
From: Mihai Carabas <mihai.carabas@oracle.com>
|
|
Date: Tue, 21 Apr 2020 22:28:38 +0300
|
|
Subject: [PATCH 12/36] x86/microcode: Fix return value for microcode late
|
|
loading
|
|
|
|
The return value from stop_machine() might not be consistent.
|
|
|
|
stop_machine_cpuslocked() returns:
|
|
- zero if all functions have returned 0.
|
|
- a non-zero value if at least one of the functions returned
|
|
a non-zero value.
|
|
|
|
There is no way to know if it is negative or positive. So make
|
|
__reload_late() return 0 on success or negative otherwise.
|
|
|
|
[ bp: Unify ret val check and touch up. ]
|
|
|
|
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
|
|
Signed-off-by: Borislav Petkov <bp@suse.de>
|
|
Link: https://lkml.kernel.org/r/1587497318-4438-1-git-send-email-mihai.carabas@oracle.com
|
|
(cherry picked from commit 9adbf3c609af92a57a73000a3cb8f4c2d307dfa3)
|
|
Signed-off-by: Mridula Shastry <mridula.c.shastry@oracle.com>
|
|
Reviewed-by: Todd Vierling <todd.vierling@oracle.com>
|
|
---
|
|
arch/x86/kernel/cpu/microcode/core.c | 15 +++++++--------
|
|
1 file changed, 7 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
|
|
index 50321a43da01..36f78ceca5f2 100644
|
|
--- a/arch/x86/kernel/cpu/microcode/core.c
|
|
+++ b/arch/x86/kernel/cpu/microcode/core.c
|
|
@@ -400,8 +400,7 @@ static int __wait_for_cpus(atomic_t *t, long long timeout)
|
|
/*
|
|
* Returns:
|
|
* < 0 - on error
|
|
- * 0 - no update done
|
|
- * 1 - microcode was updated
|
|
+ * 0 - success (no update done or microcode was updated)
|
|
*/
|
|
static int __reload_late(void *info)
|
|
{
|
|
@@ -428,11 +427,11 @@ static int __reload_late(void *info)
|
|
else
|
|
goto wait_for_siblings;
|
|
|
|
- if (err > UCODE_NFOUND) {
|
|
- pr_warn("Error reloading microcode on CPU %d\n", cpu);
|
|
+ if (err >= UCODE_NFOUND) {
|
|
+ if (err == UCODE_ERROR)
|
|
+ pr_warn("Error reloading microcode on CPU %d\n", cpu);
|
|
+
|
|
ret = -1;
|
|
- } else if (err == UCODE_UPDATED || err == UCODE_OK) {
|
|
- ret = 1;
|
|
}
|
|
|
|
wait_for_siblings:
|
|
@@ -466,7 +465,7 @@ static int microcode_reload_late(void)
|
|
atomic_set(&late_cpus_out, 0);
|
|
|
|
ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
|
|
- if (ret > 0)
|
|
+ if (ret == 0)
|
|
microcode_check();
|
|
|
|
pr_info("Reload completed, microcode revision: 0x%x -> 0x%x\n",
|
|
@@ -508,7 +507,7 @@ static ssize_t reload_store(struct device *dev,
|
|
put:
|
|
put_online_cpus();
|
|
|
|
- if (ret >= 0)
|
|
+ if (ret == 0)
|
|
ret = size;
|
|
|
|
add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
|
|
--
|
|
2.39.3
|
|
|