Re: [PATCH v4 1/2] x86/sev: Clear RMPOPT when segmented RMP is disabled by firmware
From: Kalra, Ashish
Date: Tue Nov 03 2026 - 09:51:44 EST
On 11/2/2026 8:58 PM, K Prateek Nayak wrote:
> On 11/3/2026 6:15 AM, Borislav Petkov wrote:
>> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
>> index bd70c4d0b774..417e6a41ac60 100644
>> --- a/arch/x86/virt/svm/sev.c
>> +++ b/arch/x86/virt/svm/sev.c
>> @@ -669,10 +669,10 @@ void snp_enable_rmpopt(void)
>> u64 base;
>> int cpu;
>>
>> - if (!cpu_feature_enabled(X86_FEATURE_RMPOPT))
>> + if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
>> return;
>
> nit. We should check CC_ATTR_HOST_SEV_SNP in rmpopt_init() too
> now to prevent an unnecessary workqueue allocation if
> probe_segmented_rmptable_info() failed early.
As rmpopt_init() is now called from snp_rmptable_init() (in patch 2/2), and there is
already a CC_ATTR_HOST_SEV_SNP check in snp_rmptable_init(), there should be no need
to check this in rmpopt_init().
Thanks,
Ashish
>
> Since it doesn't change anything functionally, maybe Ashish
> can do it as a part of his mutil-node optimization series.
>
>>
>> - if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
>> + if (!cpu_feature_enabled(X86_FEATURE_RMPOPT))
>> return;
>>
>> if (!rmpopt_soft_init)
>