On Fri, 2023-03-10 at 14:38 +0100, Greg Kroah-Hartman wrote:
From: Borislav Petkov (AMD) bp@alien8.de
commit 2355370cd941cbb20882cc3f34460f9f2b8f9a18 upstream.
It is always the BSP.
No functional changes.
Does this not depend on commit 2071c0aeda22 "x86/microcode: Simplify init path even more"? That hasn't been backported to any stable branches.
Ben.
Signed-off-by: Borislav Petkov (AMD) bp@alien8.de Link: https://lore.kernel.org/r/20230130161709.11615-2-bp@alien8.de Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
arch/x86/kernel/cpu/microcode/amd.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
--- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -329,8 +329,7 @@ void load_ucode_amd_ap(unsigned int cpui apply_microcode_early_amd(cpuid_1_eax, cp.data, cp.size, false); } -static enum ucode_state -load_microcode_amd(bool save, u8 family, const u8 *data, size_t size); +static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size); int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax) { @@ -348,7 +347,7 @@ int __init save_microcode_in_initrd_amd( if (!desc.mc) return -EINVAL;
- ret = load_microcode_amd(true, x86_family(cpuid_1_eax), desc.data, desc.size);
- ret = load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size); if (ret > UCODE_UPDATED) return -EINVAL;
@@ -698,8 +697,7 @@ static enum ucode_state __load_microcode return UCODE_OK; } -static enum ucode_state -load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) +static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size) { struct ucode_patch *p; enum ucode_state ret; @@ -723,10 +721,6 @@ load_microcode_amd(bool save, u8 family, ret = UCODE_NEW; }
- /* save BSP's matching patch for early load */
- if (!save)
return ret;
- memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE));
@@ -754,12 +748,11 @@ static enum ucode_state request_microcod { char fw_name[36] = "amd-ucode/microcode_amd.bin"; struct cpuinfo_x86 *c = &cpu_data(cpu);
- bool bsp = c->cpu_index == boot_cpu_data.cpu_index; enum ucode_state ret = UCODE_NFOUND; const struct firmware *fw;
/* reload ucode container only on the boot cpu */
- if (!refresh_fw || !bsp)
- if (!refresh_fw) return UCODE_OK;
if (c->x86 >= 0x15) @@ -776,7 +769,7 @@ static enum ucode_state request_microcod goto fw_release; }
- ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
- ret = load_microcode_amd(c->x86, fw->data, fw->size);
fw_release: release_firmware(fw);