Re: [PATCH v4 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware

From: Borislav Petkov

Date: Mon Nov 02 2026 - 11:56:32 EST


On Mon, Nov 02, 2026 at 08:12:16AM -0600, Tom Lendacky wrote:
> Heh, I don't think that is a nit, it is broken.
>
> I think the code as it was read fine, but that's just my opinion.

Lemme see if you like this more (pasting it in applied form because the diff
is unreadable):

bool snp_probe_rmptable_info(void)
{
if (!cpu_feature_enabled(X86_FEATURE_SEGMENTED_RMP))
goto out;

rdmsrq(MSR_AMD64_RMP_CFG, rmp_cfg);
if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED) {
if (probe_segmented_rmptable_info())
return true;
}

out:
setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
return probe_contiguous_rmptable_info();
}

No repeated code, no if-else conditionals, just what needs to happen.

Thx.

--
Regards/Gruss,
Boris.

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