Re: [PATCH v3 8/9] KVM: nSVM: Advertise DecodeAssists to L1

Tina Zhang <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.kvm
Message-ID <[email protected]>

On 7/30/2026 8:33 PM, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Missing VENDOR_F(DECODEASSISTS) initialization in CPUID 0x8000000A leaf definition.
> --
> 
> --- Patch [8]: [PATCH v3 8/9] KVM: nSVM: Advertise DecodeAssists to L1 ---
> commit 2694559bd05c1133d7f21075f9c95dc19418651a
> Author: Tina Zhang <[email protected]>
> 
> KVM: nSVM: Advertise DecodeAssists to L1
> 
> This patch advertises DecodeAssists to L1 guests by checking and setting
> the X86_FEATURE_DECODEASSISTS capability when supported by hardware. This
> enables QEMU configurations that enforce the decodeassists feature.
> 
>> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
>> index 6e2ceb700567c..4e01a6ede4246 100644
>> --- a/arch/x86/kvm/svm/svm.c
>> +++ b/arch/x86/kvm/svm/svm.c
>> @@ -5588,6 +5588,8 @@ static __init void svm_set_cpu_caps(void)
>>   		 */
>>   		kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
>>   
>> +		kvm_cpu_cap_check_and_set(X86_FEATURE_DECODEASSISTS);
> 
> [Severity: Low]
> Does this feature also need to be initialized in arch/x86/kvm/cpuid.c?
> 
> Currently, kvm_cpu_cap_check_and_set() is used here to enable it, but
> VENDOR_F(DECODEASSISTS) appears to be missing from the CPUID_8000_000A_EDX
> capabilities array in cpuid.c:
> 
> arch/x86/kvm/cpuid.c:kvm_cpu_cap_init() {
>      /* All SVM features required additional vendor module enabling. */
>      kvm_cpu_cap_init(CPUID_8000_000A_EDX,
>          VENDOR_F(NPT),
>          VENDOR_F(VMCBCLEAN),
>          ...
> }
> 
> Without VENDOR_F(DECODEASSISTS), this skips KVM's standard compile-time
> validation and raw CPUID masking logic. Should it be added to the vendor
> feature list as well?

Yes, DecodeAssists should also be declared with VENDOR_F(DECODEASSISTS).
I'll add it in the next version.

Thanks,
Tina
> 
>> +
>>   		if (nrips)
>>   			kvm_cpu_cap_set(X86_FEATURE_NRIPS);
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.