On 22.06.2023 19:42, Alejandro Vallejo wrote:
> --- a/xen/arch/x86/cpu/microcode/intel.c
> +++ b/xen/arch/x86/cpu/microcode/intel.c
> @@ -385,6 +385,19 @@ static struct microcode_patch *cf_check 
> cpu_request_microcode(
>      return patch;
>  }
>  
> +bool __init intel_can_load_microcode(void)
> +{
> +    uint64_t mcu_ctrl;
> +
> +    if ( !cpu_has_mcu_ctrl )
> +        return true;
> +
> +    rdmsrl(MSR_MCU_CONTROL, mcu_ctrl);
> +
> +    /* If DIS_MCU_LOAD is set applying microcode updates won't work */
> +    return  !(mcu_ctrl & MCU_CONTROL_DIS_MCU_LOAD);

And we have to honor this, i.e. we shouldn't make an attempt
at clearing the bit?

Also nit: One too many blank after "return".

> --- a/xen/arch/x86/cpu/microcode/private.h
> +++ b/xen/arch/x86/cpu/microcode/private.h
> @@ -60,6 +60,13 @@ struct microcode_ops {
>          const struct microcode_patch *new, const struct microcode_patch 
> *old);
>  };
>  
> +/**
> + * Checks whether we can perform microcode updates on this Intel system
> + *
> + * @return True iff the microcode update facilities are enabled
> + */
> +bool __init intel_can_load_microcode(void);

No __init please on declarations; they only matter on definitions.

Jan

Reply via email to