diff mbox series

[1/3] x86/ucode: Don't use microcode_update_cpu() in early_microcode_load()

Message ID 20241107122117.4073266-2-andrew.cooper3@citrix.com (mailing list archive)
State Superseded
Headers show
Series x86/ucode: Simplify/fix loading paths further | expand

Commit Message

Andrew Cooper Nov. 7, 2024, 12:21 p.m. UTC
There are two callers of microcode_update_cpu(), and because one passes NULL
and one doesn't, there are effectively two disjoint pieces of logic wrapped in
a single function.

early_microcode_load()'s use skips all the microcode_cache handling, and is
just a simple patch application.

This skips a redundant collect_cpu_info() call (performed in
early_microcode_init(), marginally earlier), and avoids holding
microcode_mutex when we're not interacting with microcode_cache at all.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Beulich Nov. 12, 2024, 10:34 a.m. UTC | #1
On 07.11.2024 13:21, Andrew Cooper wrote:
> There are two callers of microcode_update_cpu(), and because one passes NULL
> and one doesn't, there are effectively two disjoint pieces of logic wrapped in
> a single function.
> 
> early_microcode_load()'s use skips all the microcode_cache handling, and is
> just a simple patch application.
> 
> This skips a redundant collect_cpu_info() call (performed in
> early_microcode_init(), marginally earlier), and avoids holding
> microcode_mutex when we're not interacting with microcode_cache at all.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Personally I would have deemed it more logical (and Misra-compliant) to
remove the "if ( patch )" case from microcode_update_cpu() right here.
Surely (by its title) the next patch is going to have the same effect.

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 11cd878d1f2e..d9406ec3fd34 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -900,7 +900,7 @@  static int __init early_microcode_load(struct boot_info *bi)
      */
     early_mod_idx = idx;
 
-    rc = microcode_update_cpu(patch, 0);
+    rc = ucode_ops.apply_microcode(patch, 0);
 
  unmap:
     bootstrap_unmap();