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

From: Kalra, Ashish

Date: Mon Nov 02 2026 - 14:13:50 EST


Hello Boris,

On 11/2/2026 8:48 AM, Borislav Petkov wrote:
> 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.

The original patch returns false if segmented RMP is enabled but
probe_segmented_rmptable_info() fails, your version falls through to
probe_contiguous_rmptable_info() instead.

I believe it makes sense to keep the return false there: on a
segmented RMP enabled platform the RMP is segmented, not contiguous, so the
contiguous probe shouldn't run.

That's why i think the original patch looks fine to me.

Thanks,
Ashish

>
> Thx.
>