From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt8G-0004ng-Gc for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xxt8A-0000Ny-Fk for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:24 -0500 Received: from mail.ispras.ru ([83.149.199.45]:58223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt8A-0000No-7o for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:18 -0500 From: Pavel Dovgalyuk Date: Mon, 08 Dec 2014 10:53:17 +0300 Message-ID: <20141208075317.7108.43820.stgit@PASHA-ISP> In-Reply-To: <20141208075255.7108.19079.stgit@PASHA-ISP> References: <20141208075255.7108.19079.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v6 03/32] 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: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com This patch sets can_do_io function to allow reading icount within cpu-exec, but outside TB execution. Signed-off-by: Pavel Dovgalyuk --- cpu-exec.c | 3 +++ cpus.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index f52f292..88675ca 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); @@ -548,6 +550,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 0c33458..7a45a51 100644 --- a/cpus.c +++ b/cpus.c @@ -934,6 +934,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_mutex_lock(&qemu_global_mutex); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); + cpu->can_do_io = 1; current_cpu = cpu; r = kvm_init_vcpu(cpu); @@ -974,6 +975,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); + cpu->can_do_io = 1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); @@ -1016,6 +1018,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) CPU_FOREACH(cpu) { cpu->thread_id = qemu_get_thread_id(); cpu->created = true; + cpu->can_do_io = 1; } qemu_cond_signal(&qemu_cpu_cond);