From: Borislav Petkov <bp@amd64.org>
To: X86-ML <x86@kernel.org>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
LKML <linux-kernel@vger.kernel.org>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH v0 08/12] x86, microcode, AMD: Read CPUID(1).EAX on the correct cpu
Date: Tue, 7 Aug 2012 19:44:17 +0200 [thread overview]
Message-ID: <1344361461-10076-9-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1344361461-10076-1-git-send-email-bp@amd64.org>
From: Borislav Petkov <borislav.petkov@amd.com>
Read the CPUID(1).EAX leaf at the correct cpu and use it to search the
equivalence table for matching microcode patch. No functionality change.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
arch/x86/kernel/microcode_amd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 8fdf7d99b804..25d34b177482 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -82,6 +82,7 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
+ csig->sig = cpuid_eax(0x00000001);
csig->rev = c->microcode;
pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev);
@@ -118,16 +119,15 @@ static unsigned int verify_ucode_size(int cpu, u32 patch_size,
return patch_size;
}
-static u16 find_equiv_id(void)
+static u16 find_equiv_id(unsigned int cpu)
{
- unsigned int current_cpu_id, i = 0;
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+ int i = 0;
BUG_ON(equiv_cpu_table == NULL);
- current_cpu_id = cpuid_eax(0x00000001);
-
while (equiv_cpu_table[i].installed_cpu != 0) {
- if (current_cpu_id == equiv_cpu_table[i].installed_cpu)
+ if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu)
return equiv_cpu_table[i].equiv_cpu;
i++;
@@ -150,7 +150,7 @@ static int get_matching_microcode(int cpu, const u8 *ucode_ptr,
patch_size = *(u32 *)(ucode_ptr + 4);
*current_size = patch_size + SECTION_HDR_SIZE;
- equiv_cpu_id = find_equiv_id();
+ equiv_cpu_id = find_equiv_id(cpu);
if (!equiv_cpu_id)
return 0;
--
1.7.11.rc1
next prev parent reply other threads:[~2012-08-07 17: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 ` Borislav Petkov [this message]
2012-08-22 23:43 ` [tip:x86/microcode] x86, microcode, AMD: Read CPUID(1). EAX on the correct cpu 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:x86/microcode] " tip-bot for Borislav Petkov
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=1344361461-10076-9-git-send-email-bp@amd64.org \
--to=bp@amd64.org \
--cc=andreas.herrmann3@amd.com \
--cc=borislav.petkov@amd.com \
--cc=hmh@hmh.eng.br \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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
Powered by JetHome