Received: from eggs.gnu.org ([2001:4830:134:3::10]:58482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgN-0006Tc-Io for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0YgI-0005EY-LI for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgI-0005EU-CU for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:34 -0500 From: Paolo Bonzini Date: Mon, 15 Dec 2014 17:38:11 +0100 Message-Id: <1418661511-22348-28-git-send-email-pbonzini@redhat.com> In-Reply-To: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> References: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 27/47] icount: set can_do_io outside TB execution List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Dovgalyuk From: Pavel Dovgalyuk This patch sets can_do_io function to allow reading icount within cpu-exec, but outside TB execution. Signed-off-by: Pavel Dovgalyuk Signed-off-by: Paolo Bonzini --- cpu-exec.c | 3 +++ cpus.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cpu-exec.c b/cpu-exec.c index 4df9856..cce80f0 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -168,7 +168,9 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr) } #endif /* DEBUG_DISAS */ + cpu->can_do_io = 0; next_tb = tcg_qemu_tb_exec(env, tb_ptr); + cpu->can_do_io = 1; trace_exec_tb_exit((void *) (next_tb & ~TB_EXIT_MASK), next_tb & TB_EXIT_MASK); @@ -543,6 +545,7 @@ int cpu_exec(CPUArchState *env) cpu = current_cpu; env = cpu->env_ptr; cc = CPU_GET_CLASS(cpu); + cpu->can_do_io = 1; #ifdef TARGET_I386 x86_cpu = X86_CPU(cpu); #endif diff --git a/cpus.c b/cpus.c index 91119bb..615d4ae 100644 --- a/cpus.c +++ b/cpus.c @@ -935,6 +935,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->exception_index = -1; + cpu->can_do_io = 1; current_cpu = cpu; r = kvm_init_vcpu(cpu); @@ -976,6 +977,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->exception_index = -1; + cpu->can_do_io = 1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); @@ -1019,6 +1021,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->exception_index = -1; + cpu->can_do_io = 1; } qemu_cond_signal(&qemu_cpu_cond); -- 1.8.3.1