Revert "x86: ucode-amd: Load ucode-patches once ..."
PATCH 1/1 Revert "x86: ucode-amd: Load ucode-patches once ..."
From: Andreas Herrmann <[email protected]>
Commit d1c84f79a6ba992dc01e312c44a21496303874d6
leads to a regression when microcode_amd.c is compiled into the kernel. It causes a big boot delay because the firmware is not available. See http://marc.info/?l=linux-kernel&m=126267290920060
It also renders the reload sysfs attribute useless. Fixing this is too intrusive for an -rc5 kernel.
Thus I'd like to restore the microcode loading behaviour of kernel 2.6.32.
--- arch/x86/include/asm/microcode.h | 2 - arch/x86/kernel/microcode_amd.c | 44 +++++++++++-------------------------- arch/x86/kernel/microcode_core.c | 6 ----- 3 files changed, 13 insertions(+), 39 deletions(-)
arch/x86/include/asm/microcode.h +0 -2
@@ -12,8 +12,6 @@ struct device;enum ucode_state {UCODE_ERROR ,UCODE_OK ,UCODE_NFOUND };struct microcode_ops { -void (*init)(struct device *device); -void (*fini)(void );enum ucode_state (*request_microcode_user) (int cpu,const void __user *buf,size_t size);
arch/x86/kernel/microcode_amd.c +13 -31
81 lines not on this page · raw message
arch/x86/kernel/microcode_core.c +0 -6
@@ -521,9 +521,6 @@ static int __init microcode_init(void)return PTR_ERR (microcode_pdev); } -if (microcode_ops->init) - microcode_ops->init (µcode_pdev->dev); -get_online_cpus ();mutex_lock (µcode_mutex);
@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)platform_device_unregister (microcode_pdev); -if (microcode_ops->fini) - microcode_ops->fini (); - microcode_ops =NULL ;pr_info ("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n" );
Signature · 1 line
1.6.6
Quoted 143 lines · Andreas Herrmann
From: Andreas Herrmann <[email protected]>
Commit
d1c84f79a6ba992dc01e312c44a21496303874d6
leads to a regression whenmicrocode_amd.cis compiled into the kernel. It causes a big boot delay because the firmware is not available. See http://marc.info/?l=linux-kernel&m=126267290920060It also renders the reload sysfs attribute useless. Fixing this is too intrusive for an -rc5 kernel.
Thus I'd like to restore the microcode loading behaviour of kernel 2.6.32.
CC Gene Heskett <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>---
arch/x86/include/asm/microcode.h| 2 -arch/x86/kernel/microcode_amd.c| 44
+++++++++++--------------------------arch/x86/kernel/microcode_core.c|
6 -----3 files changed, 13 insertions(+), 39 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/microcode.hindex c24ca9a..ef51b50 100644arch/x86/include/asm/microcode.h +0
-2@@ -12,8 +12,6 @@ struct device;enum ucode_state {UCODE_ERROR ,UCODE_OK ,UCODE_NFOUND };struct microcode_ops { -void (*init)(struct device *device); -void (*fini)(void );enum ucode_state (*request_microcode_user) (int cpu,const void __user *buf,size_t size);(quoted diff) +0
-0
b/arch/x86/kernel/microcode_amd.cindex 37542b6..e1af7c0 100644arch/x86/kernel/microcode_amd.c +6
-6@@ -36,9 +36,6 @@ MODULE_LICENSE("GPL v2");#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000#define UCODE_UCODE_TYPE 0x00000001 -const struct firmware *firmware; -static int supported_cpu; -struct equiv_cpu_entry {u32 installed_cpu;u32 fixed_errata_mask;@@ -77,12 +74,15 @@ static struct equiv_cpu_entry *equiv_cpu_table;static int collect_cpu_info_amd (int cpu,struct cpu_signature *csig) { +struct cpuinfo_x86 *c = &cpu_data (cpu);u32 dummy; -if (!supported_cpu) -return -1 ; -memset (csig,0 ,sizeof (*csig)); +if (c->x86_vendor !=X86_VENDOR_AMD || c->x86 <0x10 ) { +pr_warning ("microcode: CPU%d: AMD CPU family 0x%x not " +"supported\n" , cpu, c->x86); +return -1 ; + }rdmsr (MSR_AMD64_PATCH_LEVEL , csig->rev, dummy);pr_info ("CPU%d: patch_level=0x%x\n" , cpu, csig->rev);return 0 ;@@ -294,10 +294,14 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)static enum
ucode_staterequest_microcode_fw(int cpu, struct device *device){arch/x86/kernel/microcode_amd.c +2
-0+const char *fw_name ="amd-ucode/microcode_amd.bin" ; +const struct firmware *firmware;enum ucode_state ret;arch/x86/kernel/microcode_amd.c +2
-1-if (firmware ==NULL ) +if (request_firmware (&firmware, fw_name, device)) { +printk (KERN_ERR "microcode: failed to load file %s\n" , fw_name);return UCODE_NFOUND;arch/x86/kernel/microcode_amd.c +1
-0+ }if (*(u32 *)firmware->data != UCODE_MAGIC) { pr_err("invalid UCODE_MAGIC (0x%08x)\n",arch/x86/kernel/microcode_amd.c +2
-24@@ -307,6 +311,8 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device) ret =generic_load_microcode (cpu, firmware->data, firmware->size); +release_firmware (firmware); +return ret; }@@ -325,31 +331,7 @@ static void microcode_fini_cpu_amd(int cpu) uci->mc =NULL ; } -void init_microcode_amd (struct device *device) -{ -const char *fw_name ="amd-ucode/microcode_amd.bin" ; -struct cpuinfo_x86 *c = &boot_cpu_data; - -WARN_ON (c->x86_vendor !=X86_VENDOR_AMD ); - -if (c->x86 <0x10 ) { -pr_warning ("AMD CPU family 0x%x not supported\n" , c->x86); -return ; - } - supported_cpu =1 ; - -if (request_firmware (&firmware, fw_name, device)) -pr_err ("failed to load file %s\n" , fw_name); -} - -void fini_microcode_amd (void ) -{ -release_firmware (firmware); -} -static struct microcode_ops microcode_amd_ops = { - .init = init_microcode_amd, - .fini = fini_microcode_amd, .request_microcode_user = request_microcode_user, .request_microcode_fw = request_microcode_fw, .collect_cpu_info = collect_cpu_info_amd,(quoted diff) +0
-0
b/arch/x86/kernel/microcode_core.cindex 0c86324..cceb5bc 100644arch/x86/kernel/microcode_core.c +0
-3@@ -521,9 +521,6 @@ static int __init microcode_init(void)return PTR_ERR (microcode_pdev); } -if (microcode_ops->init) - microcode_ops->init (µcode_pdev->dev); -get_online_cpus ();mutex_lock (µcode_mutex);
arch/x86/kernel/microcode_core.c static void __exit microcode_exit(void) · line 568
Quoted 9 lines
arch/x86/kernel/microcode_core.c +0
-3@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)platform_device_unregister (microcode_pdev); -if (microcode_ops->fini) - microcode_ops->fini (); - microcode_ops =NULL ;pr_info ("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n" );
Andreas: The 1 minute delay can be alleviated, but it requires that during by buildit26 script, I add these few lines:
================
echo now we have find the /lib/firmware/amd-ucode and copy it mkdir -p firmware/amd-ucode
cp -f -R /lib/firmware/amd-ucode/ ./firmware/
echo did we get microcode_amd.bin?
ls -lR firmware/amd-ucode
================
So I can see if the copy wasn't done.
And that the .config contains:
--------------------CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_EXTRA_FIRMWARE="amd-ucode/microcode_amd.bin radeon/R100_cp.bin.ihex radeon/R200_cp.bin.ihex radeon/R300_cp.bin.ihex radeon/R420_cp.bin.ihex radeon/R520_cp.bin.ihex radeon/RS600_cp.bin.ihex radeon/RS690_cp.bin.ihex"
----------------------------
with those changes, it boots normally. From dmesg:
=================
[ 0.641663] Freeing initrd memory: 3431k freed [ 0.644788] platform microcode: firmware: using built-in firmware amd- ucode/microcode_amd.bin [ 0.645001] microcode: CPU0: patch_level=0x1000065 [ 0.645118] microcode: CPU1: patch_level=0x1000065 [ 0.645232] microcode: CPU2: patch_level=0x1000065 [ 0.645346] microcode: CPU3: patch_level=0x1000065 [ 0.645494] microcode: Microcode Update Driver: v2.00
<[email protected]>, Peter Oruba
=============================
so there is a workaround. However, I agree that it needs fixed. Right. I'm just not the fixer. :(
Thank you very much for looking at this Andreas, I appreciate it.
Signature · 6 lines
Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) People who push both buttons should get their wish.
Commit-ID: 838cbfec23ebc4a3702174c49c902f1100025fcf Gitweb: http://git.kernel.org/tip/838cbfec23ebc4a3702174c49c902f1100025fcf Author: Andreas Herrmann <[email protected]> AuthorDate: Fri, 22 Jan 2010 21:34:56 +0100 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 22 Jan 2010 13:47:29 -0800
Revert "x86: ucode-amd: Load ucode-patches once ..."
Commit d1c84f79a6ba992dc01e312c44a21496303874d6
leads to a regression when microcode_amd.c is compiled into the kernel. It causes a big boot delay because the firmware is not available. See http://marc.info/?l=linux-kernel&m=126267290920060
It also renders the reload sysfs attribute useless. Fixing this is too intrusive for an -rc5 kernel.
Thus I'd like to restore the microcode loading behaviour of kernel 2.6.32.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/microcode.h | 2 - arch/x86/kernel/microcode_amd.c | 44 +++++++++++-------------------------- arch/x86/kernel/microcode_core.c | 6 ----- 3 files changed, 13 insertions(+), 39 deletions(-)
arch/x86/include/asm/microcode.h +0 -2
@@ -12,8 +12,6 @@ struct device;enum ucode_state {UCODE_ERROR ,UCODE_OK ,UCODE_NFOUND };struct microcode_ops { -void (*init)(struct device *device); -void (*fini)(void );enum ucode_state (*request_microcode_user) (int cpu,const void __user *buf,size_t size);
arch/x86/kernel/microcode_amd.c +13 -31
81 lines not on this page · raw message
arch/x86/kernel/microcode_core.c +0 -6
@@ -521,9 +521,6 @@ static int __init microcode_init(void)return PTR_ERR (microcode_pdev); } -if (microcode_ops->init) - microcode_ops->init (µcode_pdev->dev); -get_online_cpus ();mutex_lock (µcode_mutex);
@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)platform_device_unregister (microcode_pdev); -if (microcode_ops->fini) - microcode_ops->fini (); - microcode_ops =NULL ;pr_info ("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n" );
Commit-ID: 3b2e3d85aeb80769fb96c15ee4f6e14135328471 Gitweb: http://git.kernel.org/tip/3b2e3d85aeb80769fb96c15ee4f6e14135328471 Author: Andreas Herrmann <[email protected]> AuthorDate: Fri, 22 Jan 2010 21:34:56 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 23 Jan 2010 06:21:59 +0100
Revert "x86: ucode-amd: Load ucode-patches once ..."
Commit d1c84f79a6ba992dc01e312c44a21496303874d6
leads to a regression when microcode_amd.c is compiled into the kernel. It causes a big boot delay because the firmware is not available. See http://marc.info/?l=linux-kernel&m=126267290920060
It also renders the reload sysfs attribute useless. Fixing this is too intrusive for an -rc5 kernel.
Thus I'd like to restore the microcode loading behaviour of kernel 2.6.32.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/microcode.h | 2 - arch/x86/kernel/microcode_amd.c | 44 +++++++++++-------------------------- arch/x86/kernel/microcode_core.c | 6 ----- 3 files changed, 13 insertions(+), 39 deletions(-)
arch/x86/include/asm/microcode.h +0 -2
@@ -12,8 +12,6 @@ struct device;enum ucode_state {UCODE_ERROR ,UCODE_OK ,UCODE_NFOUND };struct microcode_ops { -void (*init)(struct device *device); -void (*fini)(void );enum ucode_state (*request_microcode_user) (int cpu,const void __user *buf,size_t size);
arch/x86/kernel/microcode_amd.c +13 -31
81 lines not on this page · raw message
arch/x86/kernel/microcode_core.c +0 -6
@@ -521,9 +521,6 @@ static int __init microcode_init(void)return PTR_ERR (microcode_pdev); } -if (microcode_ops->init) - microcode_ops->init (µcode_pdev->dev); -get_online_cpus ();mutex_lock (µcode_mutex);
@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)platform_device_unregister (microcode_pdev); -if (microcode_ops->fini) - microcode_ops->fini (); - microcode_ops =NULL ;pr_info ("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n" );