Re: [PATCH 2/2] x86/microcode: Rework early revisions reporting

Ashok Raj
2023-12-01T21:32:51Z

On Fri, Dec 01, 2023 at 09:41:46PM +0100, Borislav Petkov wrote:
> On Fri, Dec 01, 2023 at 12:33:34PM -0800, Ashok Raj wrote:
> > I'll get a dmesg shortly once i get my test system back.
>
> Thanks.
>

dmesg for the microcode part here below:

https://paste.debian.net/hidden/e911dffc/

> > What I meant was
>
> I know what you meant. Did you see the diff I sent you?
>
> It has the fix already:
>
> @@ -410,13 +421,19 @@ void __init load_ucode_intel_bsp(struct early_load_data *ed)
> {
> struct ucode_cpu_info uci;
>
> - ed->old_rev = intel_get_microcode_revision();
> -
> uci.mc = get_microcode_blob(&uci, false);
> - if (uci.mc && apply_microcode_early(&uci) == UCODE_UPDATED)
> + ed->old_rev = uci.cpu_sig.rev;
> +
> + uc_dbg("old_rev: 0x%x", ed->old_rev);
> +
> + if (uci.mc && apply_microcode_early(&uci) == UCODE_UPDATED) {
> ucode_patch_va = UCODE_BSP_LOADED;
> + ed->new_rev = uci.cpu_sig.rev;
> +
> + uc_dbg("updated, new_rev: 0x%x", ed->new_rev);
> + }
> ^^^^^^^^^^^^^
>
> The assignment is now inside the UCODE_UPDATED conditional.

The first patch I tried was exactly this, but assumed having the fix in
core.c would help both AMD/Intel.

Assuming if the same loaded patch was also present in initrd,

load_ucode_amd_bsp()
early_apply_microcode()
__apply_microcode_amd()

old_rev will still be non-zero.