mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][stable-28] x86: microcode_amd: fix wrong handling of equivalent CPU id
@ 2009-02-09 10:32 Andreas Herrmann
  2009-02-09 10:45 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Herrmann @ 2009-02-09 10:32 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ingo Molnar

Impact: fix bug resulting in non-loaded AMD microcode

mc_header->processor_rev_id is a 2 byte value. Similar is true for
equiv_cpu in an equiv_cpu_entry -- only 2 bytes are of interest.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/microcode_amd.c |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)

This fix is already upstream.
See

 commit 3c763fd77e66e55d029052da31df0abd9920cb1e
 (x86: microcode_amd: fix wrong handling of equivalent CPU id)

Please apply to stable-28.
Thanks,

Andreas


diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 5f8e5d7..b5bc814 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -62,7 +62,7 @@ struct microcode_header_amd {
 	unsigned int  mc_patch_data_checksum;
 	unsigned int  nb_dev_id;
 	unsigned int  sb_dev_id;
-	unsigned char processor_rev_id[2];
+	u16 processor_rev_id;
 	unsigned char nb_rev_id;
 	unsigned char sb_rev_id;
 	unsigned char bios_api_rev;
@@ -125,7 +125,7 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
 
 	while (equiv_cpu_table[i].installed_cpu != 0) {
 		if (current_cpu_id == equiv_cpu_table[i].installed_cpu) {
-			equiv_cpu_id = equiv_cpu_table[i].equiv_cpu;
+			equiv_cpu_id = equiv_cpu_table[i].equiv_cpu & 0xffff;
 			break;
 		}
 		i++;
@@ -137,21 +137,10 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
 		return 0;
 	}
 
-	if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) {
-		printk(KERN_ERR
-			"microcode: CPU%d patch does not match "
-			"(patch is %x, cpu extended is %x) \n",
-			cpu, mc_header->processor_rev_id[0],
-			(equiv_cpu_id & 0xff));
-		return 0;
-	}
-
-	if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) {
-		printk(KERN_ERR "microcode: CPU%d patch does not match "
-			"(patch is %x, cpu base id is %x) \n",
-			cpu, mc_header->processor_rev_id[1],
-			((equiv_cpu_id >> 16) & 0xff));
-
+	if (mc_header->processor_rev_id != equiv_cpu_id) {
+		printk(KERN_ERR	"microcode: CPU%d patch does not match "
+		       "(processor_rev_id: %x, eqiv_cpu_id: %x)\n",
+		       cpu, mc_header->processor_rev_id, equiv_cpu_id);
 		return 0;
 	}
 
-- 
1.6.0.4




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][stable-28] x86: microcode_amd: fix wrong handling of equivalent CPU id
  2009-02-09 10:32 [PATCH][stable-28] x86: microcode_amd: fix wrong handling of equivalent CPU id Andreas Herrmann
@ 2009-02-09 10:45 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2009-02-09 10:45 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: stable, linux-kernel


* Andreas Herrmann <andreas.herrmann3@amd.com> wrote:

> Impact: fix bug resulting in non-loaded AMD microcode
> 
> mc_header->processor_rev_id is a 2 byte value. Similar is true for
> equiv_cpu in an equiv_cpu_entry -- only 2 bytes are of interest.
> 
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---
>  arch/x86/kernel/microcode_amd.c |   23 ++++++-----------------
>  1 files changed, 6 insertions(+), 17 deletions(-)
> 
> This fix is already upstream.
> See
> 
>  commit 3c763fd77e66e55d029052da31df0abd9920cb1e
>  (x86: microcode_amd: fix wrong handling of equivalent CPU id)
> 
> Please apply to stable-28.

ack for the -stable backport.

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-09 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09 10:32 [PATCH][stable-28] x86: microcode_amd: fix wrong handling of equivalent CPU id Andreas Herrmann
2009-02-09 10:45 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®