Re: [PATCH v2] x86/speculation/srbds: do not try to turn mitigation off when not supported

From: Ricardo Cañuelo
Date: Thu Mar 31 2022 - 09:18:54 EST


Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> writes:

Hi Pawan,

> void update_srbds_msr(void)
> {
> u64 mcu_ctrl;
>
> - if (!boot_cpu_has_bug(X86_BUG_SRBDS))
> - return;
> -
> - if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
> - return;
> -
> - if (srbds_mitigation == SRBDS_MITIGATION_UCODE_NEEDED)
> + if (!boot_cpu_has_bug(X86_BUG_SRBDS) ||
> + !boot_cpu_has(X86_FEATURE_SRBDS_CTRL))
> return;

Just to clarify, this changes the behavior wrt the hypervisor case:
currently it just bails out of update_srbds_msr(), with your patch it'd
clear RNGDS_MITG_DIS from MSR_IA32_MCU_OPT_CTRL. Is that what you
intended?

Ricardo