qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
To: Avi Kivity <avi@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, KVM <kvm@vger.kernel.org>,
	Qemu-devel <qemu-devel@nongnu.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 2/2] QEMU kvm: Add support to get/set vcpu unhalt msr to aid migration
Date: Fri, 23 Mar 2012 13:53:58 +0530	[thread overview]
Message-ID: <20120323082353.17193.46145.sendpatchset@codeblue> (raw)
In-Reply-To: <20120323082242.17193.16289.sendpatchset@codeblue>

From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>

MSR_KVM_PV_UNHALT tells whether vcpu is unhalted, which needs to be
used during migration.

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
---
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index a1ed3e7..10286a5 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -697,6 +697,7 @@ typedef struct CPUX86State {
     uint64_t system_time_msr;
     uint64_t wall_clock_msr;
     uint64_t async_pf_en_msr;
+    uint64_t pv_unhalt_msr;
 
     uint64_t tsc;
     uint64_t tsc_deadline;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index dbebd3a..98b9088 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -62,6 +62,7 @@ static bool has_msr_star;
 static bool has_msr_hsave_pa;
 static bool has_msr_tsc_deadline;
 static bool has_msr_async_pf_en;
+static bool has_msr_pv_unhalt;
 static bool has_msr_misc_enable;
 static int lm_capable_kernel;
 
@@ -444,7 +445,7 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     }
 
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
-
+    has_msr_pv_unhalt = c->eax & (1 << KVM_FEATURE_PV_UNHALT);
     cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
 
     for (i = 0; i <= limit; i++) {
@@ -1012,6 +1013,10 @@ static int kvm_put_msrs(CPUX86State *env, int level)
         if (hyperv_vapic_recommended()) {
             kvm_msr_entry_set(&msrs[n++], HV_X64_MSR_APIC_ASSIST_PAGE, 0);
         }
+        if (has_msr_pv_unhalt) {
+            kvm_msr_entry_set(&msrs[n++], MSR_KVM_PV_UNHALT,
+                              env->pv_unhalt_msr);
+        }
     }
     if (env->mcg_cap) {
         int i;
@@ -1247,6 +1252,9 @@ static int kvm_get_msrs(CPUX86State *env)
     if (has_msr_async_pf_en) {
         msrs[n++].index = MSR_KVM_ASYNC_PF_EN;
     }
+    if (has_msr_pv_unhalt) {
+        msrs[n++].index = MSR_KVM_PV_UNHALT;
+    }
 
     if (env->mcg_cap) {
         msrs[n++].index = MSR_MCG_STATUS;
@@ -1326,6 +1334,9 @@ static int kvm_get_msrs(CPUX86State *env)
         case MSR_KVM_ASYNC_PF_EN:
             env->async_pf_en_msr = msrs[i].data;
             break;
+        case MSR_KVM_PV_UNHALT:
+            env->pv_unhalt_msr = msrs[i].data;
+            break;
         }
     }
 

  parent reply	other threads:[~2012-03-23  8:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23  8:22 [Qemu-devel] [PATCH 0/2] QEMU kvm: Adding paravirtual spinlock support for x86 Raghavendra K T
2012-03-23  8:23 ` [Qemu-devel] [PATCH 1/2] QEMU kvm: Add PV_UNHALT feature support Raghavendra K T
2012-03-23  8:23 ` Raghavendra K T [this message]
2012-03-23  8:57   ` [Qemu-devel] [PATCH 2/2] QEMU kvm: Add support to get/set vcpu unhalt msr to aid migration Jan Kiszka
2012-03-23  9:38     ` Raghavendra K T
2012-03-23 13:07     ` Raghavendra K T

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=20120323082353.17193.46145.sendpatchset@codeblue \
    --to=raghavendra.kt@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vatsa@linux.vnet.ibm.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).