Re: [PATCH v11 3/6] x86/sev: Initialize RMPOPT configuration MSRs

Borislav Petkov <[email protected]> Wed, 29 Jul 2026 20:39:07 -0700
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <20260730033907.GFamrHW3v3dbb0UmFL@fat_crate.local>
On Thu, Jul 30, 2026 at 08:25:37AM +0530, K Prateek Nayak wrote:
> I believe there can be cases where CPUID advertises
> X86_FEATURE_SEGMENTED_RMP but rmf_cfg doesn't set
> MSR_AMD64_SEG_RMP_ENABLED because otherwise checking rmp_cfg in
> addition to the feature bit makes no sense.
> 
> In that case we should attempt a probe_contiguous_rmptable_info() even
> for X86_FEATURE_SEGMENTED_RMP.
> 
> Essentially drop that "else" and do something like:
> 
> bool snp_probe_rmptable_info(void)
> {
> 	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();
> 	}
> 
> 	/*
> 	 * Segmented RMP is either not supported on the platform or
> 	 * is disabled by the firmware. RMPOPT is not not supported
> 	 * without segmented RMP.
> 	 */
> 	setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
> 
> 	return probe_contiguous_rmptable_info();
> }

That makes sense.

Thx.

-- 
Regards/Gruss,
    Boris.

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