qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] cleanup hyper-v interface initialization


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/3] cleanup hyper-v interface initialization
Date: Tue, 21 Jan 2014 11:14:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 21/01/2014 09:02, Vadim Rozenfeld ha scritto:
> Signed-off-by: Vadim Rozenfeld <address@hidden>
> ---
>  target-i386/kvm.c | 46 +++++++++++++++++-----------------------------
>  1 file changed, 17 insertions(+), 29 deletions(-)

Please split this part into multiple parts and document each in the
commit message.

Also please cite relevant parts of the MS document in the commit messages.

Paolo

> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 7522e98..768ca1d 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -71,6 +71,8 @@ static bool has_msr_pv_eoi_en;
>  static bool has_msr_misc_enable;
>  static bool has_msr_kvm_steal_time;
>  static int lm_capable_kernel;
> +static bool has_msr_hv_hypercall;
> +static bool has_msr_hv_vapic;
>  
>  static bool has_msr_architectural_pmu;
>  static uint32_t num_architectural_pmu_counters;
> @@ -463,13 +465,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
>      /* Paravirtualization CPUIDs */
>      c = &cpuid_data.entries[cpuid_i++];
>      c->function = KVM_CPUID_SIGNATURE;
> -    if (!hyperv_enabled(cpu)) {
> -        memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> -        c->eax = 0;
> -    } else {
> -        memcpy(signature, "Microsoft Hv", 12);
> -        c->eax = HYPERV_CPUID_MIN;
> -    }
> +    memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>      c->ebx = signature[0];
>      c->ecx = signature[1];
>      c->edx = signature[2];
> @@ -478,23 +474,23 @@ int kvm_arch_init_vcpu(CPUState *cs)
>      c->function = KVM_CPUID_FEATURES;
>      c->eax = env->features[FEAT_KVM];
>  
> -    if (hyperv_enabled(cpu)) {
> +    if (hyperv_enabled(cpu) &&
> +        kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV) > 0) {
> +        has_msr_hv_hypercall = true;
> +
>          memcpy(signature, "Hv#1\0\0\0\0\0\0\0\0", 12);
>          c->eax = signature[0];
>  
>          c = &cpuid_data.entries[cpuid_i++];
> -        c->function = HYPERV_CPUID_VERSION;
> -        c->eax = 0x00001bbc;
> -        c->ebx = 0x00060001;
> -
> -        c = &cpuid_data.entries[cpuid_i++];
>          c->function = HYPERV_CPUID_FEATURES;
>          if (cpu->hyperv_relaxed_timing) {
>              c->eax |= HV_X64_MSR_HYPERCALL_AVAILABLE;
>          }
> -        if (cpu->hyperv_vapic) {
> +        if (cpu->hyperv_vapic &&
> +            kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_VAPIC) > 0) {
>              c->eax |= HV_X64_MSR_HYPERCALL_AVAILABLE;
>              c->eax |= HV_X64_MSR_APIC_ACCESS_AVAILABLE;
> +            has_msr_hv_vapic = true;
>          }
>  
>          c = &cpuid_data.entries[cpuid_i++];
> @@ -502,23 +498,15 @@ int kvm_arch_init_vcpu(CPUState *cs)
>          if (cpu->hyperv_relaxed_timing) {
>              c->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED;
>          }
> -        if (cpu->hyperv_vapic) {
> +        if (has_msr_hv_vapic) {
>              c->eax |= HV_X64_APIC_ACCESS_RECOMMENDED;
>          }
> -        c->ebx = cpu->hyperv_spinlock_attempts;
> -
> -        c = &cpuid_data.entries[cpuid_i++];
> -        c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
> -        c->eax = 0x40;
> -        c->ebx = 0x40;
> -
> -        c = &cpuid_data.entries[cpuid_i++];
> -        c->function = KVM_CPUID_SIGNATURE_NEXT;
> -        memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> -        c->eax = 0;
> -        c->ebx = signature[0];
> -        c->ecx = signature[1];
> -        c->edx = signature[2];
> +        if (cpu->hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY &&
> +            kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_SPIN) > 0) {
> +            c->ebx = cpu->hyperv_spinlock_attempts;
> +        } else {
> +            c->ebx = HYPERV_SPINLOCK_NEVER_RETRY;
> +        }
>      }
>  
>      has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]