[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZD37c+/9l/nbvPnr@chao-env>
Date: Tue, 18 Apr 2023 10:07:47 +0800
From: Chao Gao <chao.gao@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
CC: <kvm@...r.kernel.org>, Jiaan Lu <jiaan.lu@...el.com>,
Zhang Chen <chen.zhang@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
"Paolo Bonzini" <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v2 04/11] KVM: VMX: Add IA32_SPEC_CTRL virtualization
support
On Mon, Apr 17, 2023 at 11:17:36AM +0800, Binbin Wu wrote:
>
>On 4/14/2023 2:25 PM, Chao Gao wrote:
>> From: Zhang Chen <chen.zhang@...el.com>
>>
>> Currently KVM disables interception of IA32_SPEC_CTRL after a non-0 is
>> written to IA32_SPEC_CTRL by guest. Then, guest is allowed to write any
>> value to hardware.
>>
>> "virtualize IA32_SPEC_CTRL" is a new tertiary vm-exec control. This
>> feature allows KVM to specify that certain bits of the IA32_SPEC_CTRL
>> MSR cannot be modified by guest software.
>>
>> Two VMCS fields are added:
>>
>> IA32_SPEC_CTRL_MASK: bits that guest software cannot modify
>> IA32_SPEC_CTRL_SHADOW: value that guest software expects to be in the
>> IA32_SPEC_CTRL MSR
>>
>> On rdmsr, the shadow value is returned. on wrmsr, EDX:EAX is written
>> to the IA32_SPEC_CTRL_SHADOW and (cur_val & mask) | (EDX:EAX & ~mask)
>> is written to the IA32_SPEC_CTRL MSR, where
>> * cur_val is the original value of IA32_SPEC_CTRL MSR
>> * mask is the value of IA32_SPEC_CTRL_MASK
>>
>> Add a mask e.g.,
>
>e.g. or i.e. ?
Yes, here should be "i.e.".
>> +static inline void vmx_set_guest_spec_ctrl(struct vcpu_vmx *vmx, u64 val)
>> +{
>> + vmx->guest_spec_ctrl = val;
>> +
>> + /*
>> + * For simplicity, always keep IA32_SPEC_CTRL_SHADOW up-to-date,
>> + * regardless of the MSR intercept state.
>
>It is better to use "IA32_SPEC_CTRL" explicitly instead of "the MSR" to
>avoid misunderstand.
Agreed. Will do.
Powered by blists - more mailing lists