From mboxrd@z Thu Jan 1 00:00:00 1970 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 B37BBC71155 for ; Fri, 20 Jun 2025 13:09:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSbUB-0003r9-CP; Fri, 20 Jun 2025 09:08:51 -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 1uSbTu-0003PY-Tr for qemu-devel@nongnu.org; Fri, 20 Jun 2025 09:08:35 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSbTt-0004i6-2D for qemu-devel@nongnu.org; Fri, 20 Jun 2025 09:08:34 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43edecbfb94so19353935e9.1 for ; Fri, 20 Jun 2025 06:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750424911; x=1751029711; 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=FOQFF5IHVggEpZxvhH4Dg2y5NDppFE2+idPk4kXeUTw=; b=HD547D2cRSJR1yXZHA5T5BCfRD26PLgmRY5qpw36Wxl38LYMgTTAXPCv0HAC1FLP/b 8s8Ws+LUcsPfQP9Eg/Uy62YvMmPnUEUAz1pvxtqXK2bRBleMwjh/mD874YBTMdtUrhRn zXPy/qRzM1ZC1F0odVHi4nwktiw+k6M+0XKLu7xv0thP9WLRXwdTfjIr/jGHS6THnxzp AbajDcGAfLkHfdcxZJ8GAiy+sONvRoYv6IspDikP4U5oN1vE4yudwVHgvamYPgCggGqH vthjkqR9zPN1x81UoIzQmLrrgLBJDLl0nCqz898weZlQKVNscm7EiXsuIT4OKzWrztdZ 2EUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750424911; x=1751029711; 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=FOQFF5IHVggEpZxvhH4Dg2y5NDppFE2+idPk4kXeUTw=; b=l9GmcyrCKsx8aRhOi2a7SFiIWhakLy9CRzibWPLVOM2QPGycfk8bnq17f83opwvEiK vzJVhPdAbTlIHV2/T4RktvJx8vGLkeNlcTGVS8Rk5Odc34TVTD14lyEYpNfZvnAXV9Rv TrU23o1AxokgbbN4+EG+UDECbBsWWLYg9fxUAZw/9SWrEI6cwHZb4bGbvjvXzImhXLa5 jJOhT/FckQBDz2vQoZjBnYhsx2D5IErUQFwvR3FCK8ECNdS1AltTcIzj8YNglMsHDNqd qKFLd5vU4d9Tw9TCA7FnAjuMvuV9sJ8N0HsP4KlcY6nVARPG3OnpBhSuWq1igOIDHcAm 1TRg== X-Gm-Message-State: AOJu0Yxf4x/MnlB8xBKMdxXDH4J7c6c+5Nnf1G71UQSSWScsE2AM1W0F OoUvzZwFkFHReM/Dn27589nbFjH2aLyMd9F4DckQ5SVQre0AmuMvp0JFzKyMSXHaBNLnsi79yXz FFwJI1ao= X-Gm-Gg: ASbGncv2bTSY6+Ghmn8oF+DeNwb2BKYsxJqDiVQPxRPpZL61pcIxzkI0Tep6ISarzX0 Ub+gtBBAKP+9MiJtsYm7F8DLNM0/bdF1M7q8jBPf/KDuncciAZYlbC16ZRa5Qm28Vg7oKZIN2JM y9P80UtBVXJuvKA6f90fUmfipa4smhUFB2YFNbmaka9sCe3RCaBG9ruS5f5uFsS6tX6xmDrgiAW aW9NhFR5ZCeBm8D9Bft4llYGYmbu0wo6yQXXArSd/1hGZvCD6nwRiL87XeaRlwYfQKkPn/q8VpB E0nci1jlLC1qwwj5jFNczfJqdNk+RD/HkiZARB+hkUYeGHFHA2DdQGcsJL97ZWTrIIuEcik/e4p zqn+R6GwPq3m8lYI77HhYv0KJo3gxUCMvlcF8 X-Google-Smtp-Source: AGHT+IG5VJ2wmm6aaoN33zTA0rvHD7SHc9CVgH1xuOcv58TCSdw7oIYTR3igTV8EZ3sVBVJ+FyYcCw== X-Received: by 2002:a05:6000:98f:b0:3a5:24a9:a5d3 with SMTP id ffacd0b85a97d-3a6d12a41ebmr2293268f8f.17.1750424911290; Fri, 20 Jun 2025 06:08:31 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a6d117c0f1sm2083859f8f.53.2025.06.20.06.08.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jun 2025 06:08:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Phil Dennis-Jordan , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Bernhard Beschow , Cleber Rosa , Peter Maydell , Cameron Esfahani , kvm@vger.kernel.org, qemu-arm@nongnu.org, Eric Auger , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Roman Bolshakov , John Snow Subject: [PATCH v2 14/26] accel: Keep reference to AccelOpsClass in AccelClass Date: Fri, 20 Jun 2025 15:06:57 +0200 Message-ID: <20250620130709.31073-15-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250620130709.31073-1-philmd@linaro.org> References: <20250620130709.31073-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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 autolearn=unavailable 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 Allow dereferencing AccelOpsClass outside of accel/accel-system.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- include/qemu/accel.h | 3 +++ include/system/accel-ops.h | 3 ++- accel/accel-common.c | 1 + accel/accel-system.c | 3 ++- accel/tcg/tcg-accel-ops.c | 4 +++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index fbd3d897fef..9dea3145429 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -37,6 +37,9 @@ typedef struct AccelClass { /*< public >*/ const char *name; + /* Cached by accel_init_ops_interfaces() when created */ + AccelOpsClass *ops; + int (*init_machine)(MachineState *ms); bool (*cpu_common_realize)(CPUState *cpu, Error **errp); void (*cpu_common_unrealize)(CPUState *cpu); diff --git a/include/system/accel-ops.h b/include/system/accel-ops.h index 4c99d25aeff..44b37592d02 100644 --- a/include/system/accel-ops.h +++ b/include/system/accel-ops.h @@ -10,6 +10,7 @@ #ifndef ACCEL_OPS_H #define ACCEL_OPS_H +#include "qemu/accel.h" #include "exec/vaddr.h" #include "qom/object.h" @@ -31,7 +32,7 @@ struct AccelOpsClass { /*< public >*/ /* initialization function called when accel is chosen */ - void (*ops_init)(AccelOpsClass *ops); + void (*ops_init)(AccelClass *ac); bool (*cpus_are_resettable)(void); void (*cpu_reset_hold)(CPUState *cpu); diff --git a/accel/accel-common.c b/accel/accel-common.c index 4894b98d64a..56d88940f92 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "qemu/accel.h" #include "qemu/target-info.h" +#include "system/accel-ops.h" #include "accel/accel-cpu.h" #include "accel-internal.h" diff --git a/accel/accel-system.c b/accel/accel-system.c index a0f562ae9ff..64bc991b1ce 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -85,8 +85,9 @@ void accel_init_ops_interfaces(AccelClass *ac) * non-NULL create_vcpu_thread operation. */ ops = ACCEL_OPS_CLASS(oc); + ac->ops = ops; if (ops->ops_init) { - ops->ops_init(ops); + ops->ops_init(ac); } cpus_register_accel(ops); } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index b24d6a75625..da2e22a7dff 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -198,8 +198,10 @@ static inline void tcg_remove_all_breakpoints(CPUState *cpu) cpu_watchpoint_remove_all(cpu, BP_GDB); } -static void tcg_accel_ops_init(AccelOpsClass *ops) +static void tcg_accel_ops_init(AccelClass *ac) { + AccelOpsClass *ops = ac->ops; + if (qemu_tcg_mttcg_enabled()) { ops->create_vcpu_thread = mttcg_start_vcpu_thread; ops->kick_vcpu_thread = mttcg_kick_vcpu_thread; -- 2.49.0