qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Vadim Rozenfeld <vrozenfe@redhat.com>, qemu-devel@nongnu.org
Cc: mtosatti@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 5/7] make hyperv hypercall and guest os id MSRs migratable.
Date: Thu, 23 Jan 2014 19:19:42 +0100	[thread overview]
Message-ID: <52E15D3E.8020707@redhat.com> (raw)
In-Reply-To: <1390484449-20974-6-git-send-email-vrozenfe@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

  reply	other threads:[~2014-01-23 18:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 13:40 [Qemu-devel] [PATCH v2 0/7] Hyper-V parameters update Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 1/7] Don't report "Microsoft" as the vendor ID signature Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 2/7] Don't specify hypervisor system identity Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 3/7] Don't specify implementation limits Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 4/7] Don't report the KVM signature twice, since it's already reported in KVM_CPUID_SIGNATURE CPUID leaf Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 5/7] make hyperv hypercall and guest os id MSRs migratable Vadim Rozenfeld
2014-01-23 18:19   ` Paolo Bonzini [this message]
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 6/7] make hyperv vapic assist page migratable Vadim Rozenfeld
2014-01-23 13:40 ` [Qemu-devel] [PATCH v2 7/7] add support for hyper-v timers http://msdn.microsoft.com/en-us/library/windows/hardware/ff541625%28v=vs.85%29.aspx This code is generic for activating reference time counter or virtual reference time stamp counter Vadim Rozenfeld
2014-01-23 17:31   ` Marcelo Tosatti
2014-01-23 17:55 ` [Qemu-devel] [PATCH v2 0/7] Hyper-V parameters update Paolo Bonzini

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=52E15D3E.8020707@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vrozenfe@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).