Re: [patch V3 12/30] x86/microcode/intel: Reuse intel_cpu_collect_info()

From: Thomas Gleixner
Date: Mon Sep 25 2023 - 11:50:50 EST


On Thu, Sep 21 2023 at 12:42, Borislav Petkov wrote:

> On Tue, Sep 12, 2023 at 09:58:02AM +0200, Thomas Gleixner wrote:
>> static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
>
> You can get rid of that silly wrapper too and use
> intel_collect_cpu_info() in the function pointer assignment directly.
>
> Diff ontop:
>
> ---
>
> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
> index 4066dd3734ba..581ecfbaf134 100644
> --- a/arch/x86/include/asm/cpu.h
> +++ b/arch/x86/include/asm/cpu.h
> @@ -75,7 +75,7 @@ extern __noendbr void cet_disable(void);
>
> struct cpu_signature;
>
> -void intel_collect_cpu_info(struct cpu_signature *sig);
> +void intel_collect_cpu_info(int unused, struct cpu_signature *sig);

Eew. That's a function exposed to code outside of microcode and just
grows that unused argument for no value and you obviously forgot to
fixup the extern callsite :)

> diff --git a/arch/x86/kernel/cpu/microcode/internal.h b/arch/x86/kernel/cpu/microcode/internal.h
> index 051b7956d4fd..b3753025cd4a 100644
> --- a/arch/x86/kernel/cpu/microcode/internal.h
> +++ b/arch/x86/kernel/cpu/microcode/internal.h
> @@ -30,7 +30,7 @@ struct microcode_ops {
> * See also the "Synchronization" section in microcode_core.c.
> */
> enum ucode_state (*apply_microcode)(int cpu);
> - int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
> + void (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
> void (*finalize_late_load)(int result);

Making this void makes sense, but that's a separate change.

Thanks,

tglx