public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <borislav.petkov@amd.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	tglx@linutronix.de, hpa@linux.intel.com, borislav.petkov@amd.com
Subject: [tip:x86/microcode] x86, microcode: Add a refresh firmware flag to ->request_microcode_fw
Date: Wed, 22 Aug 2012 16:44:07 -0700	[thread overview]
Message-ID: <tip-48e30685caa8bdc4b8d4417d8ac31db59689742c@git.kernel.org> (raw)
In-Reply-To: <1344361461-10076-10-git-send-email-bp@amd64.org>

Commit-ID:  48e30685caa8bdc4b8d4417d8ac31db59689742c
Gitweb:     http://git.kernel.org/tip/48e30685caa8bdc4b8d4417d8ac31db59689742c
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Thu, 26 Jul 2012 15:51:00 +0200
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 22 Aug 2012 16:15:58 -0700

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>
---
 arch/x86/include/asm/microcode.h  |    4 ++--
 arch/x86/kernel/microcode_amd.c   |    3 ++-
 arch/x86/kernel/microcode_core.c  |   11 ++++++-----
 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 8813be6..43d921b 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -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);
 
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 25d34b1..94ecdaa 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -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;
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index dcde544..9420972 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)
 	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;
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 0327e2b..3544aed 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)
 	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);

  reply	other threads:[~2012-08-22 23:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 17:44 [PATCH v0 0/12] x86, microcode, AMD: Per-family patches cache Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 02/12] x86, microcode: Save an indentation level in reload_for_cpu Borislav Petkov
2012-08-22 23:37   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 03/12] x86, microcode: Drop uci->mc check on resume path Borislav Petkov
2012-08-22 23:38   ` [tip:x86/microcode] x86, microcode: Drop uci-> mc " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 04/12] x86, microcode: Cleanup cpu hotplug notifier callback Borislav Petkov
2012-08-22 23:39   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 05/12] x86, microcode: Straighten out Kconfig text Borislav Petkov
2012-08-22 23:40   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 06/12] x86, microcode, AMD: Remove useless get_ucode_data wrapper Borislav Petkov
2012-08-22 23:41   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 07/12] x86, microcode, AMD: Check before applying a patch Borislav Petkov
2012-08-22 23:42   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 08/12] x86, microcode, AMD: Read CPUID(1).EAX on the correct cpu Borislav Petkov
2012-08-22 23:43   ` [tip:x86/microcode] x86, microcode, AMD: Read CPUID(1). EAX " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 09/12] x86, microcode: Add a refresh firmware flag to ->request_microcode_fw Borislav Petkov
2012-08-22 23:44   ` tip-bot for Borislav Petkov [this message]
2012-08-07 17:44 ` [PATCH v0 10/12] x86, microcode, AMD: Add reverse equiv table search Borislav Petkov
2012-08-22 23:45   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 11/12] x86, microcode, AMD: Add a small, per-family patches cache Borislav Petkov
2012-08-22 23:45   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-07 17:44 ` [PATCH v0 12/12] x86, microcode, AMD: Rewrite patch application procedure Borislav Petkov
2012-08-22 23:46   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2012-08-22 23:22 ` [tip:x86/urgent] x86, microcode, AMD: Fix broken ucode patch size check tip-bot for Andreas Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-48e30685caa8bdc4b8d4417d8ac31db59689742c@git.kernel.org \
    --to=borislav.petkov@amd.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox