Skip to content

Commit

Permalink
x86/microcode/intel: Move mc arg last in get_matching_{microcode|sig}
Browse files Browse the repository at this point in the history
... arguments list so that it comes more natural for those functions to
have the signature, processor flags and revision together, before the
rest of the args.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Borislav Petkov committed Mar 2, 2015
1 parent 9e02bb4 commit e3d8f67
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
5 changes: 2 additions & 3 deletions arch/x86/include/asm/microcode_intel.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ struct extended_sigtable {

#define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE)

extern int
get_matching_microcode(unsigned int csig, int cpf, void *mc, int rev);
extern int get_matching_microcode(unsigned int csig, int cpf, int rev, void *mc);
extern int microcode_sanity_check(void *mc, int print_err);
extern int get_matching_sig(unsigned int csig, int cpf, void *mc, int rev);
extern int get_matching_sig(unsigned int csig, int cpf, int rev, void *mc);

static inline int
revision_is_newer(struct microcode_header_intel *mc_header, int rev)
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/microcode/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int get_matching_mc(struct microcode_intel *mc_intel, int cpu)
cpf = cpu_sig.pf;
crev = cpu_sig.rev;

return get_matching_microcode(csig, cpf, mc_intel, crev);
return get_matching_microcode(csig, cpf, crev, mc_intel);
}

static int apply_microcode_intel(int cpu)
Expand Down Expand Up @@ -226,7 +226,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,

csig = uci->cpu_sig.sig;
cpf = uci->cpu_sig.pf;
if (get_matching_microcode(csig, cpf, mc, new_rev)) {
if (get_matching_microcode(csig, cpf, new_rev, mc)) {
vfree(new_mc);
new_rev = mc_header.rev;
new_mc = mc;
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/kernel/cpu/microcode/intel_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ load_microcode_early(struct microcode_intel **saved,

ret = get_matching_microcode(uci->cpu_sig.sig,
uci->cpu_sig.pf,
ucode_ptr,
new_rev);
new_rev,
ucode_ptr);
if (!ret)
continue;

Expand Down Expand Up @@ -251,7 +251,7 @@ static unsigned int _save_mc(struct microcode_intel **mc_saved,
pf = mc_saved_hdr->pf;
new_rev = mc_hdr->rev;

if (!get_matching_sig(sig, pf, ucode_ptr, new_rev))
if (!get_matching_sig(sig, pf, new_rev, ucode_ptr))
continue;

found = 1;
Expand Down
16 changes: 7 additions & 9 deletions arch/x86/kernel/cpu/microcode/intel_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ int microcode_sanity_check(void *mc, int print_err)
EXPORT_SYMBOL_GPL(microcode_sanity_check);

/*
* return 0 - no update found
* return 1 - found update
* Returns 1 if update has been found, 0 otherwise.
*/
int get_matching_sig(unsigned int csig, int cpf, void *mc, int rev)
int get_matching_sig(unsigned int csig, int cpf, int rev, void *mc)
{
struct microcode_header_intel *mc_header = mc;
struct extended_sigtable *ext_header;
Expand Down Expand Up @@ -153,16 +152,15 @@ int get_matching_sig(unsigned int csig, int cpf, void *mc, int rev)
}

/*
* return 0 - no update found
* return 1 - found update
* Returns 1 if update has been found, 0 otherwise.
*/
int get_matching_microcode(unsigned int csig, int cpf, void *mc, int rev)
int get_matching_microcode(unsigned int csig, int cpf, int rev, void *mc)
{
struct microcode_header_intel *mc_header = mc;
struct microcode_header_intel *mc_hdr = mc;

if (!revision_is_newer(mc_header, rev))
if (!revision_is_newer(mc_hdr, rev))
return 0;

return get_matching_sig(csig, cpf, mc, rev);
return get_matching_sig(csig, cpf, rev, mc);
}
EXPORT_SYMBOL_GPL(get_matching_microcode);

0 comments on commit e3d8f67

Please sign in to comment.