Re: [PATCH] x86/microcode: Consolidate the loader enablement
From: Thomas Gleixner
Date: Thu Apr 10 2025 - 08:01:13 EST
On Tue, Apr 08 2025 at 19:22, Borislav Petkov wrote:
> static struct microcode_ops *microcode_ops;
> -bool dis_ucode_ldr = true;
> +static int dis_ucode_ldr = -1;
This tristate muck is disgusting.
> bool force_minrev = IS_ENABLED(CONFIG_MICROCODE_LATE_FORCE_MINREV);
> module_param(force_minrev, bool, S_IRUSR | S_IWUSR);
> @@ -95,11 +95,20 @@ static bool amd_check_current_patch_level(void)
> return false;
> }
>
> -static bool __init check_loader_disabled_bsp(void)
> +bool __init microcode_loader_disabled(void)
> {
> - static const char *__dis_opt_str = "dis_ucode_ldr";
> - const char *cmdline = boot_command_line;
> - const char *option = __dis_opt_str;
> + if (dis_ucode_ldr < 0) {
> + if (cmdline_find_option_bool(boot_command_line, "dis_ucode_ldr") <= 0)
> + dis_ucode_ldr = 0;
> + else
> + goto disable;
> + }
It just exists to make the above a one time operation. What's wrong with
having:
static void __init microcode_check_cmdline(void)
{
if (cmdline_find_option_bool(boot_command_line, "dis_ucode_ldr") <= 0)
dis_ucode_ldr = false;
}
and call that once at the proper place?
Thanks,
tglx