From patchwork Tue May 5 10:17:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 468043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BDC151402A0 for ; Tue, 5 May 2015 20:20:12 +1000 (AEST) Received: from localhost ([::1]:38087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZxS-0001Fa-2k for incoming@patchwork.ozlabs.org; Tue, 05 May 2015 06:20:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZvF-0005QF-Sh for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpZvE-0007FU-ME for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:53 -0400 Received: from mail.ispras.ru ([83.149.199.45]:38795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZvE-0007Ee-Df for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:52 -0400 Received: from [10.10.150.75] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id B6C4C54006F; Tue, 5 May 2015 13:17:51 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Tue, 05 May 2015 13:17:53 +0300 Message-ID: <20150505101752.16764.25122.stgit@PASHA-ISP> In-Reply-To: <20150505101732.16764.93601.stgit@PASHA-ISP> References: <20150505101732.16764.93601.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 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, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC PATCH v12 03/21] sysemu: system functions for replay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch removes "static" specifier from several qemu function to make them visible to the replay module. It also invents several system functions that will be used by replay. Reviewed-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- cpus.c | 2 +- include/exec/exec-all.h | 1 + include/qom/cpu.h | 10 ++++++++++ include/sysemu/cpus.h | 1 + translate-all.c | 8 ++++++++ 5 files changed, 21 insertions(+), 1 deletions(-) diff --git a/cpus.c b/cpus.c index e6dcae3..d566f66 100644 --- a/cpus.c +++ b/cpus.c @@ -88,7 +88,7 @@ static bool cpu_thread_is_idle(CPUState *cpu) return true; } -static bool all_cpu_threads_idle(void) +bool all_cpu_threads_idle(void) { CPUState *cpu; diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 054a42c..e7c3328 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -216,6 +216,7 @@ static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc) void tb_free(TranslationBlock *tb); void tb_flush(CPUArchState *env); +void tb_flush_all(void); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); #if defined(USE_DIRECT_JUMP) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index f342654..fff2e0a 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -493,6 +493,16 @@ static inline bool cpu_has_work(CPUState *cpu) bool qemu_cpu_is_self(CPUState *cpu); /** + * qemu_in_vcpu_thread: + * + * Checks whether the caller is executing on the vCPU thread + * of the current vCPU. + * + * Returns: %true if called from vCPU's thread, %false otherwise. + */ +bool qemu_in_vcpu_thread(void); + +/** * qemu_cpu_kick: * @cpu: The vCPU to kick. * diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h index 3f162a9..86ae556 100644 --- a/include/sysemu/cpus.h +++ b/include/sysemu/cpus.h @@ -6,6 +6,7 @@ void qemu_init_cpu_loop(void); void resume_all_vcpus(void); void pause_all_vcpus(void); void cpu_stop_current(void); +bool all_cpu_threads_idle(void); void cpu_synchronize_all_states(void); void cpu_synchronize_all_post_reset(void); diff --git a/translate-all.c b/translate-all.c index 11763c6..1e02ae5 100644 --- a/translate-all.c +++ b/translate-all.c @@ -812,6 +812,14 @@ void tb_flush(CPUArchState *env1) tcg_ctx.tb_ctx.tb_flush_count++; } +void tb_flush_all(void) +{ + CPUState *cpu; + for (cpu = first_cpu ; cpu != NULL ; cpu = CPU_NEXT(cpu)) { + tb_flush(cpu->env_ptr); + } +} + #ifdef DEBUG_TB_CHECK static void tb_invalidate_check(target_ulong address)