Re: [PATCH v3 06/35] x86/bugs: Restructure mmio mitigation

From: Brendan Jackman
Date: Mon Feb 10 2025 - 11:42:41 EST


On Wed, 8 Jan 2025 at 21:27, David Kaplan <david.kaplan@xxxxxxx> wrote:
> +static void __init mmio_apply_mitigation(void)
> +{
> if (mmio_mitigation == MMIO_MITIGATION_OFF)
> return;

> /*
> * Enable CPU buffer clear mitigation for host and VMM, if also affected
> * by MDS or TAA. Otherwise, enable mitigation for VMM only.
> */
> if (boot_cpu_has_bug(X86_BUG_MDS) || (boot_cpu_has_bug(X86_BUG_TAA) &&
> boot_cpu_has(X86_FEATURE_RTM)))
> setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);

This is still peeking at other mitigations in _apply_mitigation.
Shouldn't we shunt that logic into _update_mitigation?

I guess this would need a new enum value but that doesn't seem too
bad. Worth it to have all the inter-mitigation dependencies localised
into *_udpate_mitigation IMO.