All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [XTF PATCH 03/16] vvmx: test whether MSR_IA32_VMX_BASIC is set correctly
Date: Fri, 16 Dec 2016 17:19:36 +0000	[thread overview]
Message-ID: <9a2b1a26-62d6-1788-3e16-9054d36061b5@citrix.com> (raw)
In-Reply-To: <20161216134348.16236-4-haozhong.zhang@intel.com>

On 16/12/16 13:43, Haozhong Zhang wrote:
> It tests whether bit 31 and bit 48 are 0, and VMCS size is in the
> range (0, 4096].
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> ---
>  include/arch/x86/msr-index.h |  4 ++++
>  tests/vvmx/msr.c             | 47 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>
> diff --git a/include/arch/x86/msr-index.h b/include/arch/x86/msr-index.h
> index f9867d5..b7aeef0 100644
> --- a/include/arch/x86/msr-index.h
> +++ b/include/arch/x86/msr-index.h
> @@ -16,6 +16,10 @@
>  #define _MSR_MISC_FEATURES_CPUID_FAULTING        0
>  #define MSR_MISC_FEATURES_CPUID_FAULTING         (1ULL << _MSR_MISC_FEATURES_CPUID_FAULTING)
>  
> +#define MSR_IA32_VMX_BASIC              0x00000480
> +#define VMX_BASIC_VMCS_SIZE_MASK        (0x1fffULL << 32)
> +#define VMX_BASIC_32BIT_ADDRESSES       (1ULL << 48)
> +
>  #define MSR_EFER                        0xc0000080 /* Extended Feature register. */
>  #define _EFER_SCE                       0  /* SYSCALL Enable. */
>  #define EFER_SCE                        (_AC(1, L) << _EFER_SCE)
> diff --git a/tests/vvmx/msr.c b/tests/vvmx/msr.c
> index 100491d..ad01f26 100644
> --- a/tests/vvmx/msr.c
> +++ b/tests/vvmx/msr.c
> @@ -48,11 +48,58 @@ static bool test_msr_feature_control(void)
>      return passed;
>  }
>  
> +static bool test_msr_vmx_basic(void)
> +{
> +    bool passed = true;
> +    uint64_t vmx_basic;
> +    uint64_t vmcs_size;
> +
> +    if ( rdmsr_safe(MSR_IA32_VMX_BASIC, &vmx_basic) )
> +    {
> +        xtf_failure("Fail: fault when rdmsr MSR_IA32_VMX_BASIC\n");
> +        passed = false;
> +        goto out;
> +    }
> +
> +    if ( vmx_basic & (1ULL << 31) )
> +    {
> +        xtf_failure("Fail: MSR_IA32_VMX_BASIC[31] is not 0\n");

Out of interest, what is the reason for requiring this bit to be 0?  I
can see that the manual insists that it is, but not why.

> +        passed = false;
> +    }
> +
> +    vmcs_size = (vmx_basic & VMX_BASIC_VMCS_SIZE_MASK) >> 32;
> +    if ( vmcs_size > PAGE_SIZE )
> +    {
> +        xtf_failure("Fail: "
> +                    "VMCS size (%"PRIu64") in MSR_IA32_VMX_BASIC is > %ld\n",
> +                    vmcs_size, PAGE_SIZE);
> +        passed = false;
> +    }
> +    else if ( vmcs_size == 0 )
> +    {
> +        xtf_failure("Fail: VMCS size in MSR_IA32_VMX_BASIC cannot be 0\n");
> +        passed = false;
> +    }
> +
> +    /* test is running on hvm64, so this bit should be 0 */
> +    if ( vmx_basic & VMX_BASIC_32BIT_ADDRESSES )

There is nothing in principle wrong with Xen setting this bit.  It would
be odd certainly, but not erroneous.

~Andrew

> +    {
> +        xtf_failure("Fail: MSR_IA32_VMX_BASIC[48] is not 0\n");
> +        passed = false;
> +    }
> +
> +out:
> +    return passed;
> +}
> +
>  bool test_msr_vmx(void)
>  {
>      if ( !test_msr_feature_control() )
>          return false;
>  
> +    if ( !test_msr_vmx_basic() )
> +        return false;
> +
>      return true;
>  }
>  


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-12-16 17:19 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 13:43 [XTF PATCH 00/16] Add test cases for nested vmxon Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 01/16] vvmx: test whether VMX feature is present in CPUID Haozhong Zhang
2016-12-16 14:40   ` Andrew Cooper
2016-12-19  1:51     ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 02/16] vvmx: test whether MSR_IA32_FEATURE_CONTROL is set correctly Haozhong Zhang
2016-12-16 16:17   ` Andrew Cooper
2016-12-19  2:20     ` Haozhong Zhang
2016-12-19 15:29       ` Andrew Cooper
2016-12-16 13:43 ` [XTF PATCH 03/16] vvmx: test whether MSR_IA32_VMX_BASIC " Haozhong Zhang
2016-12-16 17:19   ` Andrew Cooper [this message]
2016-12-19  2:44     ` Haozhong Zhang
2016-12-19 15:41       ` Andrew Cooper
2016-12-20  2:45         ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 04/16] vvmx: add C wrappers of vmxon/vmread/vmptrld Haozhong Zhang
2016-12-16 19:03   ` [licensing] was: " Andrew Cooper
2016-12-19  3:20     ` Haozhong Zhang
2016-12-19 14:41       ` Lars Kurth
2016-12-19 15:51         ` Ian Jackson
2016-12-19 15:58       ` Andrew Cooper
2016-12-19 15:20     ` Roger Pau Monné
2016-12-19 15:24       ` Andrew Cooper
2016-12-16 19:47   ` Andrew Cooper
2016-12-19  3:00     ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 05/16] vvmx: add a general error handler for VMX instructions Haozhong Zhang
2016-12-16 20:16   ` Andrew Cooper
2016-12-19  3:24     ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 06/16] vvmx: test vmxon with CR4.VMXE cleared Haozhong Zhang
2016-12-16 20:25   ` Andrew Cooper
2016-12-19  3:26     ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 07/16] vvmx: test vmxon in CPL=3 and out of VMX operation Haozhong Zhang
2016-12-16 20:33   ` Andrew Cooper
2016-12-19  3:35     ` Haozhong Zhang
2016-12-19 16:02       ` Andrew Cooper
2016-12-19 16:02       ` Andrew Cooper
2016-12-16 13:43 ` [XTF PATCH 08/16] vvmx: test vmxon with invalidly wide VMXON region address Haozhong Zhang
2016-12-16 20:40   ` Andrew Cooper
2016-12-19  3:36     ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 09/16] vvmx: test vmxon with unaligned " Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 10/16] vvmx: test vmxon with mismatched VMCS revision ID Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 11/16] vvmx: test vmxon with bit 31 of VMCS revision ID set Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 12/16] vvmx: test the correct vmxon Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 13/16] vvmx: test vmxon in VMX root w/ CPL = 0 and w/o current VMCS Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 14/16] vvmx: test vmxon in VMX root w/ CPL = 3 " Haozhong Zhang
2016-12-16 20:59   ` Andrew Cooper
2016-12-19  3:46     ` Haozhong Zhang
2016-12-19 16:07       ` Andrew Cooper
2016-12-20  2:50         ` Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 15/16] vvmx: test vmxon in VMX root w/ CPL = 0 and w/ " Haozhong Zhang
2016-12-16 13:43 ` [XTF PATCH 16/16] vvmx: test vmxon in VMX root w/ CPL = 3 " Haozhong Zhang
2016-12-16 14:12 ` [XTF PATCH 00/16] Add test cases for nested vmxon Andrew Cooper
2016-12-19  1:44   ` Haozhong Zhang
2016-12-19 16:18     ` Andrew Cooper
2016-12-16 21:26 ` Andrew Cooper
2016-12-19  5:31   ` Haozhong Zhang
2016-12-19 16:34     ` Andrew Cooper
2016-12-20  2:32       ` Haozhong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a2b1a26-62d6-1788-3e16-9054d36061b5@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=haozhong.zhang@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.