Commit 48e30685 authored by Borislav Petkov's avatar Borislav Petkov Committed by H. Peter Anvin

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: default avatarBorislav Petkov <borislav.petkov@amd.com>
Link: http://lkml.kernel.org/r/1344361461-10076-10-git-send-email-bp@amd64.orgSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 5f5b7472
...@@ -15,8 +15,8 @@ struct microcode_ops { ...@@ -15,8 +15,8 @@ struct microcode_ops {
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);
enum ucode_state (*request_microcode_fw) (int cpu, enum ucode_state (*request_microcode_fw) (int cpu, struct device *,
struct device *device); bool refresh_fw);
void (*microcode_fini_cpu) (int cpu); void (*microcode_fini_cpu) (int cpu);
......
...@@ -330,7 +330,8 @@ generic_load_microcode(int cpu, const u8 *data, size_t size) ...@@ -330,7 +330,8 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
* *
* These might be larger than 2K. * These might be larger than 2K.
*/ */
static enum ucode_state request_microcode_amd(int cpu, struct device *device) static enum ucode_state request_microcode_amd(int cpu, struct device *device,
bool refresh_fw)
{ {
char fw_name[36] = "amd-ucode/microcode_amd.bin"; char fw_name[36] = "amd-ucode/microcode_amd.bin";
const struct firmware *fw; const struct firmware *fw;
......
...@@ -282,7 +282,7 @@ static int reload_for_cpu(int cpu) ...@@ -282,7 +282,7 @@ static int reload_for_cpu(int cpu)
if (!uci->valid) if (!uci->valid)
return err; return err;
ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev); ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev, true);
if (ustate == UCODE_OK) if (ustate == UCODE_OK)
apply_microcode_on_target(cpu); apply_microcode_on_target(cpu);
else else
...@@ -377,7 +377,7 @@ static enum ucode_state microcode_resume_cpu(int cpu) ...@@ -377,7 +377,7 @@ static enum ucode_state microcode_resume_cpu(int cpu)
return UCODE_OK; return UCODE_OK;
} }
static enum ucode_state microcode_init_cpu(int cpu) static enum ucode_state microcode_init_cpu(int cpu, bool refresh_fw)
{ {
enum ucode_state ustate; enum ucode_state ustate;
...@@ -388,7 +388,8 @@ static enum ucode_state microcode_init_cpu(int cpu) ...@@ -388,7 +388,8 @@ static enum ucode_state microcode_init_cpu(int cpu)
if (system_state != SYSTEM_RUNNING) if (system_state != SYSTEM_RUNNING)
return UCODE_NFOUND; return UCODE_NFOUND;
ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev); ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev,
refresh_fw);
if (ustate == UCODE_OK) { if (ustate == UCODE_OK) {
pr_debug("CPU%d updated upon init\n", cpu); pr_debug("CPU%d updated upon init\n", cpu);
...@@ -405,7 +406,7 @@ static enum ucode_state microcode_update_cpu(int cpu) ...@@ -405,7 +406,7 @@ static enum ucode_state microcode_update_cpu(int cpu)
if (uci->valid) if (uci->valid)
return microcode_resume_cpu(cpu); return microcode_resume_cpu(cpu);
return microcode_init_cpu(cpu); return microcode_init_cpu(cpu, false);
} }
static int mc_device_add(struct device *dev, struct subsys_interface *sif) 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,7 +422,7 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif)
if (err) if (err)
return err; return err;
if (microcode_init_cpu(cpu) == UCODE_ERROR) if (microcode_init_cpu(cpu, true) == UCODE_ERROR)
return -EINVAL; return -EINVAL;
return err; return err;
......
...@@ -405,7 +405,8 @@ static int get_ucode_fw(void *to, const void *from, size_t n) ...@@ -405,7 +405,8 @@ static int get_ucode_fw(void *to, const void *from, size_t n)
return 0; return 0;
} }
static enum ucode_state request_microcode_fw(int cpu, struct device *device) static enum ucode_state request_microcode_fw(int cpu, struct device *device,
bool refresh_fw)
{ {
char name[30]; char name[30];
struct cpuinfo_x86 *c = &cpu_data(cpu); struct cpuinfo_x86 *c = &cpu_data(cpu);
......
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