mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/ucode: Simplify the ops->collect_cpu_info() API
All callers pass &this_cpu(cpu_sig) for the cpu_sig parameter, and all implementations unconditionally return 0. Simplify it to be void. Drop the long-stale comment on the AMD side, whose counterpart in start_update() used to be "collect_cpu_info() doesn't fail so we're fine". Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
6b8836aa65
commit
990b6e38d9
4 files changed
+16
-17
No files matched your search
@@ -90,9 +90,10 @@ static struct {
|
||||
uint16_t id;
|
||||
} equiv __read_mostly;
|
||||
|
||||
/* See comment in start_update() for cases when this routine fails */
|
||||
static int collect_cpu_info(struct cpu_signature *csig)
|
||||
static void collect_cpu_info(void)
|
||||
{
|
||||
struct cpu_signature *csig = &this_cpu(cpu_sig);
|
||||
|
||||
memset(csig, 0, sizeof(*csig));
|
||||
|
||||
csig->sig = cpuid_eax(1);
|
||||
@@ -100,8 +101,6 @@ static int collect_cpu_info(struct cpu_signature *csig)
|
||||
|
||||
pr_debug("microcode: CPU%d collect_cpu_info: patch_id=%#x\n",
|
||||
smp_processor_id(), csig->rev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool_t verify_patch_size(uint32_t patch_size)
|
||||
|
||||
@@ -237,10 +237,9 @@ static const struct microcode_patch *nmi_patch = ZERO_BLOCK_PTR;
|
||||
*/
|
||||
static struct microcode_patch *parse_blob(const char *buf, size_t len)
|
||||
{
|
||||
if ( likely(!microcode_ops->collect_cpu_info(&this_cpu(cpu_sig))) )
|
||||
return microcode_ops->cpu_request_microcode(buf, len);
|
||||
microcode_ops->collect_cpu_info();
|
||||
|
||||
return NULL;
|
||||
return microcode_ops->cpu_request_microcode(buf, len);
|
||||
}
|
||||
|
||||
static void microcode_free_patch(struct microcode_patch *patch)
|
||||
@@ -306,10 +305,9 @@ static bool wait_cpu_callout(unsigned int nr)
|
||||
*/
|
||||
static int microcode_update_cpu(const struct microcode_patch *patch)
|
||||
{
|
||||
int err = microcode_ops->collect_cpu_info(&this_cpu(cpu_sig));
|
||||
int err;
|
||||
|
||||
if ( unlikely(err) )
|
||||
return err;
|
||||
microcode_ops->collect_cpu_info();
|
||||
|
||||
spin_lock(µcode_mutex);
|
||||
if ( patch )
|
||||
@@ -737,7 +735,7 @@ int microcode_update_one(bool start_update)
|
||||
if ( !microcode_ops )
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
microcode_ops->collect_cpu_info(&this_cpu(cpu_sig));
|
||||
microcode_ops->collect_cpu_info();
|
||||
|
||||
if ( start_update && microcode_ops->start_update )
|
||||
{
|
||||
@@ -819,7 +817,7 @@ int __init early_microcode_init(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
microcode_ops->collect_cpu_info(&this_cpu(cpu_sig));
|
||||
microcode_ops->collect_cpu_info();
|
||||
|
||||
if ( ucode_mod.mod_end || ucode_blob.size )
|
||||
rc = early_microcode_update_cpu();
|
||||
|
||||
@@ -115,8 +115,9 @@ static bool signature_matches(const struct cpu_signature *cpu_sig,
|
||||
return cpu_sig->pf & ucode_pf;
|
||||
}
|
||||
|
||||
static int collect_cpu_info(struct cpu_signature *csig)
|
||||
static void collect_cpu_info(void)
|
||||
{
|
||||
struct cpu_signature *csig = &this_cpu(cpu_sig);
|
||||
uint64_t msr_content;
|
||||
|
||||
memset(csig, 0, sizeof(*csig));
|
||||
@@ -133,8 +134,6 @@ static int collect_cpu_info(struct cpu_signature *csig)
|
||||
csig->rev = (uint32_t)(msr_content >> 32);
|
||||
pr_debug("microcode: collect_cpu_info : sig=%#x, pf=%#x, rev=%#x\n",
|
||||
csig->sig, csig->pf, csig->rev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -33,8 +33,11 @@ struct microcode_ops {
|
||||
struct microcode_patch *(*cpu_request_microcode)(const void *buf,
|
||||
size_t size);
|
||||
|
||||
/* Obtain microcode-relevant details for the current CPU. */
|
||||
int (*collect_cpu_info)(struct cpu_signature *csig);
|
||||
/*
|
||||
* Obtain microcode-relevant details for the current CPU. Results in
|
||||
* per_cpu(cpu_sig).
|
||||
*/
|
||||
void (*collect_cpu_info)(void);
|
||||
|
||||
/*
|
||||
* Attempt to load the provided patch into the CPU. Returns an error if
|
||||
|
||||