From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 37/47] cpu: Move exit_request field to CPUState Date: Sat, 16 Feb 2013 16:45:32 +0100 Message-ID: <1361029542-8412-38-git-send-email-afaerber@suse.de> References: <1361029542-8412-1-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson (supporter:sPAPR), Alexander Graf (supporter:sPAPR), Gleb Natapov (supporter:Overall), Marcelo Tosatti (supporter:Overall), qemu-ppc@nongnu.org (open list:sPAPR), kvm@vger.kernel.org (open list:Overall) To: qemu-devel@nongnu.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:40430 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753316Ab3BPPtm (ORCPT ); Sat, 16 Feb 2013 10:49:42 -0500 In-Reply-To: <1361029542-8412-1-git-send-email-afaerber@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Since it was located before breakpoints field, it needs to be reset. Signed-off-by: Andreas F=C3=A4rber --- cpu-exec.c | 8 ++++---- exec.c | 4 +++- hw/spapr_hcall.c | 5 +++-- include/exec/cpu-defs.h | 2 -- include/qom/cpu.h | 2 ++ kvm-all.c | 6 +++--- qom/cpu.c | 1 + target-i386/kvm.c | 4 ++-- 8 Dateien ge=C3=A4ndert, 18 Zeilen hinzugef=C3=BCgt(+), 14 Zeilen entf= ernt(-) diff --git a/cpu-exec.c b/cpu-exec.c index ff9a884..cf103f2 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -196,7 +196,7 @@ int cpu_exec(CPUArchState *env) cpu_single_env =3D env; =20 if (unlikely(exit_request)) { - env->exit_request =3D 1; + cpu->exit_request =3D 1; } =20 #if defined(TARGET_I386) @@ -537,8 +537,8 @@ int cpu_exec(CPUArchState *env) next_tb =3D 0; } } - if (unlikely(env->exit_request)) { - env->exit_request =3D 0; + if (unlikely(cpu->exit_request)) { + cpu->exit_request =3D 0; env->exception_index =3D EXCP_INTERRUPT; cpu_loop_exit(env); } @@ -591,7 +591,7 @@ int cpu_exec(CPUArchState *env) starting execution if there is a pending interrupt.= */ env->current_tb =3D tb; barrier(); - if (likely(!env->exit_request)) { + if (likely(!cpu->exit_request)) { tc_ptr =3D tb->tc_ptr; /* execute the generated code */ next_tb =3D tcg_qemu_tb_exec(env, tc_ptr); diff --git a/exec.c b/exec.c index b85508b..dbb893a 100644 --- a/exec.c +++ b/exec.c @@ -492,7 +492,9 @@ void cpu_reset_interrupt(CPUArchState *env, int mas= k) =20 void cpu_exit(CPUArchState *env) { - env->exit_request =3D 1; + CPUState *cpu =3D ENV_GET_CPU(env); + + cpu->exit_request =3D 1; cpu_unlink_tb(env); } =20 diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c index 2889742..af1db6e 100644 --- a/hw/spapr_hcall.c +++ b/hw/spapr_hcall.c @@ -513,13 +513,14 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPR= Environment *spapr, target_ulong opcode, target_ulong *args) { CPUPPCState *env =3D &cpu->env; + CPUState *cs =3D CPU(cpu); =20 env->msr |=3D (1ULL << MSR_EE); hreg_compute_hflags(env); - if (!cpu_has_work(CPU(cpu))) { + if (!cpu_has_work(cs)) { env->halted =3D 1; env->exception_index =3D EXCP_HLT; - env->exit_request =3D 1; + cs->exit_request =3D 1; } return H_SUCCESS; } diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index ba814ff..ca39f05 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -26,7 +26,6 @@ #include "config.h" #include #include -#include #include "qemu/osdep.h" #include "qemu/queue.h" #include "exec/hwaddr.h" @@ -160,7 +159,6 @@ typedef struct CPUWatchpoint { memory was accessed */ = \ uint32_t halted; /* Nonzero if the CPU is in suspend state */ = \ uint32_t interrupt_request; = \ - volatile sig_atomic_t exit_request; = \ CPU_COMMON_TLB = \ struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; = \ /* buffer for temporaries in the code generator */ = \ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index c465d88..42f3f34 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -20,6 +20,7 @@ #ifndef QEMU_CPU_H #define QEMU_CPU_H =20 +#include #include "hw/qdev-core.h" #include "qemu/thread.h" =20 @@ -96,6 +97,7 @@ struct CPUState { bool created; bool stop; bool stopped; + volatile sig_atomic_t exit_request; =20 int kvm_fd; bool kvm_vcpu_dirty; diff --git a/kvm-all.c b/kvm-all.c index 04ec2d5..4decfdc 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1537,7 +1537,7 @@ int kvm_cpu_exec(CPUArchState *env) DPRINTF("kvm_cpu_exec()\n"); =20 if (kvm_arch_process_async_events(cpu)) { - env->exit_request =3D 0; + cpu->exit_request =3D 0; return EXCP_HLT; } =20 @@ -1548,7 +1548,7 @@ int kvm_cpu_exec(CPUArchState *env) } =20 kvm_arch_pre_run(cpu, run); - if (env->exit_request) { + if (cpu->exit_request) { DPRINTF("interrupt exit requested\n"); /* * KVM requires us to reenter the kernel after IO exits to= complete @@ -1622,7 +1622,7 @@ int kvm_cpu_exec(CPUArchState *env) vm_stop(RUN_STATE_INTERNAL_ERROR); } =20 - env->exit_request =3D 0; + cpu->exit_request =3D 0; return ret; } =20 diff --git a/qom/cpu.c b/qom/cpu.c index 870e9ba..7d8c675 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -32,6 +32,7 @@ void cpu_reset(CPUState *cpu) =20 static void cpu_common_reset(CPUState *cpu) { + cpu->exit_request =3D 0; } =20 ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_m= odel) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 9ebf181..0cf413d 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1777,7 +1777,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_r= un *run) * or pending TPR access reports. */ if (env->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - env->exit_request =3D 1; + cpu->exit_request =3D 1; } =20 /* Try to inject an interrupt if the guest can accept it */ @@ -1847,7 +1847,7 @@ int kvm_arch_process_async_events(CPUState *cs) if (env->exception_injected =3D=3D EXCP08_DBLE) { /* this means triple fault */ qemu_system_reset_request(); - env->exit_request =3D 1; + cs->exit_request =3D 1; return 0; } env->exception_injected =3D EXCP12_MCHK; --=20 1.7.10.4