[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/3] x86/ucode: Break out compare_revisions() from existing infrastructure
Drop some unnecesserily verbose pr_debug()'s on the AMD side. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Juergen Gross <jgross@xxxxxxxx> CC: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx> --- xen/arch/x86/cpu/microcode/amd.c | 22 +++++++++++----------- xen/arch/x86/cpu/microcode/intel.c | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index e80f7cd3e4..7d2f57c4cb 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -168,6 +168,15 @@ static bool check_final_patch_levels(const struct cpu_signature *sig) return false; } +static enum microcode_match_result compare_revisions( + uint32_t old_rev, uint32_t new_rev) +{ + if ( new_rev > old_rev ) + return NEW_UCODE; + + return OLD_UCODE; +} + static enum microcode_match_result microcode_fits( const struct microcode_patch *patch) { @@ -178,16 +187,7 @@ static enum microcode_match_result microcode_fits( equiv.id != patch->processor_rev_id ) return MIS_UCODE; - 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, patch->patch_id, sig->rev); - - return NEW_UCODE; + return compare_revisions(sig->rev, patch->patch_id); } static enum microcode_match_result compare_header( @@ -196,7 +196,7 @@ static enum microcode_match_result compare_header( if ( new->processor_rev_id != old->processor_rev_id ) return MIS_UCODE; - return new->patch_id > old->patch_id ? NEW_UCODE : OLD_UCODE; + return compare_revisions(old->patch_id, new->patch_id); } static enum microcode_match_result compare_patch( diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index 72c07fcd1d..e1ccb5d232 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -222,6 +222,15 @@ static int microcode_sanity_check(const struct microcode_patch *patch) return 0; } +static enum microcode_match_result compare_revisions( + uint32_t old_rev, uint32_t new_rev) +{ + if ( new_rev > old_rev ) + return NEW_UCODE; + + return OLD_UCODE; +} + /* Check an update against the CPU signature and current update revision */ static enum microcode_match_result microcode_update_match( const struct microcode_patch *mc) @@ -245,7 +254,7 @@ static enum microcode_match_result microcode_update_match( return MIS_UCODE; found: - return mc->rev > cpu_sig->rev ? NEW_UCODE : OLD_UCODE; + return compare_revisions(cpu_sig->rev, mc->rev); } static enum microcode_match_result compare_patch( @@ -258,7 +267,7 @@ static enum microcode_match_result compare_patch( ASSERT(microcode_update_match(old) != MIS_UCODE); ASSERT(microcode_update_match(new) != MIS_UCODE); - return new->rev > old->rev ? NEW_UCODE : OLD_UCODE; + return compare_revisions(old->rev, new->rev); } static int apply_microcode(const struct microcode_patch *patch) @@ -332,7 +341,7 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, * one with higher revision. */ if ( (microcode_update_match(mc) != MIS_UCODE) && - (!saved || (mc->rev > saved->rev)) ) + (!saved || compare_revisions(saved->rev, mc->rev) == NEW_UCODE) ) saved = mc; buf += blob_size; -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |