Re: [PATCH v13 03/21] KVM: x86: Refresh CPUID on write to guest MSR_IA32_XSS
From: Chao Gao
Date: Fri Aug 29 2025 - 06:41:05 EST
On Fri, Aug 29, 2025 at 02:47:37PM +0800, Xiaoyao Li wrote:
>On 8/21/2025 9:30 PM, Chao Gao wrote:
>> From: Yang Weijiang <weijiang.yang@xxxxxxxxx>
>>
>> Update CPUID.(EAX=0DH,ECX=1).EBX to reflect current required xstate size
>> due to XSS MSR modification.
>> CPUID(EAX=0DH,ECX=1).EBX reports the required storage size of all enabled
>> xstate features in (XCR0 | IA32_XSS). The CPUID value can be used by guest
>> before allocate sufficient xsave buffer.
>>
>> Note, KVM does not yet support any XSS based features, i.e. supported_xss
>> is guaranteed to be zero at this time.
>>
>> Opportunistically return KVM_MSR_RET_UNSUPPORTED if guest CPUID doesn't
>> enumerate it. Since KVM_MSR_RET_UNSUPPORTED takes care of host_initiated
>> cases, drop the host_initiated check.
>
>It looks most of this patch is introducing
>
> vcpu->arch.guest_supported_xss
>
>and use it to guard the wrmsr of MSR_IA32_XSS instead of KVM global
>kvm_caps.supported_xss.
>
>So it's better to split it into two patches?
Yes. it makes sense. will do.