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

From: Borislav Petkov

Date: Wed Jul 29 2026 - 22:13:07 EST


On Mon, Jul 27, 2026 at 07:04:57PM +0000, Ashish Kalra wrote:
> @@ -705,10 +760,12 @@ 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)
> + if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED) {
> return probe_segmented_rmptable_info();
> - else
> + } else {
> + setup_clear_cpu_cap(X86_FEATURE_RMPOPT);

That looks a bit squirreled away in a probing function. Let's make that a bit
more obvious:

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();
} else {
/* RMPOPT is supported only with a segmented RMP table. */
setup_clear_cpu_cap(X86_FEATURE_RMPOPT);

return probe_contiguous_rmptable_info();
}
}

> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index ca473ca198b8..c002a7ca26a8 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1477,6 +1477,9 @@ static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
> }
>
> snp_hv_fixed_pages_state_update(sev, HV_FIXED);
> +
> + snp_setup_rmpopt();

Why is this thing here and not at the end?

SEV-TIO is supposed to always run last or it doesn't matter?

Thx.

--
Regards/Gruss,
Boris.

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