| 1 |
From d8c3b52c00a05036e0a6b315b4b17921a7b67997 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Borislav Petkov <[email protected]> |
| 3 |
Date: Wed, 28 Feb 2018 11:28:44 +0100 |
| 4 |
Subject: x86/microcode/intel: Look into the patch cache first |
| 5 |
|
| 6 |
The cache might contain a newer patch - look in there first. |
| 7 |
|
| 8 |
A follow-on change will make sure newest patches are loaded into the |
| 9 |
cache of microcode patches. |
| 10 |
|
| 11 |
Signed-off-by: Borislav Petkov <[email protected]> |
| 12 |
Signed-off-by: Thomas Gleixner <[email protected]> |
| 13 |
Tested-by: Tom Lendacky <[email protected]> |
| 14 |
Tested-by: Ashok Raj <[email protected]> |
| 15 |
Cc: Arjan Van De Ven <[email protected]> |
| 16 |
Link: https://lkml.kernel.org/r/[email protected] |
| 17 |
--- |
| 18 |
arch/x86/kernel/cpu/microcode/intel.c | 11 +++++------ |
| 19 |
1 file changed, 5 insertions(+), 6 deletions(-) |
| 20 |
|
| 21 |
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c |
| 22 |
index e2864bc..2aded9d 100644 |
| 23 |
--- a/arch/x86/kernel/cpu/microcode/intel.c |
| 24 |
+++ b/arch/x86/kernel/cpu/microcode/intel.c |
| 25 |
@@ -791,9 +791,9 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) |
| 26 |
|
| 27 |
static enum ucode_state apply_microcode_intel(int cpu) |
| 28 |
{ |
| 29 |
- struct microcode_intel *mc; |
| 30 |
- struct ucode_cpu_info *uci; |
| 31 |
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 32 |
struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 33 |
+ struct microcode_intel *mc; |
| 34 |
static int prev_rev; |
| 35 |
u32 rev; |
| 36 |
|
| 37 |
@@ -801,11 +801,10 @@ static enum ucode_state apply_microcode_intel(int cpu) |
| 38 |
if (WARN_ON(raw_smp_processor_id() != cpu)) |
| 39 |
return UCODE_ERROR; |
| 40 |
|
| 41 |
- uci = ucode_cpu_info + cpu; |
| 42 |
- mc = uci->mc; |
| 43 |
+ /* Look for a newer patch in our cache: */ |
| 44 |
+ mc = find_patch(uci); |
| 45 |
if (!mc) { |
| 46 |
- /* Look for a newer patch in our cache: */ |
| 47 |
- mc = find_patch(uci); |
| 48 |
+ mc = uci->mc; |
| 49 |
if (!mc) |
| 50 |
return UCODE_NFOUND; |
| 51 |
} |
| 52 |
-- |
| 53 |
cgit v1.1 |
| 54 |
|