Skip to content

Commit

Permalink
kvm: Change kvm_cpu_synchronize_state() argument to CPUState
Browse files Browse the repository at this point in the history
It no longer relies on CPUArchState since 20d695a.

Reviewed-by: liguang <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
  • Loading branch information
afaerber committed Jun 28, 2013
1 parent c52a6b6 commit dd1750d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hw/ppc/spapr_rtas.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,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(cs);

env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
env->nip = start;
Expand Down
4 changes: 2 additions & 2 deletions include/sysemu/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
4 changes: 1 addition & 3 deletions kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,10 +1590,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);
}
Expand Down
2 changes: 1 addition & 1 deletion kvm-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
10 changes: 5 additions & 5 deletions target-i386/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit dd1750d

Please sign in to comment.