diff options
author | Andreas Herrmann <herrmann.der.user@googlemail.com> | 2009-11-10 06:07:23 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-10 06:15:48 -0500 |
commit | d1c84f79a6ba992dc01e312c44a21496303874d6 (patch) | |
tree | 1d15af2e65759cc25132cdfffebea7f710bfdb07 /arch/x86/kernel/microcode_amd.c | |
parent | 6e18da75c28b592594fd632cf3e6eb09d3d078de (diff) |
x86: ucode-amd: Load ucode-patches once and not separately of each CPU
This also implies that corresponding log messages, e.g.
platform microcode: firmware: requesting amd-ucode/microcode_amd.bin
show up only once on module load and not when ucode is updated
for each CPU.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: dimm <dmitry.adamushko@gmail.com>
LKML-Reference: <20091110110723.GH30802@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index c043534fd986..75538f647193 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -33,6 +33,8 @@ MODULE_LICENSE("GPL v2"); | |||
33 | #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 | 33 | #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 |
34 | #define UCODE_UCODE_TYPE 0x00000001 | 34 | #define UCODE_UCODE_TYPE 0x00000001 |
35 | 35 | ||
36 | const struct firmware *firmware; | ||
37 | |||
36 | struct equiv_cpu_entry { | 38 | struct equiv_cpu_entry { |
37 | u32 installed_cpu; | 39 | u32 installed_cpu; |
38 | u32 fixed_errata_mask; | 40 | u32 fixed_errata_mask; |
@@ -301,14 +303,10 @@ generic_load_microcode(int cpu, const u8 *data, size_t size) | |||
301 | 303 | ||
302 | static enum ucode_state request_microcode_fw(int cpu, struct device *device) | 304 | static enum ucode_state request_microcode_fw(int cpu, struct device *device) |
303 | { | 305 | { |
304 | const char *fw_name = "amd-ucode/microcode_amd.bin"; | ||
305 | const struct firmware *firmware; | ||
306 | enum ucode_state ret; | 306 | enum ucode_state ret; |
307 | 307 | ||
308 | if (request_firmware(&firmware, fw_name, device)) { | 308 | if (firmware == NULL) |
309 | printk(KERN_ERR "microcode: failed to load file %s\n", fw_name); | ||
310 | return UCODE_NFOUND; | 309 | return UCODE_NFOUND; |
311 | } | ||
312 | 310 | ||
313 | if (*(u32 *)firmware->data != UCODE_MAGIC) { | 311 | if (*(u32 *)firmware->data != UCODE_MAGIC) { |
314 | printk(KERN_ERR "microcode: invalid UCODE_MAGIC (0x%08x)\n", | 312 | printk(KERN_ERR "microcode: invalid UCODE_MAGIC (0x%08x)\n", |
@@ -318,8 +316,6 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device) | |||
318 | 316 | ||
319 | ret = generic_load_microcode(cpu, firmware->data, firmware->size); | 317 | ret = generic_load_microcode(cpu, firmware->data, firmware->size); |
320 | 318 | ||
321 | release_firmware(firmware); | ||
322 | |||
323 | return ret; | 319 | return ret; |
324 | } | 320 | } |
325 | 321 | ||
@@ -339,7 +335,21 @@ static void microcode_fini_cpu_amd(int cpu) | |||
339 | uci->mc = NULL; | 335 | uci->mc = NULL; |
340 | } | 336 | } |
341 | 337 | ||
338 | void init_microcode_amd(struct device *device) | ||
339 | { | ||
340 | const char *fw_name = "amd-ucode/microcode_amd.bin"; | ||
341 | if (request_firmware(&firmware, fw_name, device)) | ||
342 | printk(KERN_ERR "microcode: failed to load file %s\n", fw_name); | ||
343 | } | ||
344 | |||
345 | void fini_microcode_amd(void) | ||
346 | { | ||
347 | release_firmware(firmware); | ||
348 | } | ||
349 | |||
342 | static struct microcode_ops microcode_amd_ops = { | 350 | static struct microcode_ops microcode_amd_ops = { |
351 | .init = init_microcode_amd, | ||
352 | .fini = fini_microcode_amd, | ||
343 | .request_microcode_user = request_microcode_user, | 353 | .request_microcode_user = request_microcode_user, |
344 | .request_microcode_fw = request_microcode_fw, | 354 | .request_microcode_fw = request_microcode_fw, |
345 | .collect_cpu_info = collect_cpu_info_amd, | 355 | .collect_cpu_info = collect_cpu_info_amd, |