|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/ucode/amd: Collect CPUID.1.EAX in collect_cpu_info()
commit c18e761c1375c58781ae559d5f93b1329da6e3a1
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Mar 27 13:20:12 2020 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Apr 1 14:00:12 2020 +0100
x86/ucode/amd: Collect CPUID.1.EAX in collect_cpu_info()
... rather than collecting it repeatedly in microcode_fits(). This brings
the
behaviour in line with the Intel side.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/cpu/microcode/amd.c | 11 +++--------
xen/include/asm-x86/microcode.h | 2 +-
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 575f87b487..3b73af9d29 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -79,6 +79,7 @@ static int collect_cpu_info(struct cpu_signature *csig)
{
memset(csig, 0, sizeof(*csig));
+ csig->sig = cpuid_eax(1);
rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev);
pr_debug("microcode: CPU%d collect_cpu_info: patch_id=%#x\n",
@@ -177,12 +178,9 @@ static enum microcode_match_result microcode_fits(
const struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
const struct microcode_header_amd *mc_header = mc_amd->mpb;
const struct equiv_cpu_entry *equiv_cpu_table = mc_amd->equiv_cpu_table;
- unsigned int current_cpu_id;
unsigned int equiv_cpu_id;
- current_cpu_id = cpuid_eax(0x00000001);
-
- if ( !find_equiv_cpu_id(equiv_cpu_table, current_cpu_id, &equiv_cpu_id) )
+ if ( !find_equiv_cpu_id(equiv_cpu_table, sig->sig, &equiv_cpu_id) )
return MIS_UCODE;
if ( (mc_header->processor_rev_id) != equiv_cpu_id )
@@ -419,13 +417,10 @@ static struct microcode_patch
*cpu_request_microcode(const void *buf,
struct microcode_patch *patch = NULL;
size_t offset = 0, saved_size = 0;
int error = 0;
- unsigned int current_cpu_id;
unsigned int equiv_cpu_id;
unsigned int cpu = smp_processor_id();
const struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
- current_cpu_id = cpuid_eax(0x00000001);
-
if ( bufsize < 4 || *(const uint32_t *)buf != UCODE_MAGIC )
{
printk(KERN_ERR "microcode: Wrong microcode patch file magic\n");
@@ -455,7 +450,7 @@ static struct microcode_patch *cpu_request_microcode(const
void *buf,
break;
}
- if ( find_equiv_cpu_id(mc_amd->equiv_cpu_table, current_cpu_id,
+ if ( find_equiv_cpu_id(mc_amd->equiv_cpu_table, sig->sig,
&equiv_cpu_id) )
break;
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.h
index 3a8e4e8221..cbbe28cb45 100644
--- a/xen/include/asm-x86/microcode.h
+++ b/xen/include/asm-x86/microcode.h
@@ -7,7 +7,7 @@
#include <public/xen.h>
struct cpu_signature {
- /* CPU signature (CPUID.1.EAX). Only written on Intel. */
+ /* CPU signature (CPUID.1.EAX). */
unsigned int sig;
/* Platform Flags. Only applicable to Intel. */
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |