[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b0ccf68d-38e0-4522-8a54-974d5a711923@intel.com>
Date: Mon, 6 May 2024 15:30:59 +0800
From: "Yang, Weijiang" <weijiang.yang@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: <pbonzini@...hat.com>, <dave.hansen@...el.com>, <x86@...nel.org>,
<kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<peterz@...radead.org>, <chao.gao@...el.com>, <rick.p.edgecombe@...el.com>,
<mlevitsk@...hat.com>, <john.allen@....com>, Zhang Yi Z
<yi.z.zhang@...ux.intel.com>
Subject: Re: [PATCH v10 13/27] KVM: x86: Refresh CPUID on write to guest
MSR_IA32_XSS
On 5/2/2024 4:43 AM, Sean Christopherson wrote:
> On Sun, Feb 18, 2024, Yang Weijiang wrote:
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 9eb5c8dbd4fb..b502d68a2576 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -3926,16 +3926,23 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>> }
>> break;
>> case MSR_IA32_XSS:
>> - if (!msr_info->host_initiated &&
>> - !guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))
>> + /*
>> + * If KVM reported support of XSS MSR, even guest CPUID doesn't
>> + * support XSAVES, still allow userspace to set default value(0)
>> + * to this MSR.
>> + */
>> + if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVES) &&
>> + !(msr_info->host_initiated && data == 0))
> With my proposed MSR access cleanup[*], I think (hope?) this simply becomes:
>
> if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))
> return KVM_MSR_RET_UNSUPPORTED;
>
> with no comment needed as the "host && !data" case is handled in common code.
Right, I'll change this part after the cleanup series is merged. Thanks!
>
> [*] https://lore.kernel.org/all/20240425181422.3250947-1-seanjc@google.com
Powered by blists - more mailing lists