Re: [PATCH v10 2/6] x86/sev: Initialize RMPOPT configuration MSRs

From: Borislav Petkov

Date: Mon Jul 20 2026 - 21:50:02 EST


On Mon, Jul 20, 2026 at 05:38:05PM -0500, Kalra, Ashish wrote:
> Agreed on dropping the bool — I'll derive it in a local helper.
>
> One issue though: rmp_segment_table != NULL isn't segmented-only. setup_contiguous_rmptable() also allocates rmp_segment_table
> (the contiguous RMP is stored as a single segment in the same table), so it's non-NULL for the contiguous case too.
>
> To keep it segmented-only, I'll also need to gate on the segmented-RMP mode, something like:
>
> static bool rmpopt_capable(void)
> {
> return cpu_feature_enabled(X86_FEATURE_RMPOPT) &&
> cc_platform_has(CC_ATTR_HOST_SEV_SNP) &&
> (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED) &&
> rmp_segment_table;
> }
>
> The CC_ATTR_HOST_SEV_SNP check also handles SNP being disabled at runtime, so snp_clear_rmpopt_capable() and its caller go away as well.

Ok, you can simply do:

setup_clear_cpu_cap(X86_FEATURE_RMPOPT)

and clear our internal representation of RMPOPT support and make it a lot
simpler.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette