diff options
author | Jacob Shin <jacob.shin@amd.com> | 2013-05-30 21:09:19 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-05-31 05:19:25 +0200 |
commit | 757885e94a22bcc82beb9b1445c95218cb20ceab (patch) | |
tree | 1cda49972f875326d47d1e140e190b7a1e9095d3 /arch/x86/kernel/microcode_amd.c | |
parent | x86, microcode, amd: Refactor functions to prepare for early loading (diff) | |
download | linux-757885e94a22bcc82beb9b1445c95218cb20ceab.tar.xz linux-757885e94a22bcc82beb9b1445c95218cb20ceab.zip |
x86, microcode, amd: Early microcode patch loading support for AMD
Add early microcode patch loading support for AMD.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.shin@amd.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 8f11f8f90e98..47ebb1dbfbcb 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -126,9 +126,20 @@ static struct ucode_patch *find_patch(unsigned int cpu) static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) { struct cpuinfo_x86 *c = &cpu_data(cpu); + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + struct ucode_patch *p; csig->sig = cpuid_eax(0x00000001); csig->rev = c->microcode; + + /* + * a patch could have been loaded early, set uci->mc so that + * mc_bp_resume() can call apply_microcode() + */ + p = find_patch(cpu); + if (p && (p->patch_id == csig->rev)) + uci->mc = p->data; + pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); return 0; @@ -373,6 +384,17 @@ enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size) if (ret != UCODE_OK) cleanup(); +#if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32) + /* save BSP's matching patch for early load */ + if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) { + struct ucode_patch *p = find_patch(cpu); + if (p) { + memset(amd_bsp_mpb, 0, MPB_MAX_SIZE); + memcpy(amd_bsp_mpb, p->data, min_t(u32, ksize(p->data), + MPB_MAX_SIZE)); + } + } +#endif return ret; } |