| 1 |
From cfb52a5a09c8ae3a1dafb44ce549fde5b69e8117 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Borislav Petkov <[email protected]> |
| 3 |
Date: Wed, 28 Feb 2018 11:28:45 +0100 |
| 4 |
Subject: x86/microcode: Request microcode on the BSP |
| 5 |
|
| 6 |
... so that any newer version can land in the cache and can later be |
| 7 |
fished out by the application functions. Do that before grabbing the |
| 8 |
hotplug lock. |
| 9 |
|
| 10 |
Signed-off-by: Borislav Petkov <[email protected]> |
| 11 |
Signed-off-by: Thomas Gleixner <[email protected]> |
| 12 |
Tested-by: Tom Lendacky <[email protected]> |
| 13 |
Tested-by: Ashok Raj <[email protected]> |
| 14 |
Reviewed-by: Tom Lendacky <[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/core.c | 11 +++++------ |
| 19 |
1 file changed, 5 insertions(+), 6 deletions(-) |
| 20 |
|
| 21 |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
| 22 |
index fa32cb3..5dd157d 100644 |
| 23 |
--- a/arch/x86/kernel/cpu/microcode/core.c |
| 24 |
+++ b/arch/x86/kernel/cpu/microcode/core.c |
| 25 |
@@ -499,15 +499,10 @@ static int check_online_cpus(void) |
| 26 |
static enum ucode_state reload_for_cpu(int cpu) |
| 27 |
{ |
| 28 |
struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
| 29 |
- enum ucode_state ustate; |
| 30 |
|
| 31 |
if (!uci->valid) |
| 32 |
return UCODE_OK; |
| 33 |
|
| 34 |
- ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev, true); |
| 35 |
- if (ustate != UCODE_OK) |
| 36 |
- return ustate; |
| 37 |
- |
| 38 |
return apply_microcode_on_target(cpu); |
| 39 |
} |
| 40 |
|
| 41 |
@@ -515,11 +510,11 @@ static ssize_t reload_store(struct device *dev, |
| 42 |
struct device_attribute *attr, |
| 43 |
const char *buf, size_t size) |
| 44 |
{ |
| 45 |
+ int cpu, bsp = boot_cpu_data.cpu_index; |
| 46 |
enum ucode_state tmp_ret = UCODE_OK; |
| 47 |
bool do_callback = false; |
| 48 |
unsigned long val; |
| 49 |
ssize_t ret = 0; |
| 50 |
- int cpu; |
| 51 |
|
| 52 |
ret = kstrtoul(buf, 0, &val); |
| 53 |
if (ret) |
| 54 |
@@ -528,6 +523,10 @@ static ssize_t reload_store(struct device *dev, |
| 55 |
if (val != 1) |
| 56 |
return size; |
| 57 |
|
| 58 |
+ tmp_ret = microcode_ops->request_microcode_fw(bsp, µcode_pdev->dev, true); |
| 59 |
+ if (tmp_ret != UCODE_OK) |
| 60 |
+ return size; |
| 61 |
+ |
| 62 |
get_online_cpus(); |
| 63 |
|
| 64 |
ret = check_online_cpus(); |
| 65 |
-- |
| 66 |
cgit v1.1 |
| 67 |
|