Re: [patch V2 03/37] x86/microcode/intel: Move microcode functions out of cpu/intel.c

From: Qiuxu Zhuo
Date: Wed Aug 23 2023 - 09:00:19 EST


Hi Thomas,

> ...
> -#define get_totalsize(mc) \
> - (((struct microcode_intel *)mc)->hdr.datasize ? \
> - ((struct microcode_intel *)mc)->hdr.totalsize : \
> - DEFAULT_UCODE_TOTALSIZE)
> +#define DEFAULT_UCODE_DATASIZE (2000)
>
> ...
> +
> +static inline unsigned int get_totalsize(struct microcode_header_intel *hdr)
> +{
> + return hdr->datasize ? : DEFAULT_UCODE_TOTALSIZE;

I tested this patch series and observed that the inline code above failed
the late microcode loading with the error message:

[ 117.100299] microcode: Error: bad microcode data file size.

According to the original get_totalsize() macro, seems like it should be:

return hdr->datasize ? hdr->totalsize : DEFAULT_UCODE_TOTALSIZE;

With this minor change, the late microcode loading was successful, and the
expected message was displayed:

...
[ 150.198654] microcode: Microcode revision: 0x80000400 -> 0x80000401

-Qiuxu

> +}
> ...