diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2012-07-26 09:51:00 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-08-22 19:15:58 -0400 |
commit | 48e30685caa8bdc4b8d4417d8ac31db59689742c (patch) | |
tree | 277f6c607f28892514e87c0dc25dc330eea6621a /arch/x86 | |
parent | 5f5b747282c6cc57b91baba37f76de27398b9e60 (diff) |
x86, microcode: Add a refresh firmware flag to ->request_microcode_fw
This is done in preparation for teaching the ucode driver to either load
a new ucode patches container from userspace or use an already cached
version. No functionality change in this patch.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Link: http://lkml.kernel.org/r/1344361461-10076-10-git-send-email-bp@amd64.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/microcode.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/microcode_core.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/microcode_intel.c | 3 |
4 files changed, 12 insertions, 9 deletions
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 8813be600995..43d921b4752c 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h | |||
@@ -15,8 +15,8 @@ struct microcode_ops { | |||
15 | enum ucode_state (*request_microcode_user) (int cpu, | 15 | enum ucode_state (*request_microcode_user) (int cpu, |
16 | const void __user *buf, size_t size); | 16 | const void __user *buf, size_t size); |
17 | 17 | ||
18 | enum ucode_state (*request_microcode_fw) (int cpu, | 18 | enum ucode_state (*request_microcode_fw) (int cpu, struct device *, |
19 | struct device *device); | 19 | bool refresh_fw); |
20 | 20 | ||
21 | void (*microcode_fini_cpu) (int cpu); | 21 | void (*microcode_fini_cpu) (int cpu); |
22 | 22 | ||
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 25d34b177482..94ecdaa24052 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -330,7 +330,8 @@ out: | |||
330 | * | 330 | * |
331 | * These might be larger than 2K. | 331 | * These might be larger than 2K. |
332 | */ | 332 | */ |
333 | static enum ucode_state request_microcode_amd(int cpu, struct device *device) | 333 | static enum ucode_state request_microcode_amd(int cpu, struct device *device, |
334 | bool refresh_fw) | ||
334 | { | 335 | { |
335 | char fw_name[36] = "amd-ucode/microcode_amd.bin"; | 336 | char fw_name[36] = "amd-ucode/microcode_amd.bin"; |
336 | const struct firmware *fw; | 337 | const struct firmware *fw; |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index dcde544e012c..9420972e98fe 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
@@ -282,7 +282,7 @@ static int reload_for_cpu(int cpu) | |||
282 | if (!uci->valid) | 282 | if (!uci->valid) |
283 | return err; | 283 | return err; |
284 | 284 | ||
285 | ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev); | 285 | ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev, true); |
286 | if (ustate == UCODE_OK) | 286 | if (ustate == UCODE_OK) |
287 | apply_microcode_on_target(cpu); | 287 | apply_microcode_on_target(cpu); |
288 | else | 288 | else |
@@ -377,7 +377,7 @@ static enum ucode_state microcode_resume_cpu(int cpu) | |||
377 | return UCODE_OK; | 377 | return UCODE_OK; |
378 | } | 378 | } |
379 | 379 | ||
380 | static enum ucode_state microcode_init_cpu(int cpu) | 380 | static enum ucode_state microcode_init_cpu(int cpu, bool refresh_fw) |
381 | { | 381 | { |
382 | enum ucode_state ustate; | 382 | enum ucode_state ustate; |
383 | 383 | ||
@@ -388,7 +388,8 @@ static enum ucode_state microcode_init_cpu(int cpu) | |||
388 | if (system_state != SYSTEM_RUNNING) | 388 | if (system_state != SYSTEM_RUNNING) |
389 | return UCODE_NFOUND; | 389 | return UCODE_NFOUND; |
390 | 390 | ||
391 | ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev); | 391 | ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev, |
392 | refresh_fw); | ||
392 | 393 | ||
393 | if (ustate == UCODE_OK) { | 394 | if (ustate == UCODE_OK) { |
394 | pr_debug("CPU%d updated upon init\n", cpu); | 395 | pr_debug("CPU%d updated upon init\n", cpu); |
@@ -405,7 +406,7 @@ static enum ucode_state microcode_update_cpu(int cpu) | |||
405 | if (uci->valid) | 406 | if (uci->valid) |
406 | return microcode_resume_cpu(cpu); | 407 | return microcode_resume_cpu(cpu); |
407 | 408 | ||
408 | return microcode_init_cpu(cpu); | 409 | return microcode_init_cpu(cpu, false); |
409 | } | 410 | } |
410 | 411 | ||
411 | static int mc_device_add(struct device *dev, struct subsys_interface *sif) | 412 | static int mc_device_add(struct device *dev, struct subsys_interface *sif) |
@@ -421,7 +422,7 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif) | |||
421 | if (err) | 422 | if (err) |
422 | return err; | 423 | return err; |
423 | 424 | ||
424 | if (microcode_init_cpu(cpu) == UCODE_ERROR) | 425 | if (microcode_init_cpu(cpu, true) == UCODE_ERROR) |
425 | return -EINVAL; | 426 | return -EINVAL; |
426 | 427 | ||
427 | return err; | 428 | return err; |
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index 0327e2b3c408..3544aed39338 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
@@ -405,7 +405,8 @@ static int get_ucode_fw(void *to, const void *from, size_t n) | |||
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
408 | static enum ucode_state request_microcode_fw(int cpu, struct device *device) | 408 | static enum ucode_state request_microcode_fw(int cpu, struct device *device, |
409 | bool refresh_fw) | ||
409 | { | 410 | { |
410 | char name[30]; | 411 | char name[30]; |
411 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 412 | struct cpuinfo_x86 *c = &cpu_data(cpu); |