|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/ucode: Rename the apply_microcode() hook to load()
commit 4ae1962cdb2402c207b7129f67123a808763c108
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 23 19:35:36 2024 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jan 28 12:33:04 2026 +0000
x86/ucode: Rename the apply_microcode() hook to load()
The microcode suffix is redundant, and "microcode loading" is the more
common
term.
Introduce the ucode_load() wrapper to encapsulate the alternative_call().
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
xen/arch/x86/cpu/microcode/amd.c | 6 +++---
xen/arch/x86/cpu/microcode/core.c | 24 +++++++++++++++---------
xen/arch/x86/cpu/microcode/intel.c | 8 ++++----
xen/arch/x86/cpu/microcode/private.h | 7 +++----
4 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index a3c4a07cac..90f10ac8be 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -310,8 +310,8 @@ static bool check_min_rev(const struct microcode_patch
*patch)
return this_cpu(cpu_sig).rev >= patch->min_rev;
}
-static int cf_check apply_microcode(const struct microcode_patch *patch,
- unsigned int flags)
+static int cf_check amd_ucode_load(const struct microcode_patch *patch,
+ unsigned int flags)
{
int hw_err, result;
unsigned int cpu = smp_processor_id();
@@ -563,7 +563,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,
.parse = MICROCODE_OP(amd_ucode_parse),
- .apply_microcode = MICROCODE_OP(apply_microcode),
+ .load = MICROCODE_OP(amd_ucode_load),
.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 a0ea6e188a..ea0b35c499 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -187,6 +187,12 @@ static const struct microcode_patch *__init
ucode_parse(const char *buf, size_t
return ucode_ops.parse(buf, len, false);
}
+/* Load a ucode blob. Returns -errno. */
+static int ucode_load(const struct microcode_patch *patch, unsigned int flags)
+{
+ return alternative_call(ucode_ops.load, patch, flags);
+}
+
static DEFINE_SPINLOCK(microcode_mutex);
DEFINE_PER_CPU(struct cpu_signature, cpu_sig);
@@ -287,7 +293,7 @@ static int primary_thread_work(const struct microcode_patch
*patch,
if ( !wait_for_state(LOADING_ENTER) )
return 0;
- ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
+ ret = ucode_load(patch, flags);
if ( !ret )
atomic_inc(&cpu_updated);
atomic_inc(&cpu_out);
@@ -397,7 +403,7 @@ static int control_thread_fn(const struct microcode_patch
*patch,
goto out;
/* Control thread loads ucode first while others are in NMI handler. */
- ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
+ ret = ucode_load(patch, flags);
if ( !ret )
atomic_inc(&cpu_updated);
atomic_inc(&cpu_out);
@@ -634,7 +640,7 @@ int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
if ( flags & ~XENPF_UCODE_FORCE )
return -EINVAL;
- if ( !ucode_ops.apply_microcode )
+ if ( !ucode_ops.load )
return -EINVAL;
buffer = xmalloc_flex_struct(struct ucode_buf, buffer, len);
@@ -671,12 +677,12 @@ int microcode_update_one(void)
if ( ucode_ops.collect_cpu_info )
alternative_vcall(ucode_ops.collect_cpu_info);
- if ( !IS_ENABLED(CONFIG_MICROCODE_LOADING) || !ucode_ops.apply_microcode )
+ if ( !IS_ENABLED(CONFIG_MICROCODE_LOADING) || !ucode_ops.load )
return -EOPNOTSUPP;
spin_lock(µcode_mutex);
if ( microcode_cache )
- rc = alternative_call(ucode_ops.apply_microcode, microcode_cache, 0);
+ rc = ucode_load(microcode_cache, 0);
else
rc = -ENOENT;
spin_unlock(µcode_mutex);
@@ -876,7 +882,7 @@ static int __init early_microcode_load(struct boot_info *bi)
*/
early_mod_idx = idx;
- rc = ucode_ops.apply_microcode(patch, 0);
+ rc = ucode_load(patch, 0);
if ( rc == 0 )
/* Rescan CPUID/MSR features, which may have changed after a load. */
@@ -925,11 +931,11 @@ int __init early_microcode_init(struct boot_info *bi)
*
* Take the hint in either case and ignore the microcode interface.
*/
- if ( !ucode_ops.apply_microcode || this_cpu(cpu_sig).rev == ~0 )
+ if ( !ucode_ops.load || this_cpu(cpu_sig).rev == ~0 )
{
printk(XENLOG_INFO "Microcode loading disabled due to: %s\n",
- ucode_ops.apply_microcode ? "rev = ~0" : "HW toggle");
- ucode_ops.apply_microcode = NULL;
+ ucode_ops.load ? "rev = ~0" : "HW toggle");
+ ucode_ops.load = NULL;
return -ENODEV;
}
diff --git a/xen/arch/x86/cpu/microcode/intel.c
b/xen/arch/x86/cpu/microcode/intel.c
index ce70ce2ad1..c45b00c6b0 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -286,8 +286,8 @@ static int cf_check intel_compare(
return compare_revisions(old->rev, new->rev);
}
-static int cf_check apply_microcode(const struct microcode_patch *patch,
- unsigned int flags)
+static int cf_check intel_ucode_load(const struct microcode_patch *patch,
+ unsigned int flags)
{
uint64_t msr_content;
unsigned int cpu = smp_processor_id();
@@ -410,7 +410,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,
.parse = MICROCODE_OP(intel_ucode_parse),
- .apply_microcode = MICROCODE_OP(apply_microcode),
+ .load = MICROCODE_OP(intel_ucode_load),
.compare = MICROCODE_OP(intel_compare),
.cpio_path = MICROCODE_OP(intel_cpio_path),
};
@@ -423,5 +423,5 @@ void __init ucode_probe_intel(struct microcode_ops *ops)
return;
if ( !can_load_microcode() )
- ops->apply_microcode = NULL;
+ ops->load = NULL;
}
diff --git a/xen/arch/x86/cpu/microcode/private.h
b/xen/arch/x86/cpu/microcode/private.h
index deebe78adf..9306d98065 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -46,8 +46,7 @@ struct microcode_ops {
* Attempt to load the provided patch into the CPU. Returns an error if
* anything didn't go as expected.
*/
- int (*apply_microcode)(const struct microcode_patch *patch,
- unsigned int flags);
+ int (*load)(const struct microcode_patch *patch, unsigned int flags);
/*
* Given a current patch, and a proposed new patch, order them based on
revision.
@@ -79,8 +78,8 @@ extern bool opt_digest_check;
* - Loading available
*
* These are encoded by (not) filling in ops->collect_cpu_info (i.e. no
- * support available) and (not) ops->apply_microcode (i.e. read only).
- * Otherwise, all hooks must be filled in.
+ * support available) and (not) ops->load (i.e. read only). Otherwise, all
+ * hooks must be filled in.
*/
#ifdef CONFIG_AMD
void ucode_probe_amd(struct microcode_ops *ops);
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |