Re: [PATCH] KVM: VMX: Check the corresponding bits according to the intel sdm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 23, 2021 at 10:37 AM <lihaiwei.kernel@xxxxxxxxx> wrote:
>
> From: Haiwei Li <lihaiwei@xxxxxxxxxxx>
>
> According to IA-32 SDM Vol.3D "A.1 BASIC VMX INFORMATION", two inspections
> are missing.
> * Bit 31 is always 0. Earlier versions of this manual specified that the
> VMCS revision identifier was a 32-bit field in bits 31:0 of this MSR. For
> all processors produced prior to this change, bit 31 of this MSR was read
> as 0.
> * The values of bits 47:45 and bits 63:57 are reserved and are read as 0.
>
> Signed-off-by: Haiwei Li <lihaiwei@xxxxxxxxxxx>
> ---
>  arch/x86/kvm/vmx/vmx.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 32cf828..0d6d13c 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -2577,6 +2577,20 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
>
>         rdmsr(MSR_IA32_VMX_BASIC, vmx_msr_low, vmx_msr_high);
>
> +       /*
> +        * IA-32 SDM Vol 3D: Bit 31 is always 0.
> +        * For all earlier processors, bit 31 of this MSR was read as 0.
> +        */
> +       if (vmx_msr_low & (1u<<31))
> +               return -EIO;

Drop this code as Jim said.

> +
> +       /*
> +        * IA-32 SDM Vol 3D: bits 47:45 and bits 63:57 are reserved and are read
> +        * as 0.
> +        */
> +       if (vmx_msr_high & 0xfe00e000)
> +               return -EIO;

Is this ok? Can we pick up the part? :)

--
Haiwei Li



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux