lkml.org 
[lkml]   [2023]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH v2 04/11] KVM: VMX: Add IA32_SPEC_CTRL virtualization support
From
On 4/14/2023 2:25 PM, Chao Gao wrote:

...

> +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.
> + */
> + if (cpu_has_spec_ctrl_virt())
> + vmcs_write64(IA32_SPEC_CTRL_SHADOW, val);
> +
> + /*
> + * Update the effective value of IA32_SPEC_CTRL to reflect changes to
> + * guest's IA32_SPEC_CTRL. Bits in the mask should always be set.
> + */

Why bits in the mask should always be set?

The bits set in the mask only means them cannot be modified by guest.
KVM can use the mask to force the bits to 0 as well.

> + vmx->spec_ctrl = val | vmx_get_spec_ctrl_mask(vmx);
> +}
> #endif /* __KVM_X86_VMX_H */

\
 
 \ /
  Last update: 2023-05-16 09:18    [W:0.343 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site