From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6Osd-0000aG-09 for qemu-devel@nongnu.org; Thu, 23 Jan 2014 13:20:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6OsV-0006Mk-D7 for qemu-devel@nongnu.org; Thu, 23 Jan 2014 13:19:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6OsV-0006Ma-3q for qemu-devel@nongnu.org; Thu, 23 Jan 2014 13:19:47 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0NIJj0A029889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 Jan 2014 13:19:46 -0500 Message-ID: <52E15D3E.8020707@redhat.com> Date: Thu, 23 Jan 2014 19:19:42 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1390484449-20974-1-git-send-email-vrozenfe@redhat.com> <1390484449-20974-6-git-send-email-vrozenfe@redhat.com> In-Reply-To: <1390484449-20974-6-git-send-email-vrozenfe@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 5/7] make hyperv hypercall and guest os id MSRs migratable. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vadim Rozenfeld , qemu-devel@nongnu.org Cc: mtosatti@redhat.com Il 23/01/2014 14:40, Vadim Rozenfeld ha scritto: > + if (hyperv_enabled(cpu) && > + kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV) > 0) { > c->eax = HYPERV_CPUID_MIN; > + has_msr_hv_hypercall = true; The commit message should mention that this is done because the MS docs specify HV_X64_MSR_HYPERCALL as a mandatory interface, thus we cannot separate relaxed timing (say)---even though in principle it doesn't require the MSR. We probably should split this part of the patch as follows: diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 0a21c30..19b1c94 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -72,6 +72,7 @@ static bool has_msr_misc_enable; static bool has_msr_bndcfgs; static bool has_msr_kvm_steal_time; static int lm_capable_kernel; +static bool has_msr_hv_hypercall; static bool has_msr_architectural_pmu; static uint32_t num_architectural_pmu_counters; @@ -437,8 +438,9 @@ static bool hyperv_hypercall_available(X86CPU *cpu) static bool hyperv_enabled(X86CPU *cpu) { - return hyperv_hypercall_available(cpu) || - cpu->hyperv_relaxed_timing; + return kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV) > 0 && + (hyperv_hypercall_available(cpu) || + cpu->hyperv_relaxed_timing); } #define KVM_MAX_CPUID_ENTRIES 100 @@ -470,6 +472,7 @@ int kvm_arch_init_vcpu(CPUState *cs) } else { memcpy(signature, "Microsoft Hv", 12); c->eax = HYPERV_CPUID_MIN; + has_msr_hv_hypercall = true; } c->ebx = signature[0]; c->ecx = signature[1]; @@ -479,7 +482,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c->function = KVM_CPUID_FEATURES; c->eax = env->features[FEAT_KVM]; - if (hyperv_enabled(cpu)) { + if (has_msr_hv_hypercall) { memcpy(signature, "Hv#1\0\0\0\0\0\0\0\0", 12); c->eax = signature[0]; Paolo