mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/ucode: Rename the cpu_request_microcode() hook to parse()
cpu_request_microcode() was never a good name, and the microcode suffix is redundant. Rename it to simply parse(). Introduce ucode_parse() and ucode_parse_dup() wrappers around the parse() hook, also abstracting away the make_copy parameter and associated const-correctness. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
1 parent
fafa6c9f29
commit
ef31a8cefc
4 files changed
+21
-10
No files matched your search
@@ -422,7 +422,7 @@ static int scan_equiv_cpu_table(const struct container_equiv_table *et)
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
static struct microcode_patch *cf_check cpu_request_microcode(
|
||||
static struct microcode_patch *cf_check amd_ucode_parse(
|
||||
const void *buf, size_t size, bool make_copy)
|
||||
{
|
||||
const struct microcode_patch *saved = NULL;
|
||||
@@ -562,7 +562,7 @@ static const char __initconst amd_cpio_path[] =
|
||||
|
||||
static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops = {
|
||||
.collect_cpu_info = collect_cpu_info,
|
||||
.cpu_request_microcode = MICROCODE_OP(cpu_request_microcode),
|
||||
.parse = MICROCODE_OP(amd_ucode_parse),
|
||||
.apply_microcode = MICROCODE_OP(apply_microcode),
|
||||
.compare = MICROCODE_OP(amd_compare),
|
||||
.cpio_path = MICROCODE_OP(amd_cpio_path),
|
||||
|
||||
@@ -175,6 +175,18 @@ custom_param("ucode", parse_ucode);
|
||||
|
||||
static struct microcode_ops __ro_after_init ucode_ops;
|
||||
|
||||
/* Parse a ucode blob. Returns a pointer to a heap-allocated copy, or PTR_ERR. */
|
||||
static struct microcode_patch *ucode_parse_dup(const char *buf, size_t len)
|
||||
{
|
||||
return alternative_call(ucode_ops.parse, buf, len, true);
|
||||
}
|
||||
|
||||
/* Parse a ucode blob. Returns a pointer into @buf, or PTR_ERR. */
|
||||
static const struct microcode_patch *__init ucode_parse(const char *buf, size_t len)
|
||||
{
|
||||
return ucode_ops.parse(buf, len, false);
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(microcode_mutex);
|
||||
|
||||
DEFINE_PER_CPU(struct cpu_signature, cpu_sig);
|
||||
@@ -499,8 +511,7 @@ static long cf_check __maybe_unused ucode_update_hcall_cont(void *data)
|
||||
goto put;
|
||||
}
|
||||
|
||||
patch = alternative_call(ucode_ops.cpu_request_microcode,
|
||||
(const void *)buffer->buffer, buffer->len, true);
|
||||
patch = ucode_parse_dup(buffer->buffer, buffer->len);
|
||||
patch_with_flags.flags = buffer->flags;
|
||||
|
||||
xfree(buffer);
|
||||
@@ -715,7 +726,7 @@ static int __init cf_check microcode_init_cache(void)
|
||||
size = cd.size;
|
||||
}
|
||||
|
||||
patch = alternative_call(ucode_ops.cpu_request_microcode, data, size, true);
|
||||
patch = ucode_parse_dup(data, size);
|
||||
if ( IS_ERR(patch) )
|
||||
{
|
||||
rc = PTR_ERR(patch);
|
||||
@@ -749,7 +760,7 @@ static int __init early_microcode_load(struct boot_info *bi)
|
||||
{
|
||||
void *data = NULL;
|
||||
size_t size;
|
||||
struct microcode_patch *patch;
|
||||
const struct microcode_patch *patch;
|
||||
int idx = opt_mod_idx;
|
||||
int rc;
|
||||
|
||||
@@ -841,7 +852,7 @@ static int __init early_microcode_load(struct boot_info *bi)
|
||||
return 0;
|
||||
|
||||
found:
|
||||
patch = ucode_ops.cpu_request_microcode(data, size, false);
|
||||
patch = ucode_parse(data, size);
|
||||
if ( IS_ERR(patch) )
|
||||
{
|
||||
rc = PTR_ERR(patch);
|
||||
|
||||
@@ -333,7 +333,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct microcode_patch *cf_check cpu_request_microcode(
|
||||
static struct microcode_patch *cf_check intel_ucode_parse(
|
||||
const void *buf, size_t size, bool make_copy)
|
||||
{
|
||||
int error = 0;
|
||||
@@ -409,7 +409,7 @@ static const char __initconst intel_cpio_path[] =
|
||||
|
||||
static const struct microcode_ops __initconst_cf_clobber intel_ucode_ops = {
|
||||
.collect_cpu_info = collect_cpu_info,
|
||||
.cpu_request_microcode = MICROCODE_OP(cpu_request_microcode),
|
||||
.parse = MICROCODE_OP(intel_ucode_parse),
|
||||
.apply_microcode = MICROCODE_OP(apply_microcode),
|
||||
.compare = MICROCODE_OP(intel_compare),
|
||||
.cpio_path = MICROCODE_OP(intel_cpio_path),
|
||||
|
||||
@@ -33,7 +33,7 @@ struct microcode_ops {
|
||||
* If one is not found, (nothing matches the current CPU), return NULL.
|
||||
* Also may return ERR_PTR(-err), e.g. bad container, out of memory.
|
||||
*/
|
||||
struct microcode_patch *(*cpu_request_microcode)(
|
||||
struct microcode_patch *(*parse)(
|
||||
const void *buf, size_t size, bool make_copy);
|
||||
|
||||
/*
|
||||
|
||||