Re: [Xen-devel] [PATCH v2 7/8] x86/vvmx: correctly report vvmcs size

2018-11-13 Thread Tian, Kevin
> From: Sergey Dyasli [mailto:sergey.dya...@citrix.com]
> Sent: Tuesday, November 6, 2018 8:08 PM
> 
> The size of Xen's virtual vmcs region is 4096 bytes (see comment about
> Virtual VMCS layout in include/asm-x86/hvm/vmx/vvmx.h). Correctly
> report
> it to the guest in case when VMCS shadowing is not available instead of
> providing H/W value (which is usually smaller).
> 
> Signed-off-by: Sergey Dyasli 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v2 7/8] x86/vvmx: correctly report vvmcs size

2018-11-09 Thread Wei Liu
On Thu, Nov 08, 2018 at 10:28:24AM +, Sergey Dyasli wrote:
> On 07/11/2018 13:28, Wei Liu wrote:
> > On Tue, Nov 06, 2018 at 12:07:58PM +, Sergey Dyasli wrote:
> >> The size of Xen's virtual vmcs region is 4096 bytes (see comment about
> >> Virtual VMCS layout in include/asm-x86/hvm/vmx/vvmx.h). Correctly report
> >> it to the guest in case when VMCS shadowing is not available instead of
> >> providing H/W value (which is usually smaller).
> >>
> >> Signed-off-by: Sergey Dyasli 
> >> ---
> >> v2:
> >> - slight commit message change
> >> ---
> >>  xen/arch/x86/hvm/vmx/vvmx.c | 8 
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
> >> index 2f5370ceed..37d3cdd859 100644
> >> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> >> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> >> @@ -2101,6 +2101,14 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 
> >> *msr_content)
> >>  data = (host_data & (~0ul << 32)) |
> >> (vmcs->vmcs_revision_id & 0x7fff);
> >>  unmap_domain_page(vmcs);
> >> +
> >> +if ( !cpu_has_vmx_vmcs_shadowing )
> >> +{
> >> +/* Report vmcs_region_size as 4096 */
> >> +data &= ~VMX_BASIC_VMCS_SIZE_MASK;
> >> +data |= 1ULL << 44;
> > 
> > Can you introduce a define for this to avoid using a magic number?
> 
> I don't see much point in making a define for several reasons:
> 
> 1. It's not going to be used anywhere else
> 
> 2. Intel SDM clearly states that VMCS size is "at most 4096 (bit 44
>is set if and only if bits 43:32 are clear)"
> 
> 3. My VMX MSRs series will introduce a nice struct, after which this
>assignment will look like "basic.vmcs_region_size = 4096;"
> 

Fair enough. I have no objection anymore.

Wei.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v2 7/8] x86/vvmx: correctly report vvmcs size

2018-11-08 Thread Sergey Dyasli
On 07/11/2018 13:28, Wei Liu wrote:
> On Tue, Nov 06, 2018 at 12:07:58PM +, Sergey Dyasli wrote:
>> The size of Xen's virtual vmcs region is 4096 bytes (see comment about
>> Virtual VMCS layout in include/asm-x86/hvm/vmx/vvmx.h). Correctly report
>> it to the guest in case when VMCS shadowing is not available instead of
>> providing H/W value (which is usually smaller).
>>
>> Signed-off-by: Sergey Dyasli 
>> ---
>> v2:
>> - slight commit message change
>> ---
>>  xen/arch/x86/hvm/vmx/vvmx.c | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
>> index 2f5370ceed..37d3cdd859 100644
>> --- a/xen/arch/x86/hvm/vmx/vvmx.c
>> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
>> @@ -2101,6 +2101,14 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 
>> *msr_content)
>>  data = (host_data & (~0ul << 32)) |
>> (vmcs->vmcs_revision_id & 0x7fff);
>>  unmap_domain_page(vmcs);
>> +
>> +if ( !cpu_has_vmx_vmcs_shadowing )
>> +{
>> +/* Report vmcs_region_size as 4096 */
>> +data &= ~VMX_BASIC_VMCS_SIZE_MASK;
>> +data |= 1ULL << 44;
> 
> Can you introduce a define for this to avoid using a magic number?

I don't see much point in making a define for several reasons:

1. It's not going to be used anywhere else

2. Intel SDM clearly states that VMCS size is "at most 4096 (bit 44
   is set if and only if bits 43:32 are clear)"

3. My VMX MSRs series will introduce a nice struct, after which this
   assignment will look like "basic.vmcs_region_size = 4096;"

--
Thanks,
Sergey

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v2 7/8] x86/vvmx: correctly report vvmcs size

2018-11-07 Thread Wei Liu
On Tue, Nov 06, 2018 at 12:07:58PM +, Sergey Dyasli wrote:
> The size of Xen's virtual vmcs region is 4096 bytes (see comment about
> Virtual VMCS layout in include/asm-x86/hvm/vmx/vvmx.h). Correctly report
> it to the guest in case when VMCS shadowing is not available instead of
> providing H/W value (which is usually smaller).
> 
> Signed-off-by: Sergey Dyasli 
> ---
> v2:
> - slight commit message change
> ---
>  xen/arch/x86/hvm/vmx/vvmx.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
> index 2f5370ceed..37d3cdd859 100644
> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> @@ -2101,6 +2101,14 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 
> *msr_content)
>  data = (host_data & (~0ul << 32)) |
> (vmcs->vmcs_revision_id & 0x7fff);
>  unmap_domain_page(vmcs);
> +
> +if ( !cpu_has_vmx_vmcs_shadowing )
> +{
> +/* Report vmcs_region_size as 4096 */
> +data &= ~VMX_BASIC_VMCS_SIZE_MASK;
> +data |= 1ULL << 44;

Can you introduce a define for this to avoid using a magic number?

Wei.

> +}
> +
>  break;
>  }
>  case MSR_IA32_VMX_PINBASED_CTLS:
> -- 
> 2.17.1
> 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel