From nobody Sat Nov 15 16:32:55 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=1750458024; cv=none; d=zohomail.com; s=zohoarc; b=O1vhoD9Hgj6WDFTGNqVTxtt0SGtlzKRLr8/Omld4uX0GBwrBtbNQi5oyJAZhDPW1xi1CYnNSQAbJDDCt6Nlnp85cO6GeKaUaDUkO12ZvqDMioV3Od5paLh/jqt20imDx0mC5yfnDO0S78NMff8q0IWLV4LpNjI9TcTQCUN5Z31A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750458024; 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=15D3isY4l+uwS25oxkiN7c++y0O/h98h4xMzv+uZTLM=; b=dH2QD7rmruHdAtliiECVy8mIcoLt34xu11jtFUfKuQhFr05YvM7bMJZoQna+aNxdSZ3cczRRn13tAC81AnCPsLBOVYmGF7niZ0+I+//8o7YW8vHxKjPOZE5i5TlUeaIqos77DQ9qeaWjO016ez4clkcEkyl/neun8rIdjmnvi6c= 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 1750458024596521.2283672905845; Fri, 20 Jun 2025 15:20:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSk4P-0000mJ-1Y; Fri, 20 Jun 2025 18:18:50 -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 1uSfKL-000122-CJ for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:15:00 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSfKE-0004FL-Jd for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:14:54 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3a57c8e247cso1802339f8f.1 for ; Fri, 20 Jun 2025 10:14:48 -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-453632312a3sm41221035e9.1.2025.06.20.10.14.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jun 2025 10:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750439687; x=1751044487; 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=15D3isY4l+uwS25oxkiN7c++y0O/h98h4xMzv+uZTLM=; b=dw9divZfakRx3L/ZXpqX0ATIauP+zS0lMTH3kA1UEg69eVt7jVCP1uVr76liIbzVun C4U5RJ3BB1QS44jCSLi5Ro/B30yK6pcPAqNMuijnpbTHA+krCbqxvEyeHKkloXb7sbFo SiIddZbdXe28WosQPNpB2wG0LPipHk3QRzYtd2ejqR481bxkvOI8GkN5eXRE/9U7oG3r aj1V0TUdRT9xobhz0/6gn+MVOpdWsYCgaBlfoPxLjT5n6XjGOkoyMkCi2G2TceMOZzsY Z6Sru/jE6y4wjFdG+kDXJZnKnAiIDW2b7JoruWCG1dTcQGRoQnQQMQfOKSfPyExrqRDq OC3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750439687; x=1751044487; 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=15D3isY4l+uwS25oxkiN7c++y0O/h98h4xMzv+uZTLM=; b=XvcvxEczHbHpgfqWNdl1FEAgCw9PjLLFzbYgiFkMMATIsiIT4QgtsC8SSxVG93qPST YMX+urV2lKhqBcZ98WUXQAtjhgEVc2vYeLQbgfbf79hC2YiAB0LV/pnwgFuxXK7Zzkyd e85ADaxHeq4pBfeadopwn3LfJNmIsLbzvSkdvhJrNidyEaJ+8Rnx4Y+fSDQAscbbFHDP siFSTF3aBoTPiUAvkcfHGafFVUMBZc0tfi4mebcb5vuqYqYJUs++GTV149p/aYw2wnW/ 5KhU35OhKN1Udl3lFv8UvlgVbnfGZNAAXyiXinAYkCxgEG6neKRo4hIpB+bykumfmGb+ sAXQ== X-Gm-Message-State: AOJu0YySh9aEe5XGtfeMUGzEcNc6fdYzbSu2jREfAdhyPgj1vBGeYq6+ 7WjEdeaeBZ/DtPomFQyu8qSLDA7ZLXOzs6xlH+ClPW0kaTFbuQSVA/nVYRPiyP0ncUafits/+p/ F9XWw3D4= X-Gm-Gg: ASbGncsqcXdz7FnBzRaBx+aR93xCEC3RswheZlmR6p1BqAWre66NRgK3/ZzpXxSpba7 7utNFnVSA3P8UopX6w3dd1jKzXIh2pg8O86T09pKLbXTEUJbDUAmVjrtcJ95n/VziojgdXmPqxI Gzx2OBrtzjM89i2FZzwcZLA1LM99fnPA+XaJLO9fjaRCuxsP5YA6n1xrweAcLDFB9Hrx8r/hm9L kchKZq5KxaAQWHblz+n9qwt4Jc8rM2D6mHKdwhTn2mvfvv9m3gltCTQOXI+eUdQJ9anf3E07Reu hsvq2EpTHj85hxgLxlr+lDtiyZepgJUphHkC19shWEoFOY6iJBdw7NsShRS3iVQ+eUOc9PYNin6 Bw8tvnr2Gi8qQcsgy3GWAnCF4Wh8BcG+3gC+5 X-Google-Smtp-Source: AGHT+IHExyLiz2129GUCSXtaD+vCib6+sbpI5YJ0gJYGGhiF/JKuIudRNmVOpZu05vpSTsPs3M109Q== X-Received: by 2002:a05:6000:4917:b0:3a4:fa09:d13b with SMTP id ffacd0b85a97d-3a6d1333f71mr3804288f8f.59.1750439687161; Fri, 20 Jun 2025 10:14:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexander Graf , Richard Henderson , Pierrick Bouvier , Peter Maydell , Thomas Huth , Cameron Esfahani , Julian Armistead , Paolo Bonzini , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH v2 13/48] accel: Move cpu_common_[un]realize() declarations to AccelOpsClass Date: Fri, 20 Jun 2025 19:13:06 +0200 Message-ID: <20250620171342.92678-14-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250620171342.92678-1-philmd@linaro.org> References: <20250620171342.92678-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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: 1750458025083116600 AccelClass is for methods dealing with AccelState. When dealing with vCPUs, we want AccelOpsClass. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qemu/accel.h | 2 -- include/system/accel-ops.h | 2 ++ accel/accel-common.c | 10 ++++++---- accel/tcg/tcg-accel-ops.c | 3 +++ accel/tcg/tcg-all.c | 2 -- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 04d252d3d65..aee0a2e3309 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -41,8 +41,6 @@ typedef struct AccelClass { AccelOpsClass *ops; =20 int (*init_machine)(MachineState *ms, AccelState *as); - bool (*cpu_common_realize)(CPUState *cpu, Error **errp); - void (*cpu_common_unrealize)(CPUState *cpu); =20 /* system related hooks */ void (*setup_post)(MachineState *ms, AccelState *accel); diff --git a/include/system/accel-ops.h b/include/system/accel-ops.h index d854b84a66a..fb199dc78f0 100644 --- a/include/system/accel-ops.h +++ b/include/system/accel-ops.h @@ -34,6 +34,8 @@ struct AccelOpsClass { /* initialization function called when accel is chosen */ void (*ops_init)(AccelClass *ac); =20 + bool (*cpu_common_realize)(CPUState *cpu, Error **errp); + void (*cpu_common_unrealize)(CPUState *cpu); bool (*cpu_target_realize)(CPUState *cpu, Error **errp); void (*cpu_reset_hold)(CPUState *cpu); =20 diff --git a/accel/accel-common.c b/accel/accel-common.c index 1d04610f55e..d1a5f3ca3df 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -102,10 +102,12 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **= errp) } =20 /* generic realization */ - if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) { + if (acc->ops->cpu_common_realize + && !acc->ops->cpu_common_realize(cpu, errp)) { return false; } - if (acc->ops->cpu_target_realize && !acc->ops->cpu_target_realize(cpu,= errp)) { + if (acc->ops->cpu_target_realize + && !acc->ops->cpu_target_realize(cpu, errp)) { return false; } =20 @@ -118,8 +120,8 @@ void accel_cpu_common_unrealize(CPUState *cpu) AccelClass *acc =3D ACCEL_GET_CLASS(accel); =20 /* generic unrealization */ - if (acc->cpu_common_unrealize) { - acc->cpu_common_unrealize(cpu); + if (acc->ops->cpu_common_unrealize) { + acc->ops->cpu_common_unrealize(cpu); } } =20 diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 07b1ec4ea50..95ff451c148 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -46,6 +46,7 @@ #include "tcg-accel-ops-mttcg.h" #include "tcg-accel-ops-rr.h" #include "tcg-accel-ops-icount.h" +#include "internal-common.h" =20 /* common functionality among all TCG variants */ =20 @@ -212,6 +213,8 @@ static void tcg_accel_ops_init(AccelClass *ac) } } =20 + ops->cpu_common_realize =3D tcg_exec_realizefn; + ops->cpu_common_unrealize =3D tcg_exec_unrealizefn; ops->cpu_reset_hold =3D tcg_cpu_reset_hold; ops->insert_breakpoint =3D tcg_insert_breakpoint; ops->remove_breakpoint =3D tcg_remove_breakpoint; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 164bba41ed9..28206ca5e76 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -244,8 +244,6 @@ static void tcg_accel_class_init(ObjectClass *oc, const= void *data) AccelClass *ac =3D ACCEL_CLASS(oc); ac->name =3D "tcg"; ac->init_machine =3D tcg_init_machine; - ac->cpu_common_realize =3D tcg_exec_realizefn; - ac->cpu_common_unrealize =3D tcg_exec_unrealizefn; ac->allowed =3D &tcg_allowed; ac->supports_guest_debug =3D tcg_supports_guest_debug; ac->gdbstub_supported_sstep_flags =3D tcg_gdbstub_supported_sstep_flag= s; --=20 2.49.0