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

Re: [Xen-devel] [PATCH v12 2/8] xen: Add support for VMware cpuid leaves



On 07/01/15 16:01, Konrad Rzeszutek Wilk wrote:
>> diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
>> index ed2bd38..651b338 100644
>> --- a/tools/libxl/libxl_x86.c
>> +++ b/tools/libxl/libxl_x86.c
>> @@ -5,8 +5,8 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>>                                        libxl_domain_config *d_config,
>>                                        xc_domain_configuration_t *xc_config)
>>  {
>> -    /* No specific configuration right now */
>> -
>> +    /* Note: will be changed in a later patch */
> 
> One usually say which patch. Also missing '.'.

Ok, It is the next patch (tools: Add support for VMware cpuid leaves).
Will add the '.' and add a reference.  This change was requested even
though it is fully replaced in the next patch.

> 
>> +    xc_config->vmware_hwver = 0;
>>      return 0;
>>  }
>>  
> ... snip..
> 
>> diff --git a/xen/arch/x86/hvm/vmware/cpuid.c 
>> b/xen/arch/x86/hvm/vmware/cpuid.c
>> new file mode 100644
>> index 0000000..0dff36b
>> --- /dev/null
>> +++ b/xen/arch/x86/hvm/vmware/cpuid.c
>> @@ -0,0 +1,77 @@
>> +/*
>> + * arch/x86/hvm/vmware/cpuid.c
>> + *
>> + * Copyright (C) 2012 Verizon Corporation
> 
> s/2012/2015/ ?

The code here was written in 2012, 1st posted on xen-devel on Thu, 12
Dec 2013 14:15:11 -0500
([Xen-devel] [RFC PATCH 03/10] Add cpuid_vmware_leaves), and this same
code has been posted in 2014 and 2015.

So either no change or 2012-2015.  Which do you want?


>> + *
>> + * This file is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License Version 2 (GPLv2)
>> + * as published by the Free Software Foundation.
>> + *
>> + * This file is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * General Public License for more details. <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +#include <xen/sched.h>
>> +
>> +#include <asm/hvm/hvm.h>
>> +#include <asm/hvm/vmware.h>
>> +
>> +/*
>> + * VMware hardware version 7 defines some of these cpuid levels,
>> + * below is a brief description about those.
>> + *
>> + *     Leaf 0x40000000, Hypervisor CPUID information
>> + * # EAX: The maximum input value for hypervisor CPUID info (0x40000010).
>> + * # EBX, ECX, EDX: Hypervisor vendor ID signature. E.g. "VMwareVMware"
>> + *
>> + *     Leaf 0x40000010, Timing information.
>> + * # EAX: (Virtual) TSC frequency in kHz.
>> + * # EBX: (Virtual) Bus (local apic timer) frequency in kHz.
>> + * # ECX, EDX: RESERVED
>> + */
>> +
>> +int cpuid_vmware_leaves(uint32_t idx, uint32_t *eax, uint32_t *ebx,
>> +                        uint32_t *ecx, uint32_t *edx)
>> +{
>> +    struct domain *d = current->domain;
>> +
>> +    if ( !is_vmware_domain(d) ||
>> +         d->arch.hvm_domain.vmware_hwver < 7 )
>> +        return 0;
>> +
>> +    switch ( idx - 0x40000000 )
>> +    {
>> +    case 0x0:
>> +        *eax = 0x40000010;  /* Largest leaf */
>> +        *ebx = 0x61774d56;  /* "VMwa" */
>> +        *ecx = 0x4d566572;  /* "reVM" */
>> +        *edx = 0x65726177;  /* "ware" */
>> +        break;
>> +
>> +    case 0x10:
>> +        /* (Virtual) TSC frequency in kHz. */
>> +        *eax =  d->arch.tsc_khz;
>> +        /* (Virtual) Bus (local apic timer) frequency in kHz. */
>> +        *ebx = 1000000ull / APIC_BUS_CYCLE_NS;
>> +        *ecx = 0;          /* Reserved */
>> +        *edx = 0;          /* Reserved */
>> +        break;
>> +
>> +    default:
>> +        return 0;
>> +    }
>> +
>> +    return 1;
>> +}
>> +
>> +/*
>> + * Local variables:
>> + * mode: C
>> + * c-file-style: "BSD"
>> + * c-basic-offset: 4
>> + * tab-width: 4
>> + * indent-tabs-mode: nil
>> + * End:
>> + */
>> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
>> index ac62f20..129be1c 100644
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -750,8 +750,12 @@ int cpuid_hypervisor_leaves( uint32_t idx, uint32_t 
>> sub_idx,
>>                 uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
>>  {
>>      struct domain *currd = current->domain;
>> -    /* Optionally shift out of the way of Viridian architectural leaves. */
>> -    uint32_t base = is_viridian_domain(currd) ? 0x40000100 : 0x40000000;
>> +    /*
>> +     * Optionally shift out of the way of Viridian or VMware
>> +     * architectural leaves.
>> +     */
>> +    uint32_t base = is_viridian_domain(currd) || is_vmware_domain(currd) ?
>> +        0x40000100 : 0x40000000;
>>      uint32_t limit, dummy;
>>  
>>      idx -= base;
>> diff --git a/xen/include/asm-x86/hvm/domain.h 
>> b/xen/include/asm-x86/hvm/domain.h
>> index ad68fcf..ada8aaa 100644
>> --- a/xen/include/asm-x86/hvm/domain.h
>> +++ b/xen/include/asm-x86/hvm/domain.h
>> @@ -110,6 +110,9 @@ struct hvm_domain {
>>  
>>      uint64_t              *params;
>>  
>> +    /* emulated VMware Hardware Version */
>> +    uint64_t               vmware_hwver;
>> +
>>      /* Memory ranges with pinned cache attributes. */
>>      struct list_head       pinned_cacheattr_ranges;
>>  
>> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
>> index 57f9605..a074afe 100644
>> --- a/xen/include/asm-x86/hvm/hvm.h
>> +++ b/xen/include/asm-x86/hvm/hvm.h
>> @@ -356,6 +356,12 @@ static inline unsigned long 
>> hvm_get_shadow_gs_base(struct vcpu *v)
>>  #define has_viridian_time_ref_count(d) \
>>      (is_viridian_domain(d) && (viridian_feature_mask(d) & 
>> HVMPV_time_ref_count))
>>  
>> +#define vmware_feature_mask(d) \
>> +    ((d)->arch.hvm_domain.vmware_hwver)
>> +
>> +#define is_vmware_domain(d) \
>> +    (is_hvm_domain(d) && vmware_feature_mask(d))
>> +
>>  void hvm_hypervisor_cpuid_leaf(uint32_t sub_idx,
>>                                 uint32_t *eax, uint32_t *ebx,
>>                                 uint32_t *ecx, uint32_t *edx);
>> diff --git a/xen/include/asm-x86/hvm/vmware.h 
>> b/xen/include/asm-x86/hvm/vmware.h
>> new file mode 100644
>> index 0000000..8390173
>> --- /dev/null
>> +++ b/xen/include/asm-x86/hvm/vmware.h
>> @@ -0,0 +1,33 @@
>> +/*
>> + * asm-x86/hvm/vmware.h
>> + *
>> + * Copyright (C) 2012 Verizon Corporation
> 
> s/2012/2015

See above.

   -Don Slutz

>> + *
>> + * This file is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License Version 2 (GPLv2)
>> + * as published by the Free Software Foundation.
>> + *
>> + * This file is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * General Public License for more details. <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +#ifndef ASM_X86_HVM_VMWARE_H__
>> +#define ASM_X86_HVM_VMWARE_H__
>> +
>> +#include <xen/types.h>
>> +
>> +int cpuid_vmware_leaves(uint32_t idx, uint32_t *eax, uint32_t *ebx,
>> +                        uint32_t *ecx, uint32_t *edx);
>> +
>> +#endif /* ASM_X86_HVM_VMWARE_H__ */
>> +
>> +/*
>> + * Local variables:
>> + * mode: C
>> + * c-file-style: "BSD"
>> + * c-basic-offset: 4
>> + * indent-tabs-mode: nil
>> + * End:
>> + */
>> diff --git a/xen/include/public/arch-x86/xen.h 
>> b/xen/include/public/arch-x86/xen.h
>> index 2ecc9c9..f84d10d 100644
>> --- a/xen/include/public/arch-x86/xen.h
>> +++ b/xen/include/public/arch-x86/xen.h
>> @@ -268,7 +268,7 @@ typedef struct arch_shared_info arch_shared_info_t;
>>   * XEN_DOMCTL_INTERFACE_VERSION.
>>   */
>>  struct xen_arch_domainconfig {
>> -    char dummy;
>> +    uint64_t vmware_hwver;
>>  };
>>  #endif
>>  
>> -- 
>> 1.8.3.1
>>


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.