mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
kvm: Separate TCG from KVM cpu execution
Mixing up TCG bits with KVM already led to problems around eflags emulation on x86. Moreover, quite some code that TCG requires on cpu enty/exit is useless for KVM. So dispatch between tcg_cpu_exec and kvm_cpu_exec as early as possible. The core logic of cpu_halted from cpu_exec is added to kvm_arch_process_irqchip_events. Moving away from cpu_exec makes exception_index meaningless for KVM, we can simply pass the exit reason directly (only "EXCP_DEBUG vs. rest" is relevant). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
83f338f73e
commit
6792a57bf1
4 changed files with 23 additions and 31 deletions
19
kvm-all.c
19
kvm-all.c
|
@ -895,10 +895,11 @@ int kvm_cpu_exec(CPUState *env)
|
|||
|
||||
if (kvm_arch_process_irqchip_events(env)) {
|
||||
env->exit_request = 0;
|
||||
env->exception_index = EXCP_HLT;
|
||||
return 0;
|
||||
return EXCP_HLT;
|
||||
}
|
||||
|
||||
cpu_single_env = env;
|
||||
|
||||
do {
|
||||
if (env->kvm_vcpu_dirty) {
|
||||
kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE);
|
||||
|
@ -927,7 +928,6 @@ int kvm_cpu_exec(CPUState *env)
|
|||
kvm_flush_coalesced_mmio_buffer();
|
||||
|
||||
if (ret == -EINTR || ret == -EAGAIN) {
|
||||
cpu_exit(env);
|
||||
DPRINTF("io window exit\n");
|
||||
ret = 0;
|
||||
break;
|
||||
|
@ -978,8 +978,8 @@ int kvm_cpu_exec(CPUState *env)
|
|||
DPRINTF("kvm_exit_debug\n");
|
||||
#ifdef KVM_CAP_SET_GUEST_DEBUG
|
||||
if (kvm_arch_debug(&run->debug.arch)) {
|
||||
env->exception_index = EXCP_DEBUG;
|
||||
return 0;
|
||||
ret = EXCP_DEBUG;
|
||||
goto out;
|
||||
}
|
||||
/* re-enter, this exception was guest-internal */
|
||||
ret = 1;
|
||||
|
@ -995,13 +995,12 @@ int kvm_cpu_exec(CPUState *env)
|
|||
if (ret < 0) {
|
||||
cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE);
|
||||
vm_stop(VMSTOP_PANIC);
|
||||
env->exit_request = 1;
|
||||
}
|
||||
if (env->exit_request) {
|
||||
env->exit_request = 0;
|
||||
env->exception_index = EXCP_INTERRUPT;
|
||||
}
|
||||
ret = EXCP_INTERRUPT;
|
||||
|
||||
out:
|
||||
env->exit_request = 0;
|
||||
cpu_single_env = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue