Re: [RFC PATCH v3 09/10] x86/cpu: Call ENCLS[EUPDATESVN] procedure in microcode update

Borislav Petkov
2022-04-01T14:34:48Z

On Fri, Apr 01, 2022 at 10:24:08PM +0800, Cathy Zhang wrote:
> @@ -2086,6 +2087,14 @@ void microcode_check(void)
>
> perf_check_microcode();
>
> + /*
> + * SGX related microcode update requires EUPDATESVN to update CPUSVN, which
> + * will destroy all enclaves to ensure EPC is not in use. If SGX is configured
> + * and EUPDATESVN is supported, call the EUPDATESVN procecure.
> + */
> + if (IS_ENABLED(CONFIG_X86_SGX) && (cpuid_eax(SGX_CPUID) & SGX_CPUID_EUPDATESVN))

Stick all that above...

> + update_cpusvn_intel();

...inside this function so that you have only the call here. Inside the
function you can do all the ifdeffery, checking and commenting and so
on. Just like perf_check_microcode() does.

Thx.

--
Regards/Gruss,
Boris.