From nobody Sat Nov 15 16:34:20 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1750681349; cv=none; d=zohomail.com; s=zohoarc; b=SdKoiYq5ZBL7aK9E7q+8tnsxDNrxXRbo9xME5r6o1510LUx8Td2iJlyZeTpWgCgG+sv+ogdeXsl4wlQV8K0e+h1MncWfQflcfxE2f+n2bLNg3yb09qmWTlj+8ZFjoQRhLQ7NeB94Si/0OcZsn3szzDDhoYZozkErvV46d4wM5gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750681349; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FOQFF5IHVggEpZxvhH4Dg2y5NDppFE2+idPk4kXeUTw=; b=nXspc0jo4gJdyDCMUpQfzOh8FjUxidkPWUwRN45p/An2o2rxUvboVPru9VV48I9jlt/sIIFsLZ0sSm2xl5hevdbi+YHGvM3CfeOJuSAncXkcBQegl8Gyl7OR783iUR9M6wy+wThLBYhuiJKMu7ffMV1wYDBCaug4LeH1FABNZzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750681349403506.6563730416451; Mon, 23 Jun 2025 05:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uTg9v-0001tC-UR; Mon, 23 Jun 2025 08:20:25 -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 1uTg9b-0001nK-SD for qemu-devel@nongnu.org; Mon, 23 Jun 2025 08:20:04 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uTg9Z-0000eP-Et for qemu-devel@nongnu.org; Mon, 23 Jun 2025 08:20:03 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-450ce3a2dd5so39605965e9.3 for ; Mon, 23 Jun 2025 05:20:00 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4535e983a4bsm143750295e9.13.2025.06.23.05.19.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 23 Jun 2025 05:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750681199; x=1751285999; 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=Lg93oGuIPq0JN46UiRmfrBt6QAv3GHEnlERsl4GztJMG0oxnIYxt1cn71Q//y69X8d 3+Ds9QPyt3nRcmgjRdKNBXLJ34ou2/onU+3t4dq8XobTh/GmNbkzer6IUsYIfZmTWGvv f9tQ/USw+bg1z0cuxbOoPiwi0Cx7HOXWhnCN7Jq2m6EgUakE3gaVVxry4vrNFUCutMYZ 818vdcbKlPErsyhVpFWR5oULt1RJkoIQ+bFNxLM9D3jV85TFXnNb4OB14/K8cH3lIrhF DS2Lb5R550PRUthJIghrHVt5qVJ/o095lVGcUaSqO/rWyjCcnoKIekgnVyQROJl7EpPs 1wyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750681199; x=1751285999; 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=XLEgrwYqK0tnnARd9qCy2U+4Mh1cIuBm2TSyOeE4S7vmpKqjZgdtnmkGz00K+ItBx1 PQfEgAC9wWt0edkcvBIQmAm2qpuRGgfTL5tVLj3ngwO7HV99efHBKOJJ0aMWXDFhCJLA obWQjBdgjhjF9jJ72YGqQ2aiwS4NCYnJyCqE+7GG3JFXa024k7Y6GlqF/qe+zZNN3+O+ JEoql4dHvZGnq7BETsg+6y9nN2yqhDjBOn2v5lJNaa45RVsPDG5ZQGVGY8/kzfsPv3i9 /4qLvi++gBVitvj3+tRzuKW5rDNMvnqJy7sIrClFrVnbOtu9dse+t27XWbOkiZzGxaTi xqXA== X-Gm-Message-State: AOJu0YzsAXD/Djml0o7n2iJRHxkCsPdVpzRm5K4XSranCSLMwt6jY+Pw 6KJFRQXnnYh6fKQMtlCGihrYr0drFP95ZwXkwWg1esF0R3Yl++XfmaeID/aAui38fFZ7fqwLH8c pluTu X-Gm-Gg: ASbGncsw7C4QaDzwmab2iUCALxnQJkdtsIvFFEvTsK+EsoFdr5A8dF/I2bNB4Oe3tQq TYmHsGj8SydvHVypHMOgY4793BCuXbI0u4VqOqZeFXebKjStH3G2Vl09CbYBap7GXxcKo/gsRp+ 8cZzUb9MKGECbKwt1fgctYKmfizWg3XEfwehCtoxYpsL+zHZbvDfto0tjjYNjV8CMdjDShFHeTX DxhaHN5qllREsrVo1KyUydgLgBMJj9nY+Xj5EeDgc2+gN5oHFYZj/91qLduvuDk6Dz8sUEisv1z ullNRUmycuvQEm/AZ7fUxQXLAihv9SPd0UYi3YkTJGm+1CjoCnQwF5ZFW5jf168ILQj1SbN9uHI /CsASLNO3RZPmbXQZxrFWTNyKEpNJxowCaxXk X-Google-Smtp-Source: AGHT+IFwQfth961QDPwmcQSOPunexZxZtRH6B1UX0+3skNQVMIAOIVx+CTDwFZCmfuogwrFQqEjVTQ== X-Received: by 2002:a05:600c:1c28:b0:442:ccf0:41e6 with SMTP id 5b1f17b1804b1-453656c2172mr118658905e9.3.1750681199364; Mon, 23 Jun 2025 05:19:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Leif Lindholm , qemu-arm@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Roman Bolshakov , Paolo Bonzini , Alexander Graf , Bernhard Beschow , John Snow , Thomas Huth , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kvm@vger.kernel.org, Eric Auger , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Cleber Rosa , Radoslaw Biernacki , Phil Dennis-Jordan , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 14/26] accel: Keep reference to AccelOpsClass in AccelClass Date: Mon, 23 Jun 2025 14:18:33 +0200 Message-ID: <20250623121845.7214-15-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623121845.7214-1-philmd@linaro.org> References: <20250623121845.7214-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1750681351222116600 Allow dereferencing AccelOpsClass outside of accel/accel-system.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- 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 >*/ =20 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 =20 +#include "qemu/accel.h" #include "exec/vaddr.h" #include "qom/object.h" =20 @@ -31,7 +32,7 @@ struct AccelOpsClass { /*< public >*/ =20 /* initialization function called when accel is chosen */ - void (*ops_init)(AccelOpsClass *ops); + void (*ops_init)(AccelClass *ac); =20 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" =20 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 =3D ACCEL_OPS_CLASS(oc); + ac->ops =3D 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); } =20 -static void tcg_accel_ops_init(AccelOpsClass *ops) +static void tcg_accel_ops_init(AccelClass *ac) { + AccelOpsClass *ops =3D ac->ops; + if (qemu_tcg_mttcg_enabled()) { ops->create_vcpu_thread =3D mttcg_start_vcpu_thread; ops->kick_vcpu_thread =3D mttcg_kick_vcpu_thread; --=20 2.49.0