From nobody Sat Nov 15 15:28:47 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=1751380950; cv=none; d=zohomail.com; s=zohoarc; b=TtjUUp3tGwYFGR12ntQpMwyFJdZwPL6caLztDzRNSz6q4yHkb6v5uPJoNjbnvH8Uu5E2eyRjR1opZ0IbdTvksXvnKw6JY8hfp+TinFAZi4JKO/66kb2YiB7CiMEKZQI2tgWUIC11QZGneGIj5nCXJhOV4ugcGpmmuKxW17wShU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751380950; 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=tiAozws8tEvciTyM03dNvOF05xDSKHeJvqFBf9JQPcw=; b=Fko95GSJ6734Ci8bPK3jhrzXHLgfMIhMCEdqdWMo1OG7GqFbzOm469xLXs+igaZ0Y2l9D/cyVA7dHZspEkTXF7+0C3fmtG0B2pNz8xyo/R5/enO5DgnzMsEO51De0zm39eX1ITyy/NDKnV3Q9S9cUT6v3tB19OssilNb3HlpNQ4= 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 1751380950885524.6360266058833; Tue, 1 Jul 2025 07:42:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWcAi-0005rT-3m; Tue, 01 Jul 2025 10:41:20 -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 1uWcAg-0005qt-Nl for qemu-devel@nongnu.org; Tue, 01 Jul 2025 10:41:18 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWcAZ-0006sA-O7 for qemu-devel@nongnu.org; Tue, 01 Jul 2025 10:41:18 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4537edf2c3cso57397965e9.3 for ; Tue, 01 Jul 2025 07:41:10 -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-4538a3b2fd7sm171041615e9.17.2025.07.01.07.41.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 01 Jul 2025 07:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751380868; x=1751985668; 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=tiAozws8tEvciTyM03dNvOF05xDSKHeJvqFBf9JQPcw=; b=KQjVP1HXV7QLHhChclZSdvGizj3LQ5+5Gqp7TbYuK2MMcA+ulwhGY7GxvEJvAks9N7 gGrYOy5q8noNCmL7H6V1GGh/uijSdSwzP2s5MzN+ncwBLgT5KoWtflcnvyf+UmN4svjl DJ4zcHZiMy4PKEkOXOjkWNSpc/Z04WNiRQhP6JmHxe2cZO1haSCk182yeXOhZXHECqCy xPpcmIweqvPf2mePObZx2sj9q2a8MrXex685cnSjI0lAilyNIudZ1KCU7eBwkNupD0lo ma75+TxNoeVT044M4m8xopnHe29Z93KVt3Yn9ZS0z/urh3AvbhbUV7OL5Vo7NQXxG4tR TOIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751380868; x=1751985668; 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=tiAozws8tEvciTyM03dNvOF05xDSKHeJvqFBf9JQPcw=; b=OCF8gWfkew5HbRV61M1GD5pRC3YQZvpPiNslogL9410W2As6d39qGbmZRHWU43Q2WB 5K25A0yUA38HmMQhgJCztCBsfPPeqsixDTnZ5u9O0FDxiadX7jKhYaqn6pqoqkLoI+lh meiInduyd3Oa622Mj5KZYhMUDj3c3hf82G9oC7N78o/ShutGVU5I21ViPPao8Ycpi52l /AoKEvGsvlNc3JheRhVxWn9QuMSZv/GedDnBOuoT4pc3fQMOqYgaNMKJDeew81SSKdR8 8GZ6aCaBfYP5/UPrf8TJN/Gx8+EgAzNr6aONvdIwBB/Vyz1J2D1LQQPkB83f3Yl9DroZ OVOw== X-Gm-Message-State: AOJu0YxQpu7AGvI0CcBQC0dmC93IcqmCGC8CfFRRGvVZCDo9RuUcL/VO qEHHnr4qh1JF6stWbkvjnt3Ybu2BpHygsgoDCYaf1z93S/7PrUdPEFQa7GDVskjjU3uup0lu8md GM0Mx X-Gm-Gg: ASbGncs3Ag4O/FrWfd2bx+m8JGHNjjrsd5Exg2bdQqhOEc47bxroDosncHEv7HqFBOa UX7oKs1AAIFj9NV4oBN1NH3S0BmmRcoi/h6CvRyjiT0u265izrjkgOt88bWs6CBpB6qREqWgJ2x X9R2s4E660URT3mCITvdejc6Wzfkk2lDly7RTymt9v9gWSkKaX/0XApiWtSPxxOxiwkKSUg85+f 5ngS3X7UirdWv9PRHLljLJbQ3I7hVSWj3BFwLTAQD/H4dZFoGK+sJ4xg0vXm0aPLvsIc23R4wa9 rDAM8d2pbWYrx2ZyUmJ5Y4nXRs6hbs8pZDItgQYTC//hfF4sC86wwB9vtpQZFWVCjna/F3EZkBX 56ZeE7j5nyy8i+VjqCF/zOybUeNsRE7a+KtBI X-Google-Smtp-Source: AGHT+IHwwH99e9NtGbG85+OAxSYQ+cebt33sA4BsR9GiUbSRDC34uDDteV6qhI73CcTX5MSoH0YQag== X-Received: by 2002:a05:600c:4752:b0:453:a95:f07d with SMTP id 5b1f17b1804b1-4538ee27811mr231543505e9.10.1751380868317; Tue, 01 Jul 2025 07:41:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Julian Armistead , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/68] accel: Propagate AccelState to AccelClass::init_machine() Date: Tue, 1 Jul 2025 16:39:17 +0200 Message-ID: <20250701144017.43487-10-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250701144017.43487-1-philmd@linaro.org> References: <20250701144017.43487-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1751380952918116600 In order to avoid init_machine() to call current_accel(), pass AccelState along. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- include/qemu/accel.h | 2 +- accel/accel-system.c | 2 +- accel/hvf/hvf-accel-ops.c | 2 +- accel/kvm/kvm-all.c | 2 +- accel/qtest/qtest.c | 2 +- accel/tcg/tcg-all.c | 2 +- accel/xen/xen-all.c | 2 +- bsd-user/main.c | 2 +- linux-user/main.c | 2 +- target/i386/nvmm/nvmm-all.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 9dea3145429..b9a9b3593d8 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -40,7 +40,7 @@ typedef struct AccelClass { /* Cached by accel_init_ops_interfaces() when created */ AccelOpsClass *ops; =20 - int (*init_machine)(MachineState *ms); + int (*init_machine)(AccelState *as, MachineState *ms); bool (*cpu_common_realize)(CPUState *cpu, Error **errp); void (*cpu_common_unrealize)(CPUState *cpu); =20 diff --git a/accel/accel-system.c b/accel/accel-system.c index 64bc991b1ce..913b7155d77 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -37,7 +37,7 @@ int accel_init_machine(AccelState *accel, MachineState *m= s) int ret; ms->accelerator =3D accel; *(acc->allowed) =3D true; - ret =3D acc->init_machine(ms); + ret =3D acc->init_machine(accel, ms); if (ret < 0) { ms->accelerator =3D NULL; *(acc->allowed) =3D false; diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index b85284017c5..24c21c582f8 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -315,7 +315,7 @@ static void dummy_signal(int sig) =20 bool hvf_allowed; =20 -static int hvf_accel_init(MachineState *ms) +static int hvf_accel_init(AccelState *as, MachineState *ms) { int x; hv_return_t ret; diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 17235f26464..264f288dc64 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2573,7 +2573,7 @@ static int kvm_setup_dirty_ring(KVMState *s) return 0; } =20 -static int kvm_init(MachineState *ms) +static int kvm_init(AccelState *as, MachineState *ms) { MachineClass *mc =3D MACHINE_GET_CLASS(ms); static const char upgrade_note[] =3D diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index 92bed9264ce..8b109d4c03b 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -37,7 +37,7 @@ static void qtest_set_virtual_clock(int64_t count) qatomic_set_i64(&qtest_clock_counter, count); } =20 -static int qtest_init_accel(MachineState *ms) +static int qtest_init_accel(AccelState *as, MachineState *ms) { return 0; } diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 6e5dc333d59..d68fbb23773 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -80,7 +80,7 @@ static void tcg_accel_instance_init(Object *obj) =20 bool one_insn_per_tb; =20 -static int tcg_init_machine(MachineState *ms) +static int tcg_init_machine(AccelState *as, MachineState *ms) { TCGState *s =3D TCG_STATE(current_accel()); unsigned max_threads =3D 1; diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index de52a8f882a..1117f52bef0 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -76,7 +76,7 @@ static void xen_setup_post(MachineState *ms, AccelState *= accel) } } =20 -static int xen_init(MachineState *ms) +static int xen_init(AccelState *as, MachineState *ms) { MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 diff --git a/bsd-user/main.c b/bsd-user/main.c index 7c0a059c3ba..d0cc8e0088f 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -474,7 +474,7 @@ int main(int argc, char **argv) opt_one_insn_per_tb, &error_abort); object_property_set_int(OBJECT(accel), "tb-size", opt_tb_size, &error_abort); - ac->init_machine(NULL); + ac->init_machine(accel, NULL); } =20 /* diff --git a/linux-user/main.c b/linux-user/main.c index 5ac5b55dc65..a9142ee7268 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -820,7 +820,7 @@ int main(int argc, char **argv, char **envp) opt_one_insn_per_tb, &error_abort); object_property_set_int(OBJECT(accel), "tb-size", opt_tb_size, &error_abort); - ac->init_machine(NULL); + ac->init_machine(accel, NULL); } =20 /* diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index f1c6120ccf1..eaae175aa5d 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -1153,7 +1153,7 @@ static struct RAMBlockNotifier nvmm_ram_notifier =3D { /* -----------------------------------------------------------------------= --- */ =20 static int -nvmm_accel_init(MachineState *ms) +nvmm_accel_init(AccelState *as, MachineState *ms) { int ret, err; =20 diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index cf6d3e4cdd4..f0be840b7db 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2505,7 +2505,7 @@ static void whpx_set_kernel_irqchip(Object *obj, Visi= tor *v, * Partition support */ =20 -static int whpx_accel_init(MachineState *ms) +static int whpx_accel_init(AccelState *as, MachineState *ms) { struct whpx_state *whpx; int ret; --=20 2.49.0