Patchwork [4/7] KVM regsync: Add register level parameter to kvm_cpu_synchronize_state

login
register
mail settings
Submitter Jason J. Herne
Date Dec. 21, 2012, 1:56 p.m.
Message ID <1356098169-4886-1-git-send-email-jjherne@us.ibm.com>
Download mbox | patch
Permalink /patch/207824/
State New
Headers show

Comments

Jason J. Herne - Dec. 21, 2012, 1:56 p.m.
From: "Jason J. Herne" <jjherne@us.ibm.com>

kvm_cpu_synchronize_state is updated to take/propagate the register level
parameter. All callers are modified to specify the runtime state.

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 9a0e071..2f3e485 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -236,7 +236,7 @@  struct kvm_cpu_syncstate_args {
     int register_level;
 };
 
-void kvm_cpu_synchronize_state(CPUArchState *env);
+void kvm_cpu_synchronize_state(CPUArchState *env, int register_level);
 void kvm_cpu_synchronize_post_reset(CPUArchState *env);
 void kvm_cpu_synchronize_post_init(CPUArchState *env);
 
@@ -245,7 +245,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 d227e8b..aee5bdd 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1496,13 +1496,13 @@  static void do_kvm_cpu_synchronize_state(void *_args)
     }
 }
 
-void kvm_cpu_synchronize_state(CPUArchState *env)
+void kvm_cpu_synchronize_state(CPUArchState *env, int register_level)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     struct kvm_cpu_syncstate_args args;
 
     args.env = env;
-    args.register_level = KVM_REGSYNC_FULL_STATE;
+    args.register_level = register_level;
 
     if (!env->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..112b4e9 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 register_level)
 {
 }
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 4472738..1b6a604 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1768,7 +1768,7 @@  int kvm_arch_process_async_events(CPUX86State *env)
 
         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 */
@@ -1799,16 +1799,16 @@  int kvm_arch_process_async_events(CPUX86State *env)
         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);
     }
@@ -2086,7 +2086,7 @@  int kvm_arch_handle_exit(CPUX86State *env, struct kvm_run *run)
 
 bool kvm_arch_stop_on_emulation_error(CPUX86State *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);
 }