Commit 3b2e3d85 authored by Andreas Herrmann's avatar Andreas Herrmann Committed by Ingo Molnar

Revert "x86: ucode-amd: Load ucode-patches once ..."

Commit d1c84f79
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.

CC: Gene Heskett <gene.heskett@verizon.net>
Signed-off-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
LKML-Reference: <20100122203456.GB13792@alberich.amd.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 73472a46
...@@ -12,8 +12,6 @@ struct device; ...@@ -12,8 +12,6 @@ struct device;
enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND }; enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
struct microcode_ops { struct microcode_ops {
void (*init)(struct device *device);
void (*fini)(void);
enum ucode_state (*request_microcode_user) (int cpu, enum ucode_state (*request_microcode_user) (int cpu,
const void __user *buf, size_t size); const void __user *buf, size_t size);
......
...@@ -36,9 +36,6 @@ MODULE_LICENSE("GPL v2"); ...@@ -36,9 +36,6 @@ MODULE_LICENSE("GPL v2");
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
#define UCODE_UCODE_TYPE 0x00000001 #define UCODE_UCODE_TYPE 0x00000001
const struct firmware *firmware;
static int supported_cpu;
struct equiv_cpu_entry { struct equiv_cpu_entry {
u32 installed_cpu; u32 installed_cpu;
u32 fixed_errata_mask; u32 fixed_errata_mask;
...@@ -77,12 +74,15 @@ static struct equiv_cpu_entry *equiv_cpu_table; ...@@ -77,12 +74,15 @@ static struct equiv_cpu_entry *equiv_cpu_table;
static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
{ {
struct cpuinfo_x86 *c = &cpu_data(cpu);
u32 dummy; u32 dummy;
if (!supported_cpu)
return -1;
memset(csig, 0, sizeof(*csig)); 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); rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev); pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev);
return 0; return 0;
...@@ -294,10 +294,14 @@ generic_load_microcode(int cpu, const u8 *data, size_t size) ...@@ -294,10 +294,14 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
static enum ucode_state request_microcode_fw(int cpu, struct device *device) static enum ucode_state request_microcode_fw(int cpu, struct device *device)
{ {
const char *fw_name = "amd-ucode/microcode_amd.bin";
const struct firmware *firmware;
enum ucode_state ret; enum ucode_state ret;
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; return UCODE_NFOUND;
}
if (*(u32 *)firmware->data != UCODE_MAGIC) { if (*(u32 *)firmware->data != UCODE_MAGIC) {
pr_err("invalid UCODE_MAGIC (0x%08x)\n", pr_err("invalid UCODE_MAGIC (0x%08x)\n",
...@@ -307,6 +311,8 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device) ...@@ -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); ret = generic_load_microcode(cpu, firmware->data, firmware->size);
release_firmware(firmware);
return ret; return ret;
} }
...@@ -325,31 +331,7 @@ static void microcode_fini_cpu_amd(int cpu) ...@@ -325,31 +331,7 @@ static void microcode_fini_cpu_amd(int cpu)
uci->mc = NULL; 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 = { static struct microcode_ops microcode_amd_ops = {
.init = init_microcode_amd,
.fini = fini_microcode_amd,
.request_microcode_user = request_microcode_user, .request_microcode_user = request_microcode_user,
.request_microcode_fw = request_microcode_fw, .request_microcode_fw = request_microcode_fw,
.collect_cpu_info = collect_cpu_info_amd, .collect_cpu_info = collect_cpu_info_amd,
......
...@@ -521,9 +521,6 @@ static int __init microcode_init(void) ...@@ -521,9 +521,6 @@ static int __init microcode_init(void)
return PTR_ERR(microcode_pdev); return PTR_ERR(microcode_pdev);
} }
if (microcode_ops->init)
microcode_ops->init(&microcode_pdev->dev);
get_online_cpus(); get_online_cpus();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
...@@ -566,9 +563,6 @@ static void __exit microcode_exit(void) ...@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)
platform_device_unregister(microcode_pdev); platform_device_unregister(microcode_pdev);
if (microcode_ops->fini)
microcode_ops->fini();
microcode_ops = NULL; microcode_ops = NULL;
pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n"); pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment