|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/ucode: Rename the cpu_request_microcode() hook to parse()
commit ef31a8cefc4cae4ceee2b33245f091f782a71923
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 23 19:49:22 2024 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jan 28 12:33:04 2026 +0000
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@xxxxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
xen/arch/x86/cpu/microcode/amd.c | 4 ++--
xen/arch/x86/cpu/microcode/core.c | 21 ++++++++++++++++-----
xen/arch/x86/cpu/microcode/intel.c | 4 ++--
xen/arch/x86/cpu/microcode/private.h | 2 +-
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index c1ab6deb4d..a3c4a07cac 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -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),
diff --git a/xen/arch/x86/cpu/microcode/core.c
b/xen/arch/x86/cpu/microcode/core.c
index 3000a9c442..a0ea6e188a 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -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);
diff --git a/xen/arch/x86/cpu/microcode/intel.c
b/xen/arch/x86/cpu/microcode/intel.c
index dac464961a..ce70ce2ad1 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -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),
diff --git a/xen/arch/x86/cpu/microcode/private.h
b/xen/arch/x86/cpu/microcode/private.h
index 77ce816c1a..deebe78adf 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -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);
/*
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |