Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Fri, May 31, 2013 at 08:13:09AM -0700, H. Peter Anvin wrote: > If you send a patch with text above the patch, please include a scissor > line: > > ---8<--- > > ... above the patch so that git tools can process it. Ah okay, sorry about that, will do so from now on. Yinghai, Boris, sorry if you have to hand snip my previous fix email, but please do let me know if I can add your Tested-by's Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
If you send a patch with text above the patch, please include a scissor line: ---8<--- ... above the patch so that git tools can process it. -hpa -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Fri, May 31, 2013 at 10:41:33AM +0200, Borislav Petkov wrote: > On Thu, May 30, 2013 at 08:31:08PM -0700, tip-bot for Jacob Shin wrote: > > Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab > > Gitweb: > > http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab > > Author: Jacob Shin > > AuthorDate: Thu, 30 May 2013 14:09:19 -0500 > > Committer: H. Peter Anvin > > CommitDate: Thu, 30 May 2013 20:19:25 -0700 > > > > 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.s...@amd.com > > Signed-off-by: H. Peter Anvin > > Cc: Fenghua Yu > > --- > > ... > > > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > > index 7bd3bd3..6c3fcea 100644 > > --- a/arch/x86/kernel/Makefile > > +++ b/arch/x86/kernel/Makefile > > @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o > > microcode-y:= microcode_core.o > > microcode-$(CONFIG_MICROCODE_INTEL)+= microcode_intel.o > > microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o > > +obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o > > obj-$(CONFIG_MICROCODE)+= microcode.o > > This can't be right: > > WARNING: modpost: Found 1 section mismatch(es). > To see full details build your kernel with: > 'make CONFIG_DEBUG_SECTION_MISMATCH=y' > arch/x86/built-in.o: In function `apply_ucode_in_initrd': > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:118: > undefined reference to `__apply_microcode_amd' > arch/x86/built-in.o: In function `save_microcode_in_initrd_amd': > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:216: > undefined reference to `load_microcode_amd' > arch/x86/built-in.o: In function `collect_cpu_info_amd_early': > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:171: > undefined reference to `ucode_cpu_info' > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:172: > undefined reference to `ucode_cpu_info' > arch/x86/built-in.o: In function `load_ucode_amd_ap': > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:185: > undefined reference to `load_microcode_amd' > /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:190: > undefined reference to `apply_microcode_amd' > make: *** [vmlinux] Error 1 > > $ grep MICROCODE .config > CONFIG_MICROCODE=m > CONFIG_MICROCODE_INTEL=y > CONFIG_MICROCODE_AMD=y > CONFIG_MICROCODE_OLD_INTERFACE=y > CONFIG_MICROCODE_INTEL_LIB=y > CONFIG_MICROCODE_INTEL_EARLY=y > CONFIG_MICROCODE_AMD_EARLY=y > CONFIG_MICROCODE_EARLY=y > > Jacob, as a tip for you: before sending out patches, always do a > > for ARCH in "i386" "x86_64" > do > for cfg in "defconfig" "allnoconfig" "allyesconfig" "allmodconfig" > do > make -j $ARCH $cfg > done > done > > to smoke-test your patches. I'm not saying this should catch all build > errors but still... So sorry .. lesson learned, will do. Fix below. Yinghai, I appended this randconfig error fix to the section mismatch fix I sent you earlier: https://lkml.org/lkml/2013/5/31/51 >From bdb3e0c8cde1a7cd12946a3be5e2ebf22421f462 Mon Sep 17 00:00:00 2001 From: Jacob Shin Date: Fri, 31 May 2013 01:53:24 -0500 Subject: [PATCH 1/1] x86/microcode/amd: fix warnings and errors on randconfig 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 --- 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(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 28dba52..2705532 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 24254aa..c6b043f 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);
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 08:31:08PM -0700, tip-bot for Jacob Shin wrote: > Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab > Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab > Author: Jacob Shin > AuthorDate: Thu, 30 May 2013 14:09:19 -0500 > Committer: H. Peter Anvin > CommitDate: Thu, 30 May 2013 20:19:25 -0700 > > 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.s...@amd.com > Signed-off-by: H. Peter Anvin > Cc: Fenghua Yu > --- ... > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > index 7bd3bd3..6c3fcea 100644 > --- a/arch/x86/kernel/Makefile > +++ b/arch/x86/kernel/Makefile > @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o > microcode-y := microcode_core.o > microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o > microcode-$(CONFIG_MICROCODE_AMD)+= microcode_amd.o > +obj-$(CONFIG_MICROCODE_AMD_EARLY)+= microcode_amd_early.o > obj-$(CONFIG_MICROCODE) += microcode.o This can't be right: WARNING: modpost: Found 1 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' arch/x86/built-in.o: In function `apply_ucode_in_initrd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:118: undefined reference to `__apply_microcode_amd' arch/x86/built-in.o: In function `save_microcode_in_initrd_amd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:216: undefined reference to `load_microcode_amd' arch/x86/built-in.o: In function `collect_cpu_info_amd_early': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:171: undefined reference to `ucode_cpu_info' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:172: undefined reference to `ucode_cpu_info' arch/x86/built-in.o: In function `load_ucode_amd_ap': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:185: undefined reference to `load_microcode_amd' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:190: undefined reference to `apply_microcode_amd' make: *** [vmlinux] Error 1 $ grep MICROCODE .config CONFIG_MICROCODE=m CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_AMD=y CONFIG_MICROCODE_OLD_INTERFACE=y CONFIG_MICROCODE_INTEL_LIB=y CONFIG_MICROCODE_INTEL_EARLY=y CONFIG_MICROCODE_AMD_EARLY=y CONFIG_MICROCODE_EARLY=y Jacob, as a tip for you: before sending out patches, always do a for ARCH in "i386" "x86_64" do for cfg in "defconfig" "allnoconfig" "allyesconfig" "allmodconfig" do make -j $ARCH $cfg done done to smoke-test your patches. I'm not saying this should catch all build errors but still... Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 11:10:23PM -0700, Yinghai Lu wrote: > On Thu, May 30, 2013 at 8:31 PM, tip-bot for Jacob Shin > wrote: > > Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab > > Gitweb: > > http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab > > Author: Jacob Shin > > AuthorDate: Thu, 30 May 2013 14:09:19 -0500 > > Committer: H. Peter Anvin > > CommitDate: Thu, 30 May 2013 20:19:25 -0700 > > > > 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.s...@amd.com > > Signed-off-by: H. Peter Anvin > > Cc: Fenghua Yu > > --- > > Documentation/x86/early-microcode.txt | 11 +- > > arch/x86/Kconfig | 14 ++- > > arch/x86/include/asm/microcode_amd.h | 14 +++ > > arch/x86/kernel/Makefile | 1 + > > arch/x86/kernel/microcode_amd.c| 22 > > arch/x86/kernel/microcode_amd_early.c | 222 > > + > > arch/x86/kernel/microcode_core_early.c | 43 ++- > > 7 files changed, 310 insertions(+), 17 deletions(-) > > > > WARNING: arch/x86/kernel/built-in.o(.cpuinit.text+0x7115): Section > mismatch in reference from the function load_ucode_amd_ap() to the > function .init.text:find_ucode_in_initrd() > The function __cpuinit load_ucode_amd_ap() references > a function __init find_ucode_in_initrd(). > If find_ucode_in_initrd is only used by load_ucode_amd_ap then > annotate find_ucode_in_initrd with a matching annotation. Sorry about that, should have turned on CONFIG_DEBUG_SECTION_MISMATCH=y This should fix the warnings: >From 5c7ec96f218f08db25e449d7d5789ee2f66f2f92 Mon Sep 17 00:00:00 2001 From: Jacob Shin Date: Fri, 31 May 2013 01:53:24 -0500 Subject: [PATCH 1/1] x86/microcode/amd: fix section mismatch warnings on microcode_amd_early.c Fix section mismatch warnings on microcode_amd_early.c Signed-off-by: Jacob Shin --- arch/x86/include/asm/microcode_amd.h |2 +- arch/x86/kernel/microcode_amd_early.c |8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 24254aa..c6b043f 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 7e54d97..9618805 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 -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 8:31 PM, tip-bot for Jacob Shin wrote: > Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab > Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab > Author: Jacob Shin > AuthorDate: Thu, 30 May 2013 14:09:19 -0500 > Committer: H. Peter Anvin > CommitDate: Thu, 30 May 2013 20:19:25 -0700 > > 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.s...@amd.com > Signed-off-by: H. Peter Anvin > Cc: Fenghua Yu > --- > Documentation/x86/early-microcode.txt | 11 +- > arch/x86/Kconfig | 14 ++- > arch/x86/include/asm/microcode_amd.h | 14 +++ > arch/x86/kernel/Makefile | 1 + > arch/x86/kernel/microcode_amd.c| 22 > arch/x86/kernel/microcode_amd_early.c | 222 > + > arch/x86/kernel/microcode_core_early.c | 43 ++- > 7 files changed, 310 insertions(+), 17 deletions(-) > WARNING: arch/x86/kernel/built-in.o(.cpuinit.text+0x7115): Section mismatch in reference from the function load_ucode_amd_ap() to the function .init.text:find_ucode_in_initrd() The function __cpuinit load_ucode_amd_ap() references a function __init find_ucode_in_initrd(). If find_ucode_in_initrd is only used by load_ucode_amd_ap then annotate find_ucode_in_initrd with a matching annotation. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 8:31 PM, tip-bot for Jacob Shin tip...@zytor.com wrote: Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin jacob.s...@amd.com AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin h...@linux.intel.com CommitDate: Thu, 30 May 2013 20:19:25 -0700 x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin jacob.s...@amd.com Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.s...@amd.com Signed-off-by: H. Peter Anvin h...@linux.intel.com Cc: Fenghua Yu fenghua...@intel.com --- Documentation/x86/early-microcode.txt | 11 +- arch/x86/Kconfig | 14 ++- arch/x86/include/asm/microcode_amd.h | 14 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_amd.c| 22 arch/x86/kernel/microcode_amd_early.c | 222 + arch/x86/kernel/microcode_core_early.c | 43 ++- 7 files changed, 310 insertions(+), 17 deletions(-) WARNING: arch/x86/kernel/built-in.o(.cpuinit.text+0x7115): Section mismatch in reference from the function load_ucode_amd_ap() to the function .init.text:find_ucode_in_initrd() The function __cpuinit load_ucode_amd_ap() references a function __init find_ucode_in_initrd(). If find_ucode_in_initrd is only used by load_ucode_amd_ap then annotate find_ucode_in_initrd with a matching annotation. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 11:10:23PM -0700, Yinghai Lu wrote: On Thu, May 30, 2013 at 8:31 PM, tip-bot for Jacob Shin tip...@zytor.com wrote: Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin jacob.s...@amd.com AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin h...@linux.intel.com CommitDate: Thu, 30 May 2013 20:19:25 -0700 x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin jacob.s...@amd.com Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.s...@amd.com Signed-off-by: H. Peter Anvin h...@linux.intel.com Cc: Fenghua Yu fenghua...@intel.com --- Documentation/x86/early-microcode.txt | 11 +- arch/x86/Kconfig | 14 ++- arch/x86/include/asm/microcode_amd.h | 14 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_amd.c| 22 arch/x86/kernel/microcode_amd_early.c | 222 + arch/x86/kernel/microcode_core_early.c | 43 ++- 7 files changed, 310 insertions(+), 17 deletions(-) WARNING: arch/x86/kernel/built-in.o(.cpuinit.text+0x7115): Section mismatch in reference from the function load_ucode_amd_ap() to the function .init.text:find_ucode_in_initrd() The function __cpuinit load_ucode_amd_ap() references a function __init find_ucode_in_initrd(). If find_ucode_in_initrd is only used by load_ucode_amd_ap then annotate find_ucode_in_initrd with a matching annotation. Sorry about that, should have turned on CONFIG_DEBUG_SECTION_MISMATCH=y This should fix the warnings: From 5c7ec96f218f08db25e449d7d5789ee2f66f2f92 Mon Sep 17 00:00:00 2001 From: Jacob Shin jacob.s...@amd.com Date: Fri, 31 May 2013 01:53:24 -0500 Subject: [PATCH 1/1] x86/microcode/amd: fix section mismatch warnings on microcode_amd_early.c Fix section mismatch warnings on microcode_amd_early.c Signed-off-by: Jacob Shin jacob.s...@amd.com --- arch/x86/include/asm/microcode_amd.h |2 +- arch/x86/kernel/microcode_amd_early.c |8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 24254aa..c6b043f 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 7e54d97..9618805 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 -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Thu, May 30, 2013 at 08:31:08PM -0700, tip-bot for Jacob Shin wrote: Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin jacob.s...@amd.com AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin h...@linux.intel.com CommitDate: Thu, 30 May 2013 20:19:25 -0700 x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin jacob.s...@amd.com Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.s...@amd.com Signed-off-by: H. Peter Anvin h...@linux.intel.com Cc: Fenghua Yu fenghua...@intel.com --- ... diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 7bd3bd3..6c3fcea 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o microcode-y := microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD)+= microcode_amd.o +obj-$(CONFIG_MICROCODE_AMD_EARLY)+= microcode_amd_early.o obj-$(CONFIG_MICROCODE) += microcode.o This can't be right: WARNING: modpost: Found 1 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' arch/x86/built-in.o: In function `apply_ucode_in_initrd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:118: undefined reference to `__apply_microcode_amd' arch/x86/built-in.o: In function `save_microcode_in_initrd_amd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:216: undefined reference to `load_microcode_amd' arch/x86/built-in.o: In function `collect_cpu_info_amd_early': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:171: undefined reference to `ucode_cpu_info' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:172: undefined reference to `ucode_cpu_info' arch/x86/built-in.o: In function `load_ucode_amd_ap': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:185: undefined reference to `load_microcode_amd' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:190: undefined reference to `apply_microcode_amd' make: *** [vmlinux] Error 1 $ grep MICROCODE .config CONFIG_MICROCODE=m CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_AMD=y CONFIG_MICROCODE_OLD_INTERFACE=y CONFIG_MICROCODE_INTEL_LIB=y CONFIG_MICROCODE_INTEL_EARLY=y CONFIG_MICROCODE_AMD_EARLY=y CONFIG_MICROCODE_EARLY=y Jacob, as a tip for you: before sending out patches, always do a for ARCH in i386 x86_64 do for cfg in defconfig allnoconfig allyesconfig allmodconfig do make -jsomething $ARCH $cfg done done to smoke-test your patches. I'm not saying this should catch all build errors but still... Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Fri, May 31, 2013 at 10:41:33AM +0200, Borislav Petkov wrote: On Thu, May 30, 2013 at 08:31:08PM -0700, tip-bot for Jacob Shin wrote: Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin jacob.s...@amd.com AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin h...@linux.intel.com CommitDate: Thu, 30 May 2013 20:19:25 -0700 x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin jacob.s...@amd.com Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.s...@amd.com Signed-off-by: H. Peter Anvin h...@linux.intel.com Cc: Fenghua Yu fenghua...@intel.com --- ... diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 7bd3bd3..6c3fcea 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o microcode-y:= microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL)+= microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o +obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o obj-$(CONFIG_MICROCODE)+= microcode.o This can't be right: WARNING: modpost: Found 1 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' arch/x86/built-in.o: In function `apply_ucode_in_initrd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:118: undefined reference to `__apply_microcode_amd' arch/x86/built-in.o: In function `save_microcode_in_initrd_amd': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:216: undefined reference to `load_microcode_amd' arch/x86/built-in.o: In function `collect_cpu_info_amd_early': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:171: undefined reference to `ucode_cpu_info' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:172: undefined reference to `ucode_cpu_info' arch/x86/built-in.o: In function `load_ucode_amd_ap': /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:185: undefined reference to `load_microcode_amd' /home/boris/kernel/linux-2.6/arch/x86/kernel/microcode_amd_early.c:190: undefined reference to `apply_microcode_amd' make: *** [vmlinux] Error 1 $ grep MICROCODE .config CONFIG_MICROCODE=m CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_AMD=y CONFIG_MICROCODE_OLD_INTERFACE=y CONFIG_MICROCODE_INTEL_LIB=y CONFIG_MICROCODE_INTEL_EARLY=y CONFIG_MICROCODE_AMD_EARLY=y CONFIG_MICROCODE_EARLY=y Jacob, as a tip for you: before sending out patches, always do a for ARCH in i386 x86_64 do for cfg in defconfig allnoconfig allyesconfig allmodconfig do make -jsomething $ARCH $cfg done done to smoke-test your patches. I'm not saying this should catch all build errors but still... So sorry .. lesson learned, will do. Fix below. Yinghai, I appended this randconfig error fix to the section mismatch fix I sent you earlier: https://lkml.org/lkml/2013/5/31/51 From bdb3e0c8cde1a7cd12946a3be5e2ebf22421f462 Mon Sep 17 00:00:00 2001 From: Jacob Shin jacob.s...@amd.com Date: Fri, 31 May 2013 01:53:24 -0500 Subject: [PATCH 1/1] x86/microcode/amd: fix warnings and errors on randconfig 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 ying...@kernel.org Reported-by: Borislav Petkov b...@alien8.de Signed-off-by: Jacob Shin jacob.s...@amd.com --- 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(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 28dba52..2705532 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 24254aa..c6b043f 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
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
If you send a patch with text above the patch, please include a scissor line: ---8--- ... above the patch so that git tools can process it. -hpa -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
On Fri, May 31, 2013 at 08:13:09AM -0700, H. Peter Anvin wrote: If you send a patch with text above the patch, please include a scissor line: ---8--- ... above the patch so that git tools can process it. Ah okay, sorry about that, will do so from now on. Yinghai, Boris, sorry if you have to hand snip my previous fix email, but please do let me know if I can add your Tested-by's Thanks! -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin CommitDate: Thu, 30 May 2013 20:19:25 -0700 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.s...@amd.com Signed-off-by: H. Peter Anvin Cc: Fenghua Yu --- Documentation/x86/early-microcode.txt | 11 +- arch/x86/Kconfig | 14 ++- arch/x86/include/asm/microcode_amd.h | 14 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_amd.c| 22 arch/x86/kernel/microcode_amd_early.c | 222 + arch/x86/kernel/microcode_core_early.c | 43 ++- 7 files changed, 310 insertions(+), 17 deletions(-) diff --git a/Documentation/x86/early-microcode.txt b/Documentation/x86/early-microcode.txt index 4aaf0df..d62bea6 100644 --- a/Documentation/x86/early-microcode.txt +++ b/Documentation/x86/early-microcode.txt @@ -11,7 +11,8 @@ file and loaded to CPUs during boot time. The format of the combined initrd image is microcode in cpio format followed by the initrd image (maybe compressed). Kernel parses the combined initrd image during boot time. The microcode file in cpio name space is: -kernel/x86/microcode/GenuineIntel.bin +on Intel: kernel/x86/microcode/GenuineIntel.bin +on AMD : kernel/x86/microcode/AuthenticAMD.bin During BSP boot (before SMP starts), if the kernel finds the microcode file in the initrd file, it parses the microcode and saves matching microcode in memory. @@ -34,10 +35,8 @@ original initrd image /boot/initrd-3.5.0.img. mkdir initrd cd initrd -mkdir kernel -mkdir kernel/x86 -mkdir kernel/x86/microcode -cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin -find .|cpio -oc >../ucode.cpio +mkdir -p kernel/x86/microcode +cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin (or AuthenticAMD.bin) +find . | cpio -o -H newc >../ucode.cpio cd .. cat ucode.cpio /boot/initrd-3.5.0.img >/boot/initrd-3.5.0.ucode.img diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 685692c..28dba52 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--- diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index a57d9b7..24254aa 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -61,4 +61,18 @@ extern int __apply_microcode_amd(struct microcode_amd *mc_amd); extern int apply_microcode_amd(int cpu); 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]; +#endif +extern void __init load_ucode_amd_bsp(void); +extern void __cpuinit load_ucode_amd_ap(void); +extern int __init save_microcode_in_initrd_amd(void); +#else +static inline void __init load_ucode_amd_bsp(void) {} +static inline void __cpuinit load_ucode_amd_ap(void) {} +static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; } +#endif + #endif /* _ASM_X86_MICROCODE_AMD_H */ diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 7bd3bd3..6c3fcea 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o microcode-y:= microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL)+= microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o +obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o obj-$(CONFIG_MICROCODE)+= microcode.o obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o diff --git a/arch/x86/kernel/microcode_amd.c
[tip:x86/microcode] x86, microcode, amd: Early microcode patch loading support for AMD
Commit-ID: 757885e94a22bcc82beb9b1445c95218cb20ceab Gitweb: http://git.kernel.org/tip/757885e94a22bcc82beb9b1445c95218cb20ceab Author: Jacob Shin jacob.s...@amd.com AuthorDate: Thu, 30 May 2013 14:09:19 -0500 Committer: H. Peter Anvin h...@linux.intel.com CommitDate: Thu, 30 May 2013 20:19:25 -0700 x86, microcode, amd: Early microcode patch loading support for AMD Add early microcode patch loading support for AMD. Signed-off-by: Jacob Shin jacob.s...@amd.com Link: http://lkml.kernel.org/r/1369940959-2077-5-git-send-email-jacob.s...@amd.com Signed-off-by: H. Peter Anvin h...@linux.intel.com Cc: Fenghua Yu fenghua...@intel.com --- Documentation/x86/early-microcode.txt | 11 +- arch/x86/Kconfig | 14 ++- arch/x86/include/asm/microcode_amd.h | 14 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_amd.c| 22 arch/x86/kernel/microcode_amd_early.c | 222 + arch/x86/kernel/microcode_core_early.c | 43 ++- 7 files changed, 310 insertions(+), 17 deletions(-) diff --git a/Documentation/x86/early-microcode.txt b/Documentation/x86/early-microcode.txt index 4aaf0df..d62bea6 100644 --- a/Documentation/x86/early-microcode.txt +++ b/Documentation/x86/early-microcode.txt @@ -11,7 +11,8 @@ file and loaded to CPUs during boot time. The format of the combined initrd image is microcode in cpio format followed by the initrd image (maybe compressed). Kernel parses the combined initrd image during boot time. The microcode file in cpio name space is: -kernel/x86/microcode/GenuineIntel.bin +on Intel: kernel/x86/microcode/GenuineIntel.bin +on AMD : kernel/x86/microcode/AuthenticAMD.bin During BSP boot (before SMP starts), if the kernel finds the microcode file in the initrd file, it parses the microcode and saves matching microcode in memory. @@ -34,10 +35,8 @@ original initrd image /boot/initrd-3.5.0.img. mkdir initrd cd initrd -mkdir kernel -mkdir kernel/x86 -mkdir kernel/x86/microcode -cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin -find .|cpio -oc ../ucode.cpio +mkdir -p kernel/x86/microcode +cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin (or AuthenticAMD.bin) +find . | cpio -o -H newc ../ucode.cpio cd .. cat ucode.cpio /boot/initrd-3.5.0.img /boot/initrd-3.5.0.ucode.img diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 685692c..28dba52 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--- diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index a57d9b7..24254aa 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -61,4 +61,18 @@ extern int __apply_microcode_amd(struct microcode_amd *mc_amd); extern int apply_microcode_amd(int cpu); 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]; +#endif +extern void __init load_ucode_amd_bsp(void); +extern void __cpuinit load_ucode_amd_ap(void); +extern int __init save_microcode_in_initrd_amd(void); +#else +static inline void __init load_ucode_amd_bsp(void) {} +static inline void __cpuinit load_ucode_amd_ap(void) {} +static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; } +#endif + #endif /* _ASM_X86_MICROCODE_AMD_H */ diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 7bd3bd3..6c3fcea 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o microcode-y:= microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL)+= microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o +obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o obj-$(CONFIG_MICROCODE)+= microcode.o