Re: [PATCH v4 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware
From: Borislav Petkov
Date: Mon Nov 02 2026 - 17:14:21 EST
On Mon, Nov 02, 2026 at 03:25:52PM -0600, Tom Lendacky wrote:
> The current code clears X86_FEATURE_RMPOPT when
> probe_segmented_rmptable_info() fails. The above code doesn't.
See the hunk in cpuid-deps.c
> But since SNP will be disabled on failure of snp_probe_rmptable_info(),
> I guess it doesn't matter. In which case you can eliminate the goto by
> doing:
>
> if (cpu_feature_enabled(X86_FEATURE_SEGMENTED_RMP)) {
> rdmsrq(MSR_AMD64_RMP_CFG, rmp_cfg);
> if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED)
> return probe_segmented_rmptable_info();
> }
>
> setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
> return probe_contiguous_rmptable_info();
>
> Which looks pretty clean.
Yap.
> > diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
> > index 99801e844b30..acbcec394ef1 100644
> > --- a/arch/x86/kernel/cpu/cpuid-deps.c
> > +++ b/arch/x86/kernel/cpu/cpuid-deps.c
> > @@ -93,6 +93,7 @@ static const struct cpuid_dep cpuid_deps[] = {
> > { X86_FEATURE_SPEC_CTRL_SSBD, X86_FEATURE_SPEC_CTRL },
> > { X86_FEATURE_LASS, X86_FEATURE_SMAP },
> > { X86_FEATURE_INVLPGB, X86_FEATURE_PCID },
> > + { X86_FEATURE_RMPOPT, X86_FEATURE_SEV_SNP },
This hunk.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette