From patchwork Tue May 28 14:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98F0AC25B78 for ; Tue, 28 May 2024 15:01:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJ5-0000aO-0P; Tue, 28 May 2024 11:00:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJ3-0000YU-8I for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:05 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJ1-0006sY-L4 for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:04 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a6265d48ec3so104009166b.0 for ; Tue, 28 May 2024 08:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908401; x=1717513201; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i1Z65Olw7qFihD1LZKiHkfm7mBVYbNrglt/V1Ou6QFA=; b=SJRmQ+mTXs7A0O5UB6trSJBXXBAnbKWFoORq3vpjCQcIIh/xHhIRN+L5QIaHWKYfII JQLexskqh3CfiimM4eNQS8lkIf2drAVxn39pMzn7sXqNLQMBFFz+eGwSxZ2pMMfT+SN5 RRaKyCZ3Wpi3PpIVP4J9E4A7ylAh9nT9QxYzEZXzOIvs9Ioa8I/+OFj7KTh0gODVi7Wt F7X3l0+786N7O+DzSi6vXKwdMIRoo92VoEHynyJ5F0eXWulIpkbQ5vyxtehWL1FDFoJe MFX/N/G0FGl6XZZoEV7udMczsJM9lQ1a6fXcq2thREPPTePaircyXzKM58xY6cLqwJU9 4jJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908401; x=1717513201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i1Z65Olw7qFihD1LZKiHkfm7mBVYbNrglt/V1Ou6QFA=; b=svESAyfyOv3fZNuUiVLNuMwieFDtfF8zbb18ZZQrtoyiekUkU8Lrha8tRrkfVYM2ys MXbUeQjNt9tVcS3wVTLPH5OusJZPSIqzbIdn/gfAPpd/OadfHKfq+Eg4lHxSJmd6482l txFfg6FvdgWs2+AUxFkdAtjVLA2HOk0D+Vi13UxEgDT4dpFM2twZKcS5T7XxgMvAqplq uTUbIUTpwuIXZIGmYMT+YzFcjXnqPc/t+2zQKwBpftbX/DUN5CJoBBgGpfAftLOkPz/F Br3tTbpWk5rlM+iwYcT8quPxTkwmXNjE8ipwEhsbY845AAD77U5T75ooxZ5I6/nJLAWo hvTA== X-Gm-Message-State: AOJu0Yx0th/dB9mTVp+nWjryVAU53dii/7Q7qnWY3vDUNXKwgjQf+/Bp gKLSXcmevaejO9IYyiYwv7voFaIv2LqE5iapxDSoPQojN3uhpXwhmKlnipKsSsmBOlTLPiv5PgP e X-Google-Smtp-Source: AGHT+IGlod3Le+eprfEOTDMKSd1HoZZpL9ypwVHiZ5EsFhpqK053zNgZSEiZv/PpaygLDuKM+d8URg== X-Received: by 2002:a17:906:57d9:b0:a5c:ec66:226d with SMTP id a640c23a62f3a-a62641b1bb4mr854593066b.17.1716908401301; Tue, 28 May 2024 08:00:01 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8e714sm620053766b.186.2024.05.28.08.00.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 1/6] system/runstate: Remove unused 'qemu/plugin.h' header Date: Tue, 28 May 2024 16:59:47 +0200 Message-ID: <20240528145953.65398-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org system/runstate.c never required "qemu/plugin.h". Signed-off-by: Philippe Mathieu-Daudé --- system/runstate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/system/runstate.c b/system/runstate.c index cb4905a40f..ec32e270cb 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -45,7 +45,6 @@ #include "qemu/job.h" #include "qemu/log.h" #include "qemu/module.h" -#include "qemu/plugin.h" #include "qemu/sockets.h" #include "qemu/timer.h" #include "qemu/thread.h" From patchwork Tue May 28 14:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEFE6C25B78 for ; Tue, 28 May 2024 15:01:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJA-0000dK-Pv; Tue, 28 May 2024 11:00:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJ8-0000bB-C2 for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:10 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJ6-00074i-IZ for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:10 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-57857e0f45cso1129090a12.1 for ; Tue, 28 May 2024 08:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908407; x=1717513207; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MXSsU3bC3/S4MPVHakO32DgE7Q0Emp+SarB3ZR8O4Ck=; b=W7XO3NKOwshww8oCZVx82B5CBgBryccqf9NKChMeaVwX+pwrhbRBIKRoVOy1Foettt rIN8KSU22lzCaOLkCV2dBvvJp6M61eZWVYoGnBWfmONWR0d6Ghui2VoldyrJddKxm+K+ vGmfImPjdika6a+Ml8EwotWm32t/UKiMo9qstbSevtpdlCu3cMCsLUfAQyNy1VQHLJGE bhH5j2zwpifUQ3cg7UhKKb3vcIEe+kl/sv0vFBT9WLBgCxZXWwsCFzPuw9QPyvrjuPcs hgCXL13Y9wt9P1KxtdFfkzabGhPK/NaQ98PGpqdJLQaU0xx20pJhUJfmECAIdRpXjlbx AMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908407; x=1717513207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MXSsU3bC3/S4MPVHakO32DgE7Q0Emp+SarB3ZR8O4Ck=; b=YFdnQH1WqLqZxX9mmeENGNmkucjIl/dIOHs3SbU572wDmjbq5i17o0RR7ezbRY3JMR xo+9ngcgrm/o14b1WiNF0LtEo+7gKa7CM3bMupUj23T8FaaRrZomxIpwiF28CJiOqVMI ExPx0+mpZk99iNwiABZ5B/9wk7jdOOoWiK5//o17hdltRP0mMISFBdSgcDFIAALKpORK HlyBuOno+p/iQGKtbNoGN2JqxjtYvCGE8LpNcsCyWYHnbYNQ65GYofico2YXZId1/DOE spUO6XHgRx3JeQTEcd8/B+Rv08oyqPx84JE5zSR/IfRTvSlhaNu3qHoApg40CKQfe6wz nouw== X-Gm-Message-State: AOJu0YwqOhfkv2h8tHjR5vdRClSuFCR6AxL/JQYJabbMt3EZ4709X0ka PtmWZEK6afkmb1hrLdqvGM6oChmuQdKgKw86SfJHthhKENsNZW5Z2so6/Snja7VpHAL6hu/eXYU X X-Google-Smtp-Source: AGHT+IH20g+nR0V3xBOKczGAmmt451eBuXIlzPVINdDInP0pzqV2o2taOh3ZtgQDnsp6+iBpPcsyqw== X-Received: by 2002:a50:c04d:0:b0:578:572d:8d1e with SMTP id 4fb4d7f45d1cf-578572d8e3amr7798101a12.6.1716908406774; Tue, 28 May 2024 08:00:06 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-579db5406a7sm2242454a12.63.2024.05.28.08.00.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 2/6] accel/tcg: Move common declarations to 'internal-common.h' Date: Tue, 28 May 2024 16:59:48 +0200 Message-ID: <20240528145953.65398-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 'internal-target.h' is meant for target-specific declarations, while 'internal-common.h' for common ones. Move common declarations to it. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 15 +++++++++++++++ accel/tcg/internal-target.h | 14 -------------- accel/tcg/tcg-all.c | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index cff43d221b..a8fc3db774 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -15,6 +15,8 @@ extern int64_t max_delay; extern int64_t max_advance; +extern bool one_insn_per_tb; + /* * Return true if CS is not running in parallel with other cpus, either * because there are no other cpus or we are within an exclusive context. @@ -41,4 +43,17 @@ static inline bool cpu_plugin_mem_cbs_enabled(const CPUState *cpu) #endif } +TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc, + uint64_t cs_base, uint32_t flags, + int cflags); +void page_init(void); +void tb_htable_init(void); +void tb_reset_jump(TranslationBlock *tb, int n); +TranslationBlock *tb_link_page(TranslationBlock *tb); +void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, + uintptr_t host_pc); + +bool tcg_exec_realizefn(CPUState *cpu, Error **errp); +void tcg_exec_unrealizefn(CPUState *cpu); + #endif diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index 4e36cf858e..fe109724c6 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -69,19 +69,7 @@ void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); #endif /* CONFIG_SOFTMMU */ -TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc, - uint64_t cs_base, uint32_t flags, - int cflags); -void page_init(void); -void tb_htable_init(void); -void tb_reset_jump(TranslationBlock *tb, int n); -TranslationBlock *tb_link_page(TranslationBlock *tb); bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); -void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, - uintptr_t host_pc); - -bool tcg_exec_realizefn(CPUState *cpu, Error **errp); -void tcg_exec_unrealizefn(CPUState *cpu); /* Return the current PC from CPU, which may be cached in TB. */ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) @@ -93,8 +81,6 @@ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) } } -extern bool one_insn_per_tb; - /** * tcg_req_mo: * @type: TCGBar diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c6619f5b98..2090907dba 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -38,7 +38,7 @@ #if !defined(CONFIG_USER_ONLY) #include "hw/boards.h" #endif -#include "internal-target.h" +#include "internal-common.h" struct TCGState { AccelState parent_obj; From patchwork Tue May 28 14:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FBAEC27C43 for ; Tue, 28 May 2024 15:02:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJL-0000eZ-1M; Tue, 28 May 2024 11:00:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJE-0000e8-NK for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:16 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJC-000759-Mk for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:16 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52388d9ca98so1604696e87.0 for ; Tue, 28 May 2024 08:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908412; x=1717513212; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wQcbwizGTPGLe0I7sDsQyBs7g4DJMYLbmLP09XmJRR0=; b=Czex2/t8O7se/uXPr0z5QwXQFhYB8DeINFLrTEKcaT90yNsZm7idmEurYh4WEqAJpX jMfr1l0uNx8mKEI4UYmQjreeuAjJTgDzxlLJH/MPw4ATrPoFybMn3ap2lHAUaB1CsCz0 DktJDTOIwSiZQVsBDzD/IXfXJZQvuGjQHS3HKJSP0laHELWCIo4LAsyjfH7CLmOhUErk DFSyHL+R5vXxwLUFjtRfQZnIzrXvnZREHjO7RIqX3JFcjASXqROksFYEKZD+mA9OlE4A 8QZPPxwLEi/NsehS+MD6U0N19fmmqNFGQCFaOqIJwGRKrnzqJdoGYENFfwrE58+BAzxq ru9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908412; x=1717513212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wQcbwizGTPGLe0I7sDsQyBs7g4DJMYLbmLP09XmJRR0=; b=Zrov4+S00WfkrnPhn+UJTRsOiFC6JDAsb2eEwQqvVAoczT0O2GQq45SQ18Zw0ySkFD ejwSjX7meGAkKalVbSKNV50PyjCoMReqTfi7nrcaQt8fBV8d24v6iaOzjcU2LiVqyemF yljwaW68gWD+JqOzwnsn18xXgdTbxg/o5GbPQC8tRTtbC0jErGYtiDfms0uCsD6WBmuf ounJOVWzu7bHQ2Y1ajV0FLcOr3DV+shsQcoWN7q808MWDuEq7GNBGaioaq3dmkUy/8gc Uj6p4npXbFHYUSv2mgzjRKe//udPuBKOV+1GhaYNYARn8a2wTxIhPN6cX8q5AibXUPvd qO1Q== X-Gm-Message-State: AOJu0Yz9akHzZfZyGrFgdh6jD8WPlHtZDic0elHdaV3FGtYWvxAEKrU4 AcAZG+6tTIIZCR/b02b77hXEJ5vVfT1VmzAAqTAO3ep8INnZHF8Igk18/sXHDTU2yTAik6AOPfs A X-Google-Smtp-Source: AGHT+IFIQ7KEHCMux0H8Ej1oxRWl03Ai+4ju5ILl7EZbvYQXHjzBEBsx3vPnpSEAnbddwGSJBxRJIw== X-Received: by 2002:ac2:46e2:0:b0:51f:4d57:6812 with SMTP id 2adb3069b0e04-5296594cfc7mr9627468e87.19.1716908412379; Tue, 28 May 2024 08:00:12 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cd9fed2sm622256666b.187.2024.05.28.08.00.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 3/6] accel: Clarify accel_cpu_common_[un]realize() use unassigned vCPU Date: Tue, 28 May 2024 16:59:49 +0200 Message-ID: <20240528145953.65398-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In preparation of introducing [un]realize handlers for when vCPUs are assigned, rename current handlers using the '_unassigned' suffix. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 4 ++-- include/qemu/accel.h | 17 +++++++++++------ accel/accel-target.c | 11 ++++++----- accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/tcg-all.c | 4 ++-- cpu-target.c | 4 ++-- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index a8fc3db774..ec2c6317b7 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -53,7 +53,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb); void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); -bool tcg_exec_realizefn(CPUState *cpu, Error **errp); -void tcg_exec_unrealizefn(CPUState *cpu); +bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp); +void tcg_exec_unrealize_unassigned(CPUState *cpu); #endif diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 972a849a2b..dd18c41dc0 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -43,8 +43,8 @@ typedef struct AccelClass { bool (*has_memory)(MachineState *ms, AddressSpace *as, hwaddr start_addr, hwaddr size); #endif - bool (*cpu_common_realize)(CPUState *cpu, Error **errp); - void (*cpu_common_unrealize)(CPUState *cpu); + bool (*cpu_common_realize_unassigned)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize_unassigned)(CPUState *cpu); /* gdbstub related hooks */ int (*gdbstub_supported_sstep_flags)(void); @@ -92,17 +92,22 @@ void accel_setup_post(MachineState *ms); void accel_cpu_instance_init(CPUState *cpu); /** - * accel_cpu_common_realize: + * accel_cpu_common_realize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu realization. * @errp: currently unused. + * + * The @cpu index is not yet assigned. */ -bool accel_cpu_common_realize(CPUState *cpu, Error **errp); +bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp); /** - * accel_cpu_common_unrealize: + * accel_cpu_common_unrealize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu unrealization. + * + * The @cpu index is no more assigned, @cpu has been removed from the global + * #cpus_queue. */ -void accel_cpu_common_unrealize(CPUState *cpu); +void accel_cpu_common_unrealize_unassigned(CPUState *cpu); /** * accel_supported_gdbstub_sstep_flags: diff --git a/accel/accel-target.c b/accel/accel-target.c index 08626c00c2..e0a79c0fce 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu) } } -bool accel_cpu_common_realize(CPUState *cpu, Error **errp) +bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); AccelState *accel = current_accel(); @@ -132,21 +132,22 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp) } /* generic realization */ - if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) { + if (acc->cpu_common_realize_unassigned + && !acc->cpu_common_realize_unassigned(cpu, errp)) { return false; } return true; } -void accel_cpu_common_unrealize(CPUState *cpu) +void accel_cpu_common_unrealize_unassigned(CPUState *cpu) { AccelState *accel = current_accel(); AccelClass *acc = ACCEL_GET_CLASS(accel); /* generic unrealization */ - if (acc->cpu_common_unrealize) { - acc->cpu_common_unrealize(cpu); + if (acc->cpu_common_unrealize_unassigned) { + acc->cpu_common_unrealize_unassigned(cpu); } } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2972f75b96..08769cf91e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1074,7 +1074,7 @@ int cpu_exec(CPUState *cpu) return ret; } -bool tcg_exec_realizefn(CPUState *cpu, Error **errp) +bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp) { static bool tcg_target_initialized; @@ -1094,7 +1094,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) } /* undo the initializations in reverse order */ -void tcg_exec_unrealizefn(CPUState *cpu) +void tcg_exec_unrealize_unassigned(CPUState *cpu) { #ifndef CONFIG_USER_ONLY tcg_iommu_free_notifier_list(cpu); diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 2090907dba..c08a6acc21 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -227,8 +227,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) AccelClass *ac = ACCEL_CLASS(oc); ac->name = "tcg"; ac->init_machine = tcg_init_machine; - ac->cpu_common_realize = tcg_exec_realizefn; - ac->cpu_common_unrealize = tcg_exec_unrealizefn; + ac->cpu_common_realize_unassigned = tcg_exec_realize_unassigned; + ac->cpu_common_unrealize_unassigned = tcg_exec_unrealize_unassigned; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/cpu-target.c b/cpu-target.c index 5af120e8aa..9ab5a28cb5 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -136,7 +136,7 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) /* cache the cpu class for the hotpath */ cpu->cc = CPU_GET_CLASS(cpu); - if (!accel_cpu_common_realize(cpu, errp)) { + if (!accel_cpu_common_realize_unassigned(cpu, errp)) { return false; } @@ -176,7 +176,7 @@ void cpu_exec_unrealizefn(CPUState *cpu) * Now that the vCPU has been removed from the RCU list, we can call * accel_cpu_common_unrealize, which may free fields using call_rcu. */ - accel_cpu_common_unrealize(cpu); + accel_cpu_common_unrealize_unassigned(cpu); } /* From patchwork Tue May 28 14:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F0FDC25B78 for ; Tue, 28 May 2024 15:01:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJQ-0000hv-6s; Tue, 28 May 2024 11:00:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJM-0000gM-DF for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:24 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJJ-000761-OP for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:24 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57883b25b50so1110572a12.2 for ; Tue, 28 May 2024 08:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908418; x=1717513218; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iWdKhFl+Kfc9kH+fAvMfcLuu2N/gX3v3c37S9xvC8gk=; b=AANWsm1+yRse2UmaT4asy9nzleVIFfbw0PmSIUfPAFLgDwrSgmFlHRRBlM3YeG3J7r qXQr/15yxUdgY9hJa3MJOAyeCDYSwywRIqLTQOFeckaAJlW7MhcVa4CyNGyy7aPhN2ho SljMbompI8WEiLHueycMXdBF+Fi/asPJNPSYE7DCq41cHmNgev5SPXhQ59J519mODvAf j65uOwjlZ1UcM2DMUKx09Hr5PAcufNM6GwK7eZxMrpC3ZsvbKvLei+X9fAkqp8MYrro6 P0hHO6yRtOHC13zrwDe/0W01tCG6XRTX41FaDT8hnsHwPHmGxwk9y65IQHk4LRFpoznz HM1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908418; x=1717513218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iWdKhFl+Kfc9kH+fAvMfcLuu2N/gX3v3c37S9xvC8gk=; b=TZdDQ6ZGkO7QMNxAnW762wkZ6hLYLdf4YuJUOTM0Yosul0bbEBVwTOj4/4U0rHgTFq sm/8Epqd/lZXvnbThmSeGlHb0X5/P5XlvsWwL40OhocfviDbrypR/nzfGnQt5jMYkbJF 8PNrpyFhfk/itD+n/2eOioXVbivyj327/0QxCikp5CPN7jrkeKjTr7++pHFdiBAaGOTC PrnE4q4i1g51F6ireMURYvk1IB0vuzAv+bQyfcVHGbXsDFbVXqUo1xLpZjw8JtqQDqjN zwCK2eGJbj+Az2ETX+4P8NUQl+vrBL/Ti2F171xI8rEkH7nkQe3aT9+tQCAw960Ozp99 9YlA== X-Gm-Message-State: AOJu0YwlsBi3YC74PMYBHR3bIoBBPUls9GnQGJ1ioh2n6pK0V/W9/4Fl RerBB8NTo0ebwo78FgZ8FZG7z7ZQZZQ0+mdZB++Ba1/OAintG4vYHEh+lTCBYvwhQtSU+sWRHnC H X-Google-Smtp-Source: AGHT+IHxwhWccnUxe3wniBKj9XUPnBr37FOvbrJuqFFxU3mwB+71MnSBGQo9+4DPLCy6IBXB7Bh0ug== X-Received: by 2002:a50:870d:0:b0:573:5c1c:4f5e with SMTP id 4fb4d7f45d1cf-578517a4197mr7201696a12.0.1716908417963; Tue, 28 May 2024 08:00:17 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5798d861b05sm4772771a12.25.2024.05.28.08.00.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 4/6] accel: Introduce accel_cpu_common_[un]realize_assigned() handlers Date: Tue, 28 May 2024 16:59:50 +0200 Message-ID: <20240528145953.65398-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=philmd@linaro.org; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Introduce handlers called while the vCPU has an assigned index and is still in the global %cpus_queue. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/accel.h | 20 ++++++++++++++++++++ accel/accel-target.c | 23 +++++++++++++++++++++++ cpu-target.c | 6 ++++++ 3 files changed, 49 insertions(+) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index dd18c41dc0..f828d32204 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -44,6 +44,8 @@ typedef struct AccelClass { hwaddr start_addr, hwaddr size); #endif bool (*cpu_common_realize_unassigned)(CPUState *cpu, Error **errp); + bool (*cpu_common_realize_assigned)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize_assigned)(CPUState *cpu); void (*cpu_common_unrealize_unassigned)(CPUState *cpu); /* gdbstub related hooks */ @@ -100,6 +102,24 @@ void accel_cpu_instance_init(CPUState *cpu); */ bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp); +/** + * accel_cpu_common_realize_assigned: + * @cpu: The CPU that needs to call accel-specific cpu realization. + * @errp: currently unused. + * + * The @cpu index is assigned, @cpu is added to the global #cpus_queue. + */ +bool accel_cpu_common_realize_assigned(CPUState *cpu, Error **errp); + +/** + * accel_cpu_common_unrealize_unassigned: + * @cpu: The CPU that needs to call accel-specific cpu unrealization. + * + * The @cpu index is still assigned, @cpu is still part of the global + * #cpus_queue. + */ +void accel_cpu_common_unrealize_assigned(CPUState *cpu); + /** * accel_cpu_common_unrealize_unassigned: * @cpu: The CPU that needs to call accel-specific cpu unrealization. diff --git a/accel/accel-target.c b/accel/accel-target.c index e0a79c0fce..b2ba219a44 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -140,6 +140,29 @@ bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp) return true; } +bool accel_cpu_common_realize_assigned(CPUState *cpu, Error **errp) +{ + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + if (acc->cpu_common_realize_assigned + && !acc->cpu_common_realize_assigned(cpu, errp)) { + return false; + } + + return true; +} + +void accel_cpu_common_unrealize_assigned(CPUState *cpu) +{ + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + if (acc->cpu_common_unrealize_assigned) { + acc->cpu_common_unrealize_assigned(cpu); + } +} + void accel_cpu_common_unrealize_unassigned(CPUState *cpu) { AccelState *accel = current_accel(); diff --git a/cpu-target.c b/cpu-target.c index 9ab5a28cb5..de903f30cb 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -143,6 +143,10 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) /* Wait until cpu initialization complete before exposing cpu. */ cpu_list_add(cpu); + if (!accel_cpu_common_realize_assigned(cpu, errp)) { + return false; + } + #ifdef CONFIG_USER_ONLY assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || qdev_get_vmsd(DEVICE(cpu))->unmigratable); @@ -171,6 +175,8 @@ void cpu_exec_unrealizefn(CPUState *cpu) } #endif + accel_cpu_common_unrealize_assigned(cpu); + cpu_list_remove(cpu); /* * Now that the vCPU has been removed from the RCU list, we can call From patchwork Tue May 28 14:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676952 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B863DC25B7C for ; Tue, 28 May 2024 15:01:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJT-0000id-VI; Tue, 28 May 2024 11:00:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJS-0000i7-9z for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:30 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJN-00078d-As for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:26 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a5d67064885so146589566b.1 for ; Tue, 28 May 2024 08:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908424; x=1717513224; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zWF1+LjOwHyVGVJbyrAhhwZo8V1u6vIK8N/LCyR6jZU=; b=l95LtmX4tXNiOC0AGpE+akSLkmuDfud8vzNpnGwt1uaFbfHBN0yEC2XvLdrScqgwft Jsw0j4+1Cln8ip7Ewou7S8IycRdtVvCM6deHucg6XW2CLmtXY7yyQ4041o77aWPBdlu5 z3MPKHkVddrmeRrJcpWfOFHv0gYD3z8ZqYyk2DnH1tE250smyCq6vwK5B+1U4Wty5rH8 Nm05p9C1KPittcbaZiomwTNeoi1umB6AbSWdr19Obtklg7uatHnUmpIe3V6Ti0YgZCON OLBiPdMMb0P76LmcSjbG9JgOsKRKbePuq1hcyCbdnxPGWx3t2GpNvaUVAmH1231kQEhC ADaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908424; x=1717513224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zWF1+LjOwHyVGVJbyrAhhwZo8V1u6vIK8N/LCyR6jZU=; b=eFBi3zAEHiSgFxzx+dOphbvVDKT7Aj9OOrW3Eaq+bxLyu2lR1EqP1ZX4Yl+R+0y+9s QPpuGJhnotEcJZIIyaVlAZ2GYdzWEmBBxsULOglHbXHDLbhOhA/5BIfekTIWjSSnjeCQ gLSMC61jojpbMqaxFgm3KFuk82h0jSjuPjce5voAODQCVsioG1l+KeyvUba30hG4sBsK gOGpn9z+x4nBQfbgx5+HC330ph+zLBZsAa65jxRRmzCNch2JrGNdAWyyYTRZX7H5Rx8x spKYEbGqsCvUdMQZmdrBFpb+tcmFo6qaPxXgIOdnViZbjpOoGlymatjJh27xJTzCXMjy /iaA== X-Gm-Message-State: AOJu0YxI4ys1zxzL37w8QQH4KfMOhmRFwYk9tL5VWzJqgXlUs36NAW8z xu1aly5aANTG0VQkHgK4TGeB3vYCqPe2lWGXzSus1unnAX9q7qQRLmYTxjayc1uOVvGL6VgxNzX Z X-Google-Smtp-Source: AGHT+IHNWTrI15G1eDqVz+vxK3M+54ElXygz0ON5eJNwThgTMQ1Qg87WnCbKBBDnUrmkqXYTT8u11w== X-Received: by 2002:a17:906:5784:b0:a63:7efd:8ec8 with SMTP id a640c23a62f3a-a637efd9bb7mr8040066b.70.1716908423651; Tue, 28 May 2024 08:00:23 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c97a1fbsm620973466b.92.2024.05.28.08.00.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 5/6] accel: Restrict TCG plugin (un)registration to TCG accel Date: Tue, 28 May 2024 16:59:51 +0200 Message-ID: <20240528145953.65398-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Use the AccelClass::cpu_common_[un]realize_assigned() handlers to [un]register the TCG plugin handlers, allowing to remove accel specific code from the common hw/core/cpu-common.c file. Remove the now unnecessary qemu_plugin_vcpu_init_hook() and qemu_plugin_vcpu_exit_hook() stub. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 2 ++ include/qemu/plugin.h | 6 ------ accel/tcg/cpu-exec-common.c | 27 +++++++++++++++++++++++++++ accel/tcg/tcg-all.c | 2 ++ hw/core/cpu-common.c | 25 ------------------------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index ec2c6317b7..d900897c6e 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -54,6 +54,8 @@ void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp); +bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp); +void tcg_exec_unrealize_assigned(CPUState *cpu); void tcg_exec_unrealize_unassigned(CPUState *cpu); #endif diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index bc5aef979e..d39d105795 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -221,12 +221,6 @@ static inline int qemu_plugin_load_list(QemuPluginList *head, Error **errp) return 0; } -static inline void qemu_plugin_vcpu_init_hook(CPUState *cpu) -{ } - -static inline void qemu_plugin_vcpu_exit_hook(CPUState *cpu) -{ } - static inline void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb) { } diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index bc9b1a260e..3c4a4c9f21 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -56,3 +56,30 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index = EXCP_ATOMIC; cpu_loop_exit_restore(cpu, pc); } + +#ifdef CONFIG_PLUGIN +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) +{ + qemu_plugin_vcpu_init_hook(cpu); +} +#endif + +bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp) +{ +#ifdef CONFIG_PLUGIN + cpu->plugin_state = qemu_plugin_create_vcpu_state(); + /* Plugin initialization must wait until the cpu start executing code */ + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); +#endif + + return true; +} + +/* undo the initializations in reverse order */ +void tcg_exec_unrealize_assigned(CPUState *cpu) +{ +#ifdef CONFIG_PLUGIN + /* Call the plugin hook before clearing the cpu is fully unrealized */ + qemu_plugin_vcpu_exit_hook(cpu); +#endif +} diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c08a6acc21..a32663f507 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -228,6 +228,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) ac->name = "tcg"; ac->init_machine = tcg_init_machine; ac->cpu_common_realize_unassigned = tcg_exec_realize_unassigned; + ac->cpu_common_realize_assigned = tcg_exec_realize_assigned; + ac->cpu_common_unrealize_assigned = tcg_exec_unrealize_assigned; ac->cpu_common_unrealize_unassigned = tcg_exec_unrealize_unassigned; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 0f0a247f56..fda2c2c1d5 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -30,9 +30,6 @@ #include "hw/boards.h" #include "hw/qdev-properties.h" #include "trace.h" -#ifdef CONFIG_PLUGIN -#include "qemu/plugin.h" -#endif CPUState *cpu_by_arch_id(int64_t id) { @@ -192,13 +189,6 @@ static void cpu_common_parse_features(const char *typename, char *features, } } -#ifdef CONFIG_PLUGIN -static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) -{ - qemu_plugin_vcpu_init_hook(cpu); -} -#endif - static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu = CPU(dev); @@ -222,14 +212,6 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) cpu_resume(cpu); } - /* Plugin initialization must wait until the cpu start executing code */ -#ifdef CONFIG_PLUGIN - if (tcg_enabled()) { - cpu->plugin_state = qemu_plugin_create_vcpu_state(); - async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); - } -#endif - /* NOTE: latest generic point where the cpu is fully realized */ } @@ -237,13 +219,6 @@ static void cpu_common_unrealizefn(DeviceState *dev) { CPUState *cpu = CPU(dev); - /* Call the plugin hook before clearing the cpu is fully unrealized */ -#ifdef CONFIG_PLUGIN - if (tcg_enabled()) { - qemu_plugin_vcpu_exit_hook(cpu); - } -#endif - /* NOTE: latest generic point before the cpu is fully unrealized */ cpu_exec_unrealizefn(cpu); } From patchwork Tue May 28 14:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13676954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D9C8C25B78 for ; Tue, 28 May 2024 15:02:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJY-0000jV-5L; Tue, 28 May 2024 11:00:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sByJW-0000j8-1Y for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:34 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJU-00078y-CU for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:33 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5295f201979so1055197e87.2 for ; Tue, 28 May 2024 08:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908429; x=1717513229; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=U5WlW2S6zWgelvtLovxI/v4ub50XSEMhTdcTCwQHDVH1YF1Ibs7qjpC+6QIwXQssjF l1KigkKv1vTJ8oIl9DBOyynkUA5ZtvZB0QZIEFM15Ig8NhPENFM/a7wDRXeDbzpxjCK8 s/TPwtyTFW9t/uYd8btdp1y2Km80Qbd8uBGaLkS7OSGxWwNMr/wAqWW4qC160E0eLAdW 5Wu/DcDl7AneoTJAbFm9tpc7UIrGIcPvhtSk1HvWGGhp2tvi3fJxTDjKVflutrGhUjZ/ VpG90SRMmKCNfz7qykoC0ZftnSOMxHVuAx++FreJw3Yf5slMUjdjWVoaMtUW+ZdOSGEP +0BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908429; x=1717513229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=tGwWn+8p+TlB+CUmwl1+B3D7vyJsSdA2PcYCFTdx01aDVZyzCBUSK/brZeMdXh1wf0 UziJE5ZujXMhYAC4VVedixAo5813lGbD3W9XnAqsNpT5IExZxREiIxjZwCqJh0BrEDMi bbVFG0REJ1tGCWh6x+090frwerQT3kAhHTNVFy7cM7W+pDZ1yTobGDJCiAG094GaPMmd m0KupU4BGHQIGHqK6Kx4rwdYxOL4WAa3VMhRk0hnMICDyLQTC30azVnkoOJnNvX/PF8P KxsWE7v13GbvtUemx6Ez52vzyn4HocCiVAvU8rG9RJ2esVm6n0zLoeYZVUQc10ItwEpJ Kc4w== X-Gm-Message-State: AOJu0YwKXNO8sVzDs3qML+OCJPG/SFTRoCdOG2KzPW84C9OYAx0UD/E6 CY89P/WALX7TJk9mD+w7mE8At6jY8qZixKcog3xH4/rixEiS255cmbXSIby7pY5yuR6feVqXekw 9 X-Google-Smtp-Source: AGHT+IGeYA1BZtkeWhNA6Lx+7kLkCJ57cTtE63409GLF7cKVa/bTw40tpfc7j+6F0EDDMCgj8OfmMQ== X-Received: by 2002:ac2:4acf:0:b0:529:593f:3f3c with SMTP id 2adb3069b0e04-529666d5dfemr8138200e87.53.1716908429187; Tue, 28 May 2024 08:00:29 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4feadsm617200466b.127.2024.05.28.08.00.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 6/6] accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/ Date: Tue, 28 May 2024 16:59:52 +0200 Message-ID: <20240528145953.65398-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Calling qemu_plugin_vcpu_init__async() on the vCPU thread is a detail of plugins, not relevant to TCG vCPU management. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec-common.c | 11 ++--------- plugins/core.c | 8 +++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 3c4a4c9f21..02499bfb1d 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -57,19 +57,12 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu_loop_exit_restore(cpu, pc); } -#ifdef CONFIG_PLUGIN -static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) -{ - qemu_plugin_vcpu_init_hook(cpu); -} -#endif - bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp) { #ifdef CONFIG_PLUGIN cpu->plugin_state = qemu_plugin_create_vcpu_state(); - /* Plugin initialization must wait until the cpu start executing code */ - async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); + + qemu_plugin_vcpu_init_hook(cpu); #endif return true; diff --git a/plugins/core.c b/plugins/core.c index 0726bc7f25..0eda47ba33 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -245,7 +245,7 @@ static void plugin_grow_scoreboards__locked(CPUState *cpu) end_exclusive(); } -void qemu_plugin_vcpu_init_hook(CPUState *cpu) +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) { bool success; @@ -261,6 +261,12 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); } +void qemu_plugin_vcpu_init_hook(CPUState *cpu) +{ + /* Plugin initialization must wait until the cpu start executing code */ + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); +} + void qemu_plugin_vcpu_exit_hook(CPUState *cpu) { bool success;