Patchwork [5/7,v2] KVM regsync: Add register bitmap parameter to kvm_cpu_synchronize_state

login
register
mail settings
Submitter Jason J. Herne
Date Jan. 10, 2013, 3:29 p.m.
Message ID <1357831753-3983-1-git-send-email-jjherne@us.ibm.com>
Download mbox | patch
Permalink /patch/211072/
State New
Headers show

Comments

Jason J. Herne - Jan. 10, 2013, 3:29 p.m.
From: "Jason J. Herne" <jjherne@us.ibm.com>

kvm_cpu_synchronize_state is updated to take/propagate the register bitmap
parameter. All callers are modified to specify full state sync.

Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/spapr_rtas.c      |    2 +-
 include/sysemu/kvm.h |    4 ++--
 kvm-all.c            |    4 ++--
 kvm-stub.c           |    2 +-
 target-i386/kvm.c    |   10 +++++-----
 5 files changed, 11 insertions(+), 11 deletions(-)

Patch

diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c
index 81eecd0..3c7ffee 100644
--- a/hw/spapr_rtas.c
+++ b/hw/spapr_rtas.c
@@ -190,7 +190,7 @@  static void rtas_start_cpu(sPAPREnvironment *spapr,
         /* This will make sure qemu state is up to date with kvm, and
          * mark it dirty so our changes get flushed back before the
          * new cpu enters */
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
 
         env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
         env->nip = start;
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 193d1f4..9512c8b 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -229,7 +229,7 @@  struct kvm_cpu_syncstate_args {
     int regmap;
 };
 
-void kvm_cpu_synchronize_state(CPUArchState *env);
+void kvm_cpu_synchronize_state(CPUArchState *env, int regmap);
 void kvm_cpu_synchronize_post_reset(CPUArchState *env);
 void kvm_cpu_synchronize_post_init(CPUArchState *env);
 
@@ -238,7 +238,7 @@  void kvm_cpu_synchronize_post_init(CPUArchState *env);
 static inline void cpu_synchronize_state(CPUArchState *env)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
     }
 }
 
diff --git a/kvm-all.c b/kvm-all.c
index 77ab72a..67ff696 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1502,13 +1502,13 @@  static void do_kvm_cpu_synchronize_state(void *arg)
     }
 }
 
-void kvm_cpu_synchronize_state(CPUArchState *env)
+void kvm_cpu_synchronize_state(CPUArchState *env, int regmap)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     struct kvm_cpu_syncstate_args args;
 
     args.cpu = cpu;
-    args.regmap = KVM_REGSYNC_FULL_STATE;
+    args.regmap = regmap;
 
     if (args.regmap & ~cpu->kvm_vcpu_dirty) {
         run_on_cpu(cpu, do_kvm_cpu_synchronize_state, &args);
diff --git a/kvm-stub.c b/kvm-stub.c
index 5b97152..48018e1 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -38,7 +38,7 @@  void kvm_flush_coalesced_mmio_buffer(void)
 {
 }
 
-void kvm_cpu_synchronize_state(CPUArchState *env)
+void kvm_cpu_synchronize_state(CPUArchState *env, int regmap)
 {
 }
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index fc84922..c05ccc5 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1812,7 +1812,7 @@  int kvm_arch_process_async_events(CPUState *cs)
 
         env->interrupt_request &= ~CPU_INTERRUPT_MCE;
 
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
 
         if (env->exception_injected == EXCP08_DBLE) {
             /* this means triple fault */
@@ -1843,16 +1843,16 @@  int kvm_arch_process_async_events(CPUState *cs)
         env->halted = 0;
     }
     if (env->interrupt_request & CPU_INTERRUPT_INIT) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
         do_cpu_init(cpu);
     }
     if (env->interrupt_request & CPU_INTERRUPT_SIPI) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
         do_cpu_sipi(cpu);
     }
     if (env->interrupt_request & CPU_INTERRUPT_TPR) {
         env->interrupt_request &= ~CPU_INTERRUPT_TPR;
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
         apic_handle_tpr_access_report(env->apic_state, env->eip,
                                       env->tpr_access_type);
     }
@@ -2138,7 +2138,7 @@  bool kvm_arch_stop_on_emulation_error(CPUState *cs)
     X86CPU *cpu = X86_CPU(cs);
     CPUX86State *env = &cpu->env;
 
-    kvm_cpu_synchronize_state(env);
+    kvm_cpu_synchronize_state(env, KVM_REGSYNC_FULL_STATE);
     return !(env->cr[0] & CR0_PE_MASK) ||
            ((env->segs[R_CS].selector  & 3) != 3);
 }