[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] x86/ucode/amd: Alter API for microcode_fits()



commit e6ac4d1b4584581255bb1b4bdf98ca469c4f1837
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Mar 30 17:44:17 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Apr 1 14:00:12 2020 +0100

    x86/ucode/amd: Alter API for microcode_fits()
    
    Although it is logically a step in the wrong direction overall, it 
simplifies
    the rearranging of cpu_request_microcode() substantially for 
microcode_fits()
    to take struct microcode_header_amd directly, and not require an 
intermediate
    struct microcode_amd pointing at it.
    
    Make this change (taking time to rename 'mc_amd' to its eventual 'patch' to
    reduce the churn in the series), and a later cleanup will make it uniformly
    take a struct microcode_patch.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/cpu/microcode/amd.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 9ea92f6005..0365c85d99 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -173,31 +173,30 @@ static bool check_final_patch_levels(const struct 
cpu_signature *sig)
 }
 
 static enum microcode_match_result microcode_fits(
-    const struct microcode_amd *mc_amd)
+    const struct microcode_header_amd *patch)
 {
     unsigned int cpu = smp_processor_id();
     const struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
-    const struct microcode_header_amd *mc_header = mc_amd->mpb;
 
     if ( equiv.sig != sig->sig ||
-         equiv.id  != mc_header->processor_rev_id )
+         equiv.id  != patch->processor_rev_id )
         return MIS_UCODE;
 
-    if ( mc_header->patch_id <= sig->rev )
+    if ( patch->patch_id <= sig->rev )
     {
         pr_debug("microcode: patch is already at required level or 
greater.\n");
         return OLD_UCODE;
     }
 
     pr_debug("microcode: CPU%d found a matching microcode update with version 
%#x (current=%#x)\n",
-             cpu, mc_header->patch_id, sig->rev);
+             cpu, patch->patch_id, sig->rev);
 
     return NEW_UCODE;
 }
 
 static bool match_cpu(const struct microcode_patch *patch)
 {
-    return patch && (microcode_fits(patch) == NEW_UCODE);
+    return patch && (microcode_fits(patch->mpb) == NEW_UCODE);
 }
 
 static void free_patch(struct microcode_patch *mc_amd)
@@ -223,14 +222,11 @@ static enum microcode_match_result compare_header(
 static enum microcode_match_result compare_patch(
     const struct microcode_patch *new, const struct microcode_patch *old)
 {
-    const struct microcode_header_amd *new_header = new->mpb;
-    const struct microcode_header_amd *old_header = old->mpb;
-
     /* Both patches to compare are supposed to be applicable to local CPU. */
-    ASSERT(microcode_fits(new) != MIS_UCODE);
-    ASSERT(microcode_fits(old) != MIS_UCODE);
+    ASSERT(microcode_fits(new->mpb) != MIS_UCODE);
+    ASSERT(microcode_fits(old->mpb) != MIS_UCODE);
 
-    return compare_header(new_header, old_header);
+    return compare_header(new->mpb, old->mpb);
 }
 
 static int apply_microcode(const struct microcode_patch *patch)
@@ -508,7 +504,7 @@ static struct microcode_patch *cpu_request_microcode(const 
void *buf,
          * If the new ucode covers current CPU, compare ucodes and store the
          * one with higher revision.
          */
-        if ( (microcode_fits(mc_amd) != MIS_UCODE) &&
+        if ( (microcode_fits(mc_amd->mpb) != MIS_UCODE) &&
              (!saved || (compare_header(mc_amd->mpb, saved) == NEW_UCODE)) )
         {
             xfree(saved);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.