]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86, microcode: Add a refresh firmware flag to ->request_microcode_fw
authorBorislav Petkov <borislav.petkov@amd.com>
Thu, 26 Jul 2012 13:51:00 +0000 (15:51 +0200)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 22 Aug 2012 23:15:58 +0000 (16:15 -0700)
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>
arch/x86/include/asm/microcode.h
arch/x86/kernel/microcode_amd.c
arch/x86/kernel/microcode_core.c
arch/x86/kernel/microcode_intel.c

index 8813be600995b4ca72315c63d0996ab7b4dbcb56..43d921b4752c839c50e86e9ca2e17b2cd10866ac 100644 (file)
@@ -15,8 +15,8 @@ struct microcode_ops {
        enum ucode_state (*request_microcode_user) (int cpu,
                                const void __user *buf, size_t size);
 
-       enum ucode_state (*request_microcode_fw) (int cpu,
-                               struct device *device);
+       enum ucode_state (*request_microcode_fw) (int cpu, struct device *,
+                                                 bool refresh_fw);
 
        void (*microcode_fini_cpu) (int cpu);
 
index 25d34b177482d46917e2504cc44b3d90e0b931af..94ecdaa240524f3ee985500f82e4ed18a03e4459 100644 (file)
@@ -330,7 +330,8 @@ out:
  *
  * 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";
        const struct firmware *fw;
index dcde544e012c008a6746db3299b397ecb2a61ff9..9420972e98fea4123c9e92b46fc18fc2e622fc5f 100644 (file)
@@ -282,7 +282,7 @@ static int reload_for_cpu(int cpu)
        if (!uci->valid)
                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)
                apply_microcode_on_target(cpu);
        else
@@ -377,7 +377,7 @@ static enum ucode_state microcode_resume_cpu(int cpu)
        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;
 
@@ -388,7 +388,8 @@ static enum ucode_state microcode_init_cpu(int cpu)
        if (system_state != SYSTEM_RUNNING)
                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) {
                pr_debug("CPU%d updated upon init\n", cpu);
@@ -405,7 +406,7 @@ static enum ucode_state microcode_update_cpu(int cpu)
        if (uci->valid)
                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)
@@ -421,7 +422,7 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif)
        if (err)
                return err;
 
-       if (microcode_init_cpu(cpu) == UCODE_ERROR)
+       if (microcode_init_cpu(cpu, true) == UCODE_ERROR)
                return -EINVAL;
 
        return err;
index 0327e2b3c40869a0a767d8885572904a7f1cb2d4..3544aed3933816b9d9acd3d0784380696c4dce50 100644 (file)
@@ -405,7 +405,8 @@ static int get_ucode_fw(void *to, const void *from, size_t n)
        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];
        struct cpuinfo_x86 *c = &cpu_data(cpu);