From 757885e94a22bcc82beb9b1445c95218cb20ceab Mon Sep 17 00:00:00 2001 From: Jacob Shin Date: Thu, 30 May 2013 14:09:19 -0500 Subject: x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.shin@amd.com Signed-off-by: H. Peter Anvin Cc: Fenghua Yu --- arch/x86/Kconfig | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'arch/x86/Kconfig') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 685692c94f05..28dba52af514 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1058,8 +1058,16 @@ config MICROCODE_INTEL_LIB depends on MICROCODE_INTEL config MICROCODE_INTEL_EARLY + def_bool n + +config MICROCODE_AMD_EARLY + def_bool n + +config MICROCODE_EARLY bool "Early load microcode" - depends on MICROCODE_INTEL && BLK_DEV_INITRD + depends on (MICROCODE_INTEL || MICROCODE_AMD) && BLK_DEV_INITRD + select MICROCODE_INTEL_EARLY if MICROCODE_INTEL + select MICROCODE_AMD_EARLY if MICROCODE_AMD default y help This option provides functionality to read additional microcode data @@ -1067,10 +1075,6 @@ config MICROCODE_INTEL_EARLY microcode to CPU's as early as possible. No functional change if no microcode data is glued to the initrd, therefore it's safe to say Y. -config MICROCODE_EARLY - def_bool y - depends on MICROCODE_INTEL_EARLY - config X86_MSR tristate "/dev/cpu/*/msr - Model-specific register support" ---help--- -- cgit v1.2.3-59-g8ed1b From 6b3389ac21b5e557b957f1497d0ff22bf733e8c3 Mon Sep 17 00:00:00 2001 From: Jacob Shin Date: Fri, 31 May 2013 01:53:24 -0500 Subject: x86, microcode, amd: Fix warnings and errors on with CONFIG_MICROCODE=m Fix section mismatch warnings on microcode_amd_early. Compile error occurs when CONFIG_MICROCODE=m, change so that early loading depends on microcode_core. Reported-by: Yinghai Lu Reported-by: Borislav Petkov Signed-off-by: Jacob Shin Link: http://lkml.kernel.org/r/20130531150241.GA12006@jshin-Toonie Signed-off-by: H. Peter Anvin --- arch/x86/Kconfig | 2 +- arch/x86/include/asm/microcode_amd.h | 2 +- arch/x86/kernel/microcode_amd_early.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/x86/Kconfig') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 28dba52af514..270553266297 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1065,7 +1065,7 @@ config MICROCODE_AMD_EARLY config MICROCODE_EARLY bool "Early load microcode" - depends on (MICROCODE_INTEL || MICROCODE_AMD) && BLK_DEV_INITRD + depends on MICROCODE=y && BLK_DEV_INITRD select MICROCODE_INTEL_EARLY if MICROCODE_INTEL select MICROCODE_AMD_EARLY if MICROCODE_AMD default y diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 24254aaa857f..c6b043f40271 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -64,7 +64,7 @@ extern enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size) #ifdef CONFIG_MICROCODE_AMD_EARLY #ifdef CONFIG_X86_32 #define MPB_MAX_SIZE PAGE_SIZE -extern u8 __cpuinitdata amd_bsp_mpb[MPB_MAX_SIZE]; +extern u8 amd_bsp_mpb[MPB_MAX_SIZE]; #endif extern void __init load_ucode_amd_bsp(void); extern void __cpuinit load_ucode_amd_ap(void); diff --git a/arch/x86/kernel/microcode_amd_early.c b/arch/x86/kernel/microcode_amd_early.c index 7e54d97c714a..9618805ce6d7 100644 --- a/arch/x86/kernel/microcode_amd_early.c +++ b/arch/x86/kernel/microcode_amd_early.c @@ -21,9 +21,9 @@ static u32 ucode_new_rev; * Microcode patch container file is prepended to the initrd in cpio format. * See Documentation/x86/early-microcode.txt */ -static __initdata char ucode_path[] = "kernel/x86/microcode/AuthenticAMD.bin"; +static __cpuinitdata char ucode_path[] = "kernel/x86/microcode/AuthenticAMD.bin"; -static struct cpio_data __init find_ucode_in_initrd(void) +static struct cpio_data __cpuinit find_ucode_in_initrd(void) { long offset = 0; struct cpio_data cd; @@ -62,7 +62,7 @@ static struct cpio_data __init find_ucode_in_initrd(void) * load_microcode_amd() to save equivalent cpu table and microcode patches in * kernel heap memory. */ -static void __init apply_ucode_in_initrd(void) +static void __cpuinit apply_ucode_in_initrd(void) { struct cpio_data cd; struct equiv_cpu_entry *eq; @@ -133,7 +133,7 @@ void __init load_ucode_amd_bsp(void) } #ifdef CONFIG_X86_32 -u8 __cpuinitdata amd_bsp_mpb[MPB_MAX_SIZE]; +u8 amd_bsp_mpb[MPB_MAX_SIZE]; /* * On 32-bit, since AP's early load occurs before paging is turned on, we -- cgit v1.2.3-59-g8ed1b