Patchwork [qom-cpu,01/59] kvm: Change kvm_cpu_synchronize_state() argument to CPUState

login
register
mail settings
Submitter Andreas Färber
Date June 9, 2013, 7:12 p.m.
Message ID <1370805206-26574-2-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/250079/
State New
Headers show

Comments

Andreas Färber - June 9, 2013, 7:12 p.m.
It no longer relies on CPUArchState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/ppc/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, 10 insertions(+), 12 deletions(-)
liguang - June 10, 2013, 1:58 a.m.
在 2013-06-09日的 21:12 +0200,Andreas Färber写道:
> It no longer relies on CPUArchState.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>

> ---
>  hw/ppc/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, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 8ecaa5f..48cea4b 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -192,7 +192,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(cpu);
>  
>          env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
>          env->nip = start;
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 8b19322..3e1db28 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -259,14 +259,14 @@ int kvm_check_extension(KVMState *s, unsigned int extension);
>  
>  uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
>                                        uint32_t index, int reg);
> -void kvm_cpu_synchronize_state(CPUArchState *env);
> +void kvm_cpu_synchronize_state(CPUState *cpu);
>  
>  /* generic hooks - to be moved/refactored once there are more users */
>  
>  static inline void cpu_synchronize_state(CPUArchState *env)
>  {
>      if (kvm_enabled()) {
> -        kvm_cpu_synchronize_state(env);
> +        kvm_cpu_synchronize_state(ENV_GET_CPU(env));
>      }
>  }
>  
> diff --git a/kvm-all.c b/kvm-all.c
> index 405480e..e7202ff 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1585,10 +1585,8 @@ static void do_kvm_cpu_synchronize_state(void *arg)
>      }
>  }
>  
> -void kvm_cpu_synchronize_state(CPUArchState *env)
> +void kvm_cpu_synchronize_state(CPUState *cpu)
>  {
> -    CPUState *cpu = ENV_GET_CPU(env);
> -
>      if (!cpu->kvm_vcpu_dirty) {
>          run_on_cpu(cpu, do_kvm_cpu_synchronize_state, cpu);
>      }
> diff --git a/kvm-stub.c b/kvm-stub.c
> index 22eaff0..128faf7 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -42,7 +42,7 @@ void kvm_flush_coalesced_mmio_buffer(void)
>  {
>  }
>  
> -void kvm_cpu_synchronize_state(CPUArchState *env)
> +void kvm_cpu_synchronize_state(CPUState *cpu)
>  {
>  }
>  
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 9ffb6ca..0b0adfd 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -1857,7 +1857,7 @@ int kvm_arch_process_async_events(CPUState *cs)
>  
>          cs->interrupt_request &= ~CPU_INTERRUPT_MCE;
>  
> -        kvm_cpu_synchronize_state(env);
> +        kvm_cpu_synchronize_state(cs);
>  
>          if (env->exception_injected == EXCP08_DBLE) {
>              /* this means triple fault */
> @@ -1888,16 +1888,16 @@ int kvm_arch_process_async_events(CPUState *cs)
>          cs->halted = 0;
>      }
>      if (cs->interrupt_request & CPU_INTERRUPT_INIT) {
> -        kvm_cpu_synchronize_state(env);
> +        kvm_cpu_synchronize_state(cs);
>          do_cpu_init(cpu);
>      }
>      if (cs->interrupt_request & CPU_INTERRUPT_SIPI) {
> -        kvm_cpu_synchronize_state(env);
> +        kvm_cpu_synchronize_state(cs);
>          do_cpu_sipi(cpu);
>      }
>      if (cs->interrupt_request & CPU_INTERRUPT_TPR) {
>          cs->interrupt_request &= ~CPU_INTERRUPT_TPR;
> -        kvm_cpu_synchronize_state(env);
> +        kvm_cpu_synchronize_state(cs);
>          apic_handle_tpr_access_report(env->apic_state, env->eip,
>                                        env->tpr_access_type);
>      }
> @@ -2184,7 +2184,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(cs);
>      return !(env->cr[0] & CR0_PE_MASK) ||
>             ((env->segs[R_CS].selector  & 3) != 3);
>  }

Patch

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 8ecaa5f..48cea4b 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -192,7 +192,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(cpu);
 
         env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
         env->nip = start;
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 8b19322..3e1db28 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -259,14 +259,14 @@  int kvm_check_extension(KVMState *s, unsigned int extension);
 
 uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
                                       uint32_t index, int reg);
-void kvm_cpu_synchronize_state(CPUArchState *env);
+void kvm_cpu_synchronize_state(CPUState *cpu);
 
 /* generic hooks - to be moved/refactored once there are more users */
 
 static inline void cpu_synchronize_state(CPUArchState *env)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(ENV_GET_CPU(env));
     }
 }
 
diff --git a/kvm-all.c b/kvm-all.c
index 405480e..e7202ff 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1585,10 +1585,8 @@  static void do_kvm_cpu_synchronize_state(void *arg)
     }
 }
 
-void kvm_cpu_synchronize_state(CPUArchState *env)
+void kvm_cpu_synchronize_state(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     if (!cpu->kvm_vcpu_dirty) {
         run_on_cpu(cpu, do_kvm_cpu_synchronize_state, cpu);
     }
diff --git a/kvm-stub.c b/kvm-stub.c
index 22eaff0..128faf7 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -42,7 +42,7 @@  void kvm_flush_coalesced_mmio_buffer(void)
 {
 }
 
-void kvm_cpu_synchronize_state(CPUArchState *env)
+void kvm_cpu_synchronize_state(CPUState *cpu)
 {
 }
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 9ffb6ca..0b0adfd 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1857,7 +1857,7 @@  int kvm_arch_process_async_events(CPUState *cs)
 
         cs->interrupt_request &= ~CPU_INTERRUPT_MCE;
 
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(cs);
 
         if (env->exception_injected == EXCP08_DBLE) {
             /* this means triple fault */
@@ -1888,16 +1888,16 @@  int kvm_arch_process_async_events(CPUState *cs)
         cs->halted = 0;
     }
     if (cs->interrupt_request & CPU_INTERRUPT_INIT) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(cs);
         do_cpu_init(cpu);
     }
     if (cs->interrupt_request & CPU_INTERRUPT_SIPI) {
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(cs);
         do_cpu_sipi(cpu);
     }
     if (cs->interrupt_request & CPU_INTERRUPT_TPR) {
         cs->interrupt_request &= ~CPU_INTERRUPT_TPR;
-        kvm_cpu_synchronize_state(env);
+        kvm_cpu_synchronize_state(cs);
         apic_handle_tpr_access_report(env->apic_state, env->eip,
                                       env->tpr_access_type);
     }
@@ -2184,7 +2184,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(cs);
     return !(env->cr[0] & CR0_PE_MASK) ||
            ((env->segs[R_CS].selector  & 3) != 3);
 }