From patchwork Fri Jun 20 17:13:06 2025 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: 898373 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f54:0:b0:3a4:ee3f:8f15 with SMTP id cm20csp1560538wrb; Fri, 20 Jun 2025 15:20:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/koC7qXjsoY6n5AV54gq7FtfKq7THXH7K0HRMU8ORJx6tHhtyIlYDXSvChEH470pz0TcizQ==@linaro.org X-Google-Smtp-Source: AGHT+IGvfFoh/DacBGVhgsJaxQq4s9KGFJucoMb1o0abkRS6QHJo0kFRIJiZhJUkmuw7A9VVUSYA X-Received: by 2002:a05:620a:1a20:b0:7cd:565b:dbc9 with SMTP id af79cd13be357-7d3f9935137mr615349585a.26.1750458023960; Fri, 20 Jun 2025 15:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1750458023; cv=none; d=google.com; s=arc-20240605; b=kq3hKurfOrsi5GkZ4eWV6BwOzT2cXVUWmRwaa8TsTrfAke9IKAZ77H93MEhJR9kq5z 8QG5V13wBmyeJPPJzPFYUNpy5vxN8LI1s5Bbj+tJAJS1pb8lu57UooTmNXsRnN3Sbm2p ZAWACIT5jTGgPOlMMTK7CrU8TYsk5cIXWxzovxIo8QboZHUDmob0YDlvTrgQ4uhyXxIU BNl35qatjcHVp87pv/NS2i298nPeNrY/KmZ7hPy9K0mSSCffOzOXPKoXXtpxGINriJ88 MWDNzXoOhuQMpAQ8y/iXkFsAQBA99EMIxeLGm+XN3t7l6O04S8jIEklxV8LFkwz5VKge 1Xvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=15D3isY4l+uwS25oxkiN7c++y0O/h98h4xMzv+uZTLM=; fh=8f2AL0Su0K9UlZksY2EEcc9O+An+AQ/T/SEdbs2pdSA=; b=L84lbPCR1GKsxd0gvC9a1msnZhkN3FvAzd0wa552l0ZLDcWtegxRpHfu+LuhKOy7yD A7ZpWl/Z+OaUaM2jyhrxGlMTgPTx2AloLtCp/CCom4UgIyv93GPu/ImIoyX2oN4LLFSa 5G/5Ey0cr0kAlc3WL8Qk2mSO0P0ao5vc6NUjk8f+3M3ymK5qFEKVJmlkdAcqn6buX7ue LN2akGJt4slTH2CoABDVJQy3+MkE+LzYmfN/UTt8iH+br3oC+GF6St+WXQR6rVGX5m9g n8qrdD9ofKFn7g5Hpf1RUrb/H0QcojjvfBzofygVezd8DdPX3dYqPy+yfBZTa5GzGEs+ HNSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dw9divZf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7d3f9a1f2c8si250476485a.583.2025.06.20.15.20.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jun 2025 15:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dw9divZf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=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_Mathieu-?= =?utf-8?q?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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org AccelClass is for methods dealing with AccelState. When dealing with vCPUs, we want AccelOpsClass. Signed-off-by: Philippe Mathieu-Daudé 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; int (*init_machine)(MachineState *ms, AccelState *as); - bool (*cpu_common_realize)(CPUState *cpu, Error **errp); - void (*cpu_common_unrealize)(CPUState *cpu); /* 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); + 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); 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) } /* 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; } @@ -118,8 +120,8 @@ void accel_cpu_common_unrealize(CPUState *cpu) AccelClass *acc = ACCEL_GET_CLASS(accel); /* generic unrealization */ - if (acc->cpu_common_unrealize) { - acc->cpu_common_unrealize(cpu); + if (acc->ops->cpu_common_unrealize) { + acc->ops->cpu_common_unrealize(cpu); } } 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" /* common functionality among all TCG variants */ @@ -212,6 +213,8 @@ static void tcg_accel_ops_init(AccelClass *ac) } } + ops->cpu_common_realize = tcg_exec_realizefn; + ops->cpu_common_unrealize = tcg_exec_unrealizefn; ops->cpu_reset_hold = tcg_cpu_reset_hold; ops->insert_breakpoint = tcg_insert_breakpoint; ops->remove_breakpoint = 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 = 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->allowed = &tcg_allowed; ac->supports_guest_debug = tcg_supports_guest_debug; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags;