From patchwork Wed Jan 24 10:16:31 2024 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: 1890146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=VzLi3jxH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzc2YsLz23g5 for ; Wed, 24 Jan 2024 21:18:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaJQ-0003Cz-TD; Wed, 24 Jan 2024 05:16:52 -0500 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 1rSaJQ-0003Ck-6e for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:16:52 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaJO-0003nP-Aq for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:16:51 -0500 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a30359b97a8so345924066b.0 for ; Wed, 24 Jan 2024 02:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091409; x=1706696209; 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=aG1VmNa9qyKWKkyTkfP1qaYwJsyZK0k+Eh9BTsafnvQ=; b=VzLi3jxHhxEo920rGX6gRIDmRiZj2AkSHCaXwZKpN+TWCS4+yhHuxhDKEciGgNeR7+ xmlRzUOrDC/m2/1eSaR7vBmWr/RLDIgpTca9JGLk/6hDdQ4eiX+HG26dh3KlgdQ7Guu0 YEJ8Ht2gDxtPpqq1IN6GiUJZrUvM7IglPa0FsnaM3wZOyGZOOzyjBTYhf4F4WM28dqax +g+5natMg7mVDhASbJpl3Jvq5wArg7axR6yw1OeXaWwI/IrZlJCgB+rna3JdesOyJ0UC 8AsgC+AN3Tb+58Iw/lLXZ/4Q/A/YszCTinzmEEWuY1g8qpm9Iy3WbNhUc95HZiVuSrbU j/dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091409; x=1706696209; 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=aG1VmNa9qyKWKkyTkfP1qaYwJsyZK0k+Eh9BTsafnvQ=; b=SinOml0dtSKFTZDZUxtwZHf+Mb0IdfVGt0Sfi+vgSmCxT3rt4YLgwzisNnqkL25V8u p61k5sMeNzfrDlnW5MdhXY/qGn/32BFYtUiUhDqU1zoDo6t+vVKEEyz7xuBEC1hYHZrg MncgfFQIS9HNcfGZM+l/IAGtU4ndReDxxNHk8b7mENVCd5SWtjSfCZhpsglYpzlqsYYE tEXqxF5EWRZiwgxGdPisKHbYQz0HBOrkmuy2Pzv9nTpqDDyuiHalRD4Csab9eCz7JreH dDLiSo8qlATZLMglhmWs7asevSlGJBoESlKcI3Yhyk/ZnW1mYhugdDcLSFTC1fJ3vI7y RnVA== X-Gm-Message-State: AOJu0YwLpHDjUT5h86FK6g8bEGyCCWSrPoYqB4CkP8chiw/+eIQGA1CT kWZgfg3zICYmNdDiX/5dbL2EgpNumdHrWyS38JrCuoiliy+nLoIVsbJpSYl079Y= X-Google-Smtp-Source: AGHT+IG7V+UBnvi+5pbPb6BUIafu8xEh+xMJhHE6KHSpw95PGthvKCiqljmTc1FngTIWiHANLuzCPg== X-Received: by 2002:a17:907:c201:b0:a31:3d5a:1337 with SMTP id ti1-20020a170907c20100b00a313d5a1337mr120904ejc.45.1706091408933; Wed, 24 Jan 2024 02:16:48 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id i2-20020a170906090200b00a2a04c9226asm15225890ejd.194.2024.01.24.02.16.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:16:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/9] accel/tcg: Rename tcg_ss[] -> tcg_specific_ss[] in meson Date: Wed, 24 Jan 2024 11:16:31 +0100 Message-ID: <20240124101639.30056-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org tcg_ss[] source set contains target-specific units. Rename it as 'tcg_specific_ss[]' for clarity. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index 46f7d53eeb..aef80de967 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -1,8 +1,8 @@ -tcg_ss = ss.source_set() common_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', )) -tcg_ss.add(files( +tcg_specific_ss = ss.source_set() +tcg_specific_ss.add(files( 'tcg-all.c', 'cpu-exec.c', 'tb-maint.c', @@ -11,12 +11,12 @@ tcg_ss.add(files( 'translate-all.c', 'translator.c', )) -tcg_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-exec.c')) -tcg_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_false: files('user-exec-stub.c')) +tcg_specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-exec.c')) +tcg_specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_false: files('user-exec-stub.c')) if get_option('plugins') - tcg_ss.add(files('plugin-gen.c')) + tcg_specific_ss.add(files('plugin-gen.c')) endif -specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss) +specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_specific_ss) specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files( 'cputlb.c', From patchwork Wed Jan 24 10:16:32 2024 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: 1890148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Kkdr2i3B; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzc2h43z23g9 for ; Wed, 24 Jan 2024 21:18:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaJZ-0003EP-75; Wed, 24 Jan 2024 05:17:01 -0500 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 1rSaJW-0003ED-VY for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:16:59 -0500 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaJV-0003oZ-DC for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:16:58 -0500 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2cf2a381b86so2734441fa.0 for ; Wed, 24 Jan 2024 02:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091415; x=1706696215; 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=FBMlS39CW/Iv4VBfcOh+Zv0cB8PVhw/t20rhumALwGU=; b=Kkdr2i3BB1dXg81R+RWi9qDJn3QQEEOuI7C4nuEx2ab9BEdZkuncnRWCnxZNw8YAkB G5oIjVSS3hrjIVSBAquYqq+H4DoCQzTkByzWBIvOsB2ggBjxpK4sioJzxfMdxrvBGibd yE49qpZB39HYrGXQ12bu3gGfN+89LdxV4BQq9gK1sWpRFkjBUqp/UvJLYZ+L3DtWbg9g R2AkkD2ruvaIBzf7e0vouGV8t18Tno3+EkmIRAaDGBccusojcRb04b8eVSSap4dWPY1O b4aNDMKMKyKSaabx88powozt844fgfzbN97Fz04gnw94srmdl/3S/NL1nwmUKWEdhx5H ateQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091415; x=1706696215; 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=FBMlS39CW/Iv4VBfcOh+Zv0cB8PVhw/t20rhumALwGU=; b=ORIIHZVpyokCZ5MhPf+rDjABkoldUMve766OX1bh3nPuDiZbGvSWEGs5JTQF+3SotK 61pVRpP+S+ldlGjfgZ4YTtQt/Ew/UfHPDoSQTIc+jdeybPNeKU4075LZArbVSWyx15RC yuEikW/XHIs0MRGWRUxBuD0wCT2KO3Ps178hArNjK7JvpNFJaQEn3Whll0u3NbOwAiOs i/nAPTUm3OXP97mxkOVXIshTP3U+UEOKnLCUBj/QNSAZ19J1x0NoE/5JSR3z2AdIFXNx Yg+SIJRcJBmgrVIHbwb+tEgdghV35w5L5kIog8PjyO+K27GbZF85uPdjJtDFroCTCkwu KoiA== X-Gm-Message-State: AOJu0Ywcm8PR3Hl/X5LWfCnbcxJTZWHztCtppc6ZzHcwfk51CsSMVYBd K4ZU9RIiIFL+pidhGHfl6Ds/YtL4XjB0AWMAR51L/UZ54koZ5w3r3G61QSv1eHA= X-Google-Smtp-Source: AGHT+IGWwkbYOC0U4dBmSTynpfE6ssaqXGSArnjuAeOxnV9ZtNSORTiLNAcuzDaJQpkloBLfSHLM6A== X-Received: by 2002:a2e:be84:0:b0:2cc:c7ef:924d with SMTP id a4-20020a2ebe84000000b002ccc7ef924dmr971451ljr.29.1706091415358; Wed, 24 Jan 2024 02:16:55 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id cn7-20020a0564020ca700b0055c349e04f8sm3444326edb.36.2024.01.24.02.16.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:16:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/9] accel/tcg: Rename tcg_cpus_destroy() -> tcg_cpu_destroy() Date: Wed, 24 Jan 2024 11:16:32 +0100 Message-ID: <20240124101639.30056-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org tcg_cpus_destroy() operates on a single vCPU, rename it as 'tcg_cpu_destroy'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/tcg-accel-ops.h | 2 +- accel/tcg/tcg-accel-ops-mttcg.c | 2 +- accel/tcg/tcg-accel-ops-rr.c | 2 +- accel/tcg/tcg-accel-ops.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/tcg-accel-ops.h b/accel/tcg/tcg-accel-ops.h index f9bc6330e2..17c7ed00eb 100644 --- a/accel/tcg/tcg-accel-ops.h +++ b/accel/tcg/tcg-accel-ops.h @@ -14,7 +14,7 @@ #include "sysemu/cpus.h" -void tcg_cpus_destroy(CPUState *cpu); +void tcg_cpu_destroy(CPUState *cpu); int tcg_cpus_exec(CPUState *cpu); void tcg_handle_interrupt(CPUState *cpu, int mask); void tcg_cpu_init_cflags(CPUState *cpu, bool parallel); diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index af7307013a..bcba314a65 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -118,7 +118,7 @@ static void *mttcg_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); - tcg_cpus_destroy(cpu); + tcg_cpu_destroy(cpu); bql_unlock(); rcu_remove_force_rcu_notifier(&force_rcu.notifier); rcu_unregister_thread(); diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 3208035d85..0617f66b5b 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -131,7 +131,7 @@ static void rr_deal_with_unplugged_cpus(void) CPU_FOREACH(cpu) { if (cpu->unplug && !cpu_can_run(cpu)) { - tcg_cpus_destroy(cpu); + tcg_cpu_destroy(cpu); break; } } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 813065c0ec..9b84b84218 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -63,7 +63,7 @@ void tcg_cpu_init_cflags(CPUState *cpu, bool parallel) cpu->tcg_cflags |= cflags; } -void tcg_cpus_destroy(CPUState *cpu) +void tcg_cpu_destroy(CPUState *cpu) { cpu_thread_signal_destroyed(cpu); } From patchwork Wed Jan 24 10:16:33 2024 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: 1890147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=z75ITGLP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzc2cYZz23g8 for ; Wed, 24 Jan 2024 21:18:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaJg-0003Fs-2e; Wed, 24 Jan 2024 05:17:08 -0500 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 1rSaJc-0003FQ-VU for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:04 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaJb-0003oy-BR for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:04 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cf161b5eadso17107841fa.2 for ; Wed, 24 Jan 2024 02:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091421; x=1706696221; 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=QCaFP/JCcM9wNK6S/97qMJvFLtrlt8qlwc6m36BcsKg=; b=z75ITGLPdKccL7TMKDO/oMH/IW9BWXWuV5maFFOIMUyrrWmcQiQ57AZL2Mm833VMob NlNS9QNFuJJhOU240IsHqSwTJ/IIcSEeQNVbkS67TwrDC2ZIvrwzpYeu3nt1EQCU4E7K /tXexVPmj1Ix0fONkbOyZcabDW/juXDBPmILKWhhXrjV0R3uC6sRlrYcZziG4Dzt3a7K 4isKeyYmbwDQX2OKB5CvkR7qTKXEYqj6VCmA/NEnMI50LmKEsjkjCsWLdeEWScbv6zBG tZXUVned0OHaDpRAS9/0uZoV3C/W259tYE2tthjIbvyV56W+B8PDNwTjJmEwxXImv9UW /Lrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091421; x=1706696221; 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=QCaFP/JCcM9wNK6S/97qMJvFLtrlt8qlwc6m36BcsKg=; b=Kp+nTJFVHdUio2/WGOvpHJjH3SndRQBONmpP5LchaVxIcOA3NFTVJW3W1Pvv/MqE4a lxMX7966nW7bg/DkB/vcHqQkPAZCtIFfBHvkGXJEdjZpL4QZowpI7WXhW+YYMqlepgwb +v9xV/1uvlBJ4OavmbnD5lJuD0FgbQO+qPD7ttTY3CRoM3kW67ZxT3CvADsbbHln2KF1 GUzc8yc14AvR3SMFvhFLeUgY1oQzfdkXsRwHeWfhTurtn+ZM98PvEbvEFrsxxCOOLbSf 2EIdyYRYMJD+Xfo6Noz4ZJfGT0XJsWS/LxMSZppdEW7ksuHo6zLvI7At3fBJeo8/2L+s qqPA== X-Gm-Message-State: AOJu0YzoXgrnZMEiHIY506jmIuKqvUHojCwIAMohsBGst/m0tsnK84bh ElihM+yp5t2SYK9RONhxH0en0Ett/V7TcVtjjG60nLUIkvrDIUyOnWFWHeHAzzQQNrexM8pzQBD j X-Google-Smtp-Source: AGHT+IEVG4Ln3bk/nYFNEbNSjklMnjb2JXuXOuKJ3rARoxHbBpuoCuPrWt+0nrivveIK/Qp9qMMPWA== X-Received: by 2002:a2e:beaa:0:b0:2cd:9f51:ac23 with SMTP id a42-20020a2ebeaa000000b002cd9f51ac23mr804483ljr.4.1706091421496; Wed, 24 Jan 2024 02:17:01 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id h27-20020a056402095b00b0055c643f4f8asm2410643edz.32.2024.01.24.02.17.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/9] accel/tcg: Rename tcg_cpus_exec() -> tcg_cpu_exec() Date: Wed, 24 Jan 2024 11:16:33 +0100 Message-ID: <20240124101639.30056-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=philmd@linaro.org; helo=mail-lj1-x233.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org tcg_cpus_exec() operates on a single vCPU, rename it as 'tcg_cpu_exec'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/tcg-accel-ops.h | 2 +- accel/tcg/tcg-accel-ops-mttcg.c | 2 +- accel/tcg/tcg-accel-ops-rr.c | 2 +- accel/tcg/tcg-accel-ops.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/tcg-accel-ops.h b/accel/tcg/tcg-accel-ops.h index 17c7ed00eb..44c4079972 100644 --- a/accel/tcg/tcg-accel-ops.h +++ b/accel/tcg/tcg-accel-ops.h @@ -15,7 +15,7 @@ #include "sysemu/cpus.h" void tcg_cpu_destroy(CPUState *cpu); -int tcg_cpus_exec(CPUState *cpu); +int tcg_cpu_exec(CPUState *cpu); void tcg_handle_interrupt(CPUState *cpu, int mask); void tcg_cpu_init_cflags(CPUState *cpu, bool parallel); diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index bcba314a65..c552b45b8e 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -92,7 +92,7 @@ static void *mttcg_cpu_thread_fn(void *arg) if (cpu_can_run(cpu)) { int r; bql_unlock(); - r = tcg_cpus_exec(cpu); + r = tcg_cpu_exec(cpu); bql_lock(); switch (r) { case EXCP_DEBUG: diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 0617f66b5b..894e73e52c 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -258,7 +258,7 @@ static void *rr_cpu_thread_fn(void *arg) if (icount_enabled()) { icount_prepare_for_run(cpu, cpu_budget); } - r = tcg_cpus_exec(cpu); + r = tcg_cpu_exec(cpu); if (icount_enabled()) { icount_process_data(cpu); } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 9b84b84218..9c957f421c 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -68,7 +68,7 @@ void tcg_cpu_destroy(CPUState *cpu) cpu_thread_signal_destroyed(cpu); } -int tcg_cpus_exec(CPUState *cpu) +int tcg_cpu_exec(CPUState *cpu) { int ret; assert(tcg_enabled()); From patchwork Wed Jan 24 10:16:35 2024 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: 1890149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kr5swZd+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzc2kwDz23gC for ; Wed, 24 Jan 2024 21:18:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaKE-0003jB-O3; Wed, 24 Jan 2024 05:17:42 -0500 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 1rSaJq-0003Mq-HN for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:20 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaJo-0003q3-5Y for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:18 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a293f2280c7so549244766b.1 for ; Wed, 24 Jan 2024 02:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091434; x=1706696234; 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=kCdApdVb2tqf6HzKRfmudkQU18WR02XSp7D7zgQR15M=; b=kr5swZd+2nM1QAnTrCMMOZ5KARfyobJ4HPJY86G0Bq94ies0QJLgO76Jg8dSEwpMKv TENaYADgGJc1GYDnhTKGowl2T5kjATMMmOVxo/prSpTQJrnHG+L0W6wXxMeauOdS6weC FbvyeD+09sY9SghpqGQ9F+uMMyP1XqJ8eGMAlGcd7U6cONePOYpnecJqAKeaC/H/LuV+ NOC77FA6jl9Glcfo0pM6n+iRUtIQb1Lm4ZjlOod6GusRAQJ5sygksWl67w/Y60cOvnCt 8ntMbBP+09oMX3d/GXAACSkcrBzMi/hxRhKh+7ygkUuppq+gxUJUQkANTuAMOvjMJJnk 3jmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091434; x=1706696234; 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=kCdApdVb2tqf6HzKRfmudkQU18WR02XSp7D7zgQR15M=; b=Gk2HuTa+JYJ4v5KadNmG/3WMAsAY/pUnkaKch4FsCDfWXhX2xP8PhdRHMShvLcv8ev pz7BbLyxaphqx3HCsgMryvJQrdu8G5whfiJxXo6lz+swr4C3FaLbVCdhMQ3olNYO7FmP 4Bks6Dt4qKAqBOI/fAveurrJNWUMpMtAKhnKW/dEdDSVVZJKL99zUT5ooGTmK8IvsQeD 6DYs70eCsWmmlnISQDD/gmW8kFOxDTJLdOroBoh53Po82knkyAkcv7IeWDtUie0XIwzB Vqc/5DlxzP0/Ebio5iUjaBMDEjysn+wO8w7tTSApuPdVY6piD+0Lx1YIrvkl0tk8hKPK Uv2Q== X-Gm-Message-State: AOJu0YwNYQ1iiCp1oLrsybRDa7bW5iLfivtIqSwCF7g6A2eijlCvydcs wGgaJHOFs5uCBjWhMG/4yiLakr4O30kJpd/p4tD+mCRWJQSfu9Iral12HZ8i90Y= X-Google-Smtp-Source: AGHT+IHn1Xvl36cwiqj9hcYhEW0WZ34e4eNFzBSz1q8ioyEEXwnTprlQ8V5G5MMuYOQNErFAxI3qog== X-Received: by 2002:a17:907:8b87:b0:a31:1092:69b2 with SMTP id tb7-20020a1709078b8700b00a31109269b2mr339392ejc.77.1706091433618; Wed, 24 Jan 2024 02:17:13 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id w17-20020a17090652d100b00a28116285e0sm10969588ejn.165.2024.01.24.02.17.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/9] accel/tcg: Hoist CPUClass arg to functions with external linkage Date: Wed, 24 Jan 2024 11:16:35 +0100 Message-ID: <20240124101639.30056-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hoist the CPUClass argument from most of these internal helpers: - check_for_breakpoints_slow - check_for_breakpoints() - cpu_tb_exec() - cpu_exec_enter() - cpu_exec_exit() - cpu_handle_halt() - cpu_handle_debug_exception() - cpu_handle_exception() - need_replay_interrupt() - cpu_handle_interrupt() - cpu_loop_exec_tb() - cpu_exec_loop() - cpu_exec_setjmp() to the following ones with external linkage: - lookup_tb_ptr() - cpu_exec_step_atomic() - cpu_exec() Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 82 ++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d61b285d5e..b10472cbc7 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -324,8 +324,8 @@ static void log_cpu_exec(vaddr pc, CPUState *cpu, } } -static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc, - uint32_t *cflags) +static bool check_for_breakpoints_slow(CPUClass *cc, CPUState *cpu, + vaddr pc, uint32_t *cflags) { CPUBreakpoint *bp; bool match_page = false; @@ -357,7 +357,6 @@ static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc, #ifdef CONFIG_USER_ONLY g_assert_not_reached(); #else - CPUClass *cc = CPU_GET_CLASS(cpu); assert(cc->tcg_ops->debug_check_breakpoint); match_bp = cc->tcg_ops->debug_check_breakpoint(cpu); #endif @@ -390,11 +389,11 @@ static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc, return false; } -static inline bool check_for_breakpoints(CPUState *cpu, vaddr pc, - uint32_t *cflags) +static inline bool check_for_breakpoints(CPUClass *cc, CPUState *cpu, + vaddr pc, uint32_t *cflags) { return unlikely(!QTAILQ_EMPTY(&cpu->breakpoints)) && - check_for_breakpoints_slow(cpu, pc, cflags); + check_for_breakpoints_slow(cc, cpu, pc, cflags); } /** @@ -408,6 +407,7 @@ static inline bool check_for_breakpoints(CPUState *cpu, vaddr pc, const void *HELPER(lookup_tb_ptr)(CPUArchState *env) { CPUState *cpu = env_cpu(env); + CPUClass *cc = CPU_GET_CLASS(cpu); TranslationBlock *tb; vaddr pc; uint64_t cs_base; @@ -416,7 +416,7 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); cflags = curr_cflags(cpu); - if (check_for_breakpoints(cpu, pc, &cflags)) { + if (check_for_breakpoints(cc, cpu, pc, &cflags)) { cpu_loop_exit(cpu); } @@ -443,7 +443,7 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) * affect the impact of CFI in environment with high security requirements */ static inline TranslationBlock * QEMU_DISABLE_CFI -cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) +cpu_tb_exec(CPUClass *cc, CPUState *cpu, TranslationBlock *itb, int *tb_exit) { CPUArchState *env = cpu_env(cpu); uintptr_t ret; @@ -476,8 +476,6 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) * counter hit zero); we must restore the guest PC to the address * of the start of the TB. */ - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->tcg_ops->synchronize_from_tb) { cc->tcg_ops->synchronize_from_tb(cpu, last_tb); } else { @@ -509,19 +507,15 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) } -static void cpu_exec_enter(CPUState *cpu) +static void cpu_exec_enter(CPUClass *cc, CPUState *cpu) { - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->tcg_ops->cpu_exec_enter) { cc->tcg_ops->cpu_exec_enter(cpu); } } -static void cpu_exec_exit(CPUState *cpu) +static void cpu_exec_exit(CPUClass *cc, CPUState *cpu) { - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->tcg_ops->cpu_exec_exit) { cc->tcg_ops->cpu_exec_exit(cpu); } @@ -566,6 +560,7 @@ static void cpu_exec_longjmp_cleanup(CPUState *cpu) void cpu_exec_step_atomic(CPUState *cpu) { + CPUClass *cc = CPU_GET_CLASS(cpu); CPUArchState *env = cpu_env(cpu); TranslationBlock *tb; vaddr pc; @@ -600,11 +595,11 @@ void cpu_exec_step_atomic(CPUState *cpu) mmap_unlock(); } - cpu_exec_enter(cpu); + cpu_exec_enter(cc, cpu); /* execute the generated code */ trace_exec_tb(tb, pc); - cpu_tb_exec(cpu, tb, &tb_exit); - cpu_exec_exit(cpu); + cpu_tb_exec(cc, cpu, tb, &tb_exit); + cpu_exec_exit(cc, cpu); } else { cpu_exec_longjmp_cleanup(cpu); } @@ -673,7 +668,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, return; } -static inline bool cpu_handle_halt(CPUState *cpu) +static inline bool cpu_handle_halt(CPUClass *cc, CPUState *cpu) { #ifndef CONFIG_USER_ONLY if (cpu->halted) { @@ -697,9 +692,8 @@ static inline bool cpu_handle_halt(CPUState *cpu) return false; } -static inline void cpu_handle_debug_exception(CPUState *cpu) +static inline void cpu_handle_debug_exception(CPUClass *cc, CPUState *cpu) { - CPUClass *cc = CPU_GET_CLASS(cpu); CPUWatchpoint *wp; if (!cpu->watchpoint_hit) { @@ -713,7 +707,7 @@ static inline void cpu_handle_debug_exception(CPUState *cpu) } } -static inline bool cpu_handle_exception(CPUState *cpu, int *ret) +static inline bool cpu_handle_exception(CPUClass *cc, CPUState *cpu, int *ret) { if (cpu->exception_index < 0) { #ifndef CONFIG_USER_ONLY @@ -730,7 +724,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) /* exit request from the cpu execution loop */ *ret = cpu->exception_index; if (*ret == EXCP_DEBUG) { - cpu_handle_debug_exception(cpu); + cpu_handle_debug_exception(cc, cpu); } cpu->exception_index = -1; return true; @@ -740,7 +734,6 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) which will be handled outside the cpu execution loop */ #if defined(TARGET_I386) - CPUClass *cc = CPU_GET_CLASS(cpu); cc->tcg_ops->fake_user_interrupt(cpu); #endif /* TARGET_I386 */ *ret = cpu->exception_index; @@ -748,7 +741,6 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) return true; #else if (replay_exception()) { - CPUClass *cc = CPU_GET_CLASS(cpu); bql_lock(); cc->tcg_ops->do_interrupt(cpu); bql_unlock(); @@ -761,7 +753,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) * next instruction. */ *ret = EXCP_DEBUG; - cpu_handle_debug_exception(cpu); + cpu_handle_debug_exception(cc, cpu); return true; } } else if (!replay_has_interrupt()) { @@ -781,7 +773,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) * "real" interrupt event later. It does not need to be recorded for * replay purposes. */ -static inline bool need_replay_interrupt(int interrupt_request) +static inline bool need_replay_interrupt(CPUClass *cc, int interrupt_request) { #if defined(TARGET_I386) return !(interrupt_request & CPU_INTERRUPT_POLL); @@ -802,7 +794,7 @@ static inline bool icount_exit_request(CPUState *cpu) return cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0; } -static inline bool cpu_handle_interrupt(CPUState *cpu, +static inline bool cpu_handle_interrupt(CPUClass *cc, CPUState *cpu, TranslationBlock **last_tb) { /* @@ -870,11 +862,9 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, True when it is, and we should restart on a new TB, and via longjmp via cpu_loop_exit. */ else { - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->tcg_ops->cpu_exec_interrupt && cc->tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) { - if (need_replay_interrupt(interrupt_request)) { + if (need_replay_interrupt(cc, interrupt_request)) { replay_interrupt(); } /* @@ -918,14 +908,15 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, return false; } -static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, +static inline void cpu_loop_exec_tb(CPUClass *cc, CPUState *cpu, + TranslationBlock *tb, vaddr pc, TranslationBlock **last_tb, int *tb_exit) { int32_t insns_left; trace_exec_tb(tb, pc); - tb = cpu_tb_exec(cpu, tb, tb_exit); + tb = cpu_tb_exec(cc, cpu, tb, tb_exit); if (*tb_exit != TB_EXIT_REQUESTED) { *last_tb = tb; return; @@ -970,16 +961,16 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, /* main execution loop */ static int __attribute__((noinline)) -cpu_exec_loop(CPUState *cpu, SyncClocks *sc) +cpu_exec_loop(CPUClass *cc, CPUState *cpu, SyncClocks *sc) { int ret; /* if an exception is pending, we execute it here */ - while (!cpu_handle_exception(cpu, &ret)) { + while (!cpu_handle_exception(cc, cpu, &ret)) { TranslationBlock *last_tb = NULL; int tb_exit = 0; - while (!cpu_handle_interrupt(cpu, &last_tb)) { + while (!cpu_handle_interrupt(cc, cpu, &last_tb)) { TranslationBlock *tb; vaddr pc; uint64_t cs_base; @@ -1001,7 +992,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) cpu->cflags_next_tb = -1; } - if (check_for_breakpoints(cpu, pc, &cflags)) { + if (check_for_breakpoints(cc, cpu, pc, &cflags)) { break; } @@ -1046,7 +1037,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) tb_add_jump(last_tb, tb_exit, tb); } - cpu_loop_exec_tb(cpu, tb, pc, &last_tb, &tb_exit); + cpu_loop_exec_tb(cc, cpu, tb, pc, &last_tb, &tb_exit); /* Try to align the host and virtual clocks if the guest is in advance */ @@ -1056,30 +1047,31 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) return ret; } -static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) +static int cpu_exec_setjmp(CPUClass *cc, CPUState *cpu, SyncClocks *sc) { /* Prepare setjmp context for exception handling. */ if (unlikely(sigsetjmp(cpu->jmp_env, 0) != 0)) { cpu_exec_longjmp_cleanup(cpu); } - return cpu_exec_loop(cpu, sc); + return cpu_exec_loop(cc, cpu, sc); } int cpu_exec(CPUState *cpu) { int ret; SyncClocks sc = { 0 }; + CPUClass *cc = CPU_GET_CLASS(cpu); /* replay_interrupt may need current_cpu */ current_cpu = cpu; - if (cpu_handle_halt(cpu)) { + if (cpu_handle_halt(cc, cpu)) { return EXCP_HALTED; } WITH_RCU_READ_LOCK_GUARD() { - cpu_exec_enter(cpu); + cpu_exec_enter(cc, cpu); /* * Calculate difference between guest clock and host clock. @@ -1089,9 +1081,9 @@ int cpu_exec(CPUState *cpu) */ init_delay_params(&sc, cpu); - ret = cpu_exec_setjmp(cpu, &sc); + ret = cpu_exec_setjmp(cc, cpu, &sc); - cpu_exec_exit(cpu); + cpu_exec_exit(cc, cpu); }; return ret; From patchwork Wed Jan 24 10:16:36 2024 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: 1890154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=l1L1keZp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKg0C19p1z23f0 for ; Wed, 24 Jan 2024 21:18:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaKG-0003t8-3r; Wed, 24 Jan 2024 05:17:44 -0500 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 1rSaJv-0003NS-3C for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:25 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaJt-0003qQ-8j for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:22 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5100b424f8fso1401957e87.0 for ; Wed, 24 Jan 2024 02:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091439; x=1706696239; 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=TSQhp0P/DRalBnOPDt7LO9q/NJaOxDtFUMlWyOyZnN8=; b=l1L1keZpSxgaSwqjNK8uAs3+/ZEr7MkclSMw1/S/byFZkYEKrKu/TLZD4zM0nhpjAv Fi2eSEoM+1+g11TMyzOmDzNt25ZJpwlF1/ZcpMN/r/+ankap4ed6ik0d7TjTzdvLQdr4 NDzFquoLZemjwRjdI+8QuP9xVGo47ZMYBjC1EBjxrKbFpm7+9mPE1SXZCMx3jsgfw5u1 oX+ITyz7f3bC6YhE+NacK29ZSzODXSKhoVN6bidlbHlmn8nTyKJiY+dG2r1QqAAiLU4r wNhbfUuyRMrrGZNq2QaqJlq7+qdYsnaG6eFSvGMJ12e0KUkRql+Olx1LJxkkO/Mj3lAt Blew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091439; x=1706696239; 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=TSQhp0P/DRalBnOPDt7LO9q/NJaOxDtFUMlWyOyZnN8=; b=PZG0ti4auOF5wDLUYlaOY18LYN+w9qiKLjc3AUXzjrH0qp+v96XB6XIKO0haKfBj64 VLZ5D6za8KTe3WUT9WD78du9iHxNbdGDT7qUIkhtzhmquZviVQcrdCP4BsSSJLY/MwDK 1itxVpq5xk+tUvY6Age8Ra2SCmwhx8+pvDfC/LLHKvqcLa/PzmeO6FzfUrJheQ9kQFdY yvxe93fs7mo4it2z4W6w9qeg/Y9WvUk8Pn/loPnnWyMX2s9bltoiFPw4X2Mggl8QUzD2 xS+4l+XcwKoPrqUy4D6v2Lb7HrK9JfmEoZJke0ZpqPIywe3N6DlKrXVrWZEyiwHS6zya oDMA== X-Gm-Message-State: AOJu0Yy35S+sKw7xqvOd/6xToUH+0SfD1xxInYpIEtRi3z2+kXswuOV2 zjVBApkQstguVi2ySPeDJ1RsFJl98dNJOozK9lJB+ECmy5XmLG/kHr6mXty8EaA= X-Google-Smtp-Source: AGHT+IGQlAgZaXnyZceE+/sYIMLyuxs6C1gSEEQtHHKiUo7Iy7xOXHaKOHVdL2t70v5IIF7PgTq/IQ== X-Received: by 2002:a05:6512:4018:b0:50f:da9:16b2 with SMTP id br24-20020a056512401800b0050f0da916b2mr3904262lfb.74.1706091439730; Wed, 24 Jan 2024 02:17:19 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id i13-20020a05640200cd00b00559c71e70e3sm9558946edu.79.2024.01.24.02.17.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/9] accel/tcg: Introduce TCGCPUOps::need_replay_interrupt() handler Date: Wed, 24 Jan 2024 11:16:36 +0100 Message-ID: <20240124101639.30056-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In order to make accel/tcg/ target agnostic, introduce the need_replay_interrupt() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Pavel Dovgalyuk --- include/hw/core/tcg-cpu-ops.h | 5 +++++ accel/tcg/cpu-exec.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 479713a36e..2fae3ac70f 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -170,6 +170,11 @@ struct TCGCPUOps { */ bool (*io_recompile_replay_branch)(CPUState *cpu, const TranslationBlock *tb); + /** + * @need_replay_interrupt: Return %true if @interrupt_request + * needs to be recorded for replay purposes. + */ + bool (*need_replay_interrupt)(int interrupt_request); #endif /* !CONFIG_USER_ONLY */ #endif /* NEED_CPU_H */ diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index b10472cbc7..4ab7d6c896 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -778,7 +778,10 @@ static inline bool need_replay_interrupt(CPUClass *cc, int interrupt_request) #if defined(TARGET_I386) return !(interrupt_request & CPU_INTERRUPT_POLL); #else - return true; + if (!cc->tcg_ops->need_replay_interrupt) { + return true; + } + return cc->tcg_ops->need_replay_interrupt(interrupt_request); #endif } #endif /* !CONFIG_USER_ONLY */ From patchwork Wed Jan 24 10:16:37 2024 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: 1890155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vF5HjYUh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKg0K2JBtz23f0 for ; Wed, 24 Jan 2024 21:18:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaKG-0003tu-7w; Wed, 24 Jan 2024 05:17:44 -0500 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 1rSaK2-0003SI-Mq for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:36 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaK0-0003qp-FA for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:30 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50eac018059so7354495e87.0 for ; Wed, 24 Jan 2024 02:17:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091446; x=1706696246; 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=Am9lbFOfXcPiDrwnR+bkztaDbspfqwYjvrmc5JlSn2c=; b=vF5HjYUhFRqo+nUDh6iMa6JuEAek56ZT22nnNj2rBAFQ1+t1IGfEPKhlASRNo7H6rM AZ5vT1QGztdH0bRjZE1sTMvW78ilTMW4EIiSUVGv9uwC7GKUuBkesWzubUVhUepLEDqG wEr8L5WHSDEMK0asNrTy2DVr7vrbsezzGOY+OXVA5zAORDMkxLMxDd6fZF8Voxq038Q3 YxLXEoaRR6TZ71GJxHl3SZjILYb4iJM548F8GA6kTllkCP+LvDINghkf5fsDTyEiqdM+ 0ocAvyq3ahnBF3DqLEGV69kzb7gVVSvVlCKgVNQaMePBlMY6M5lK/TXfxLTYvu9BQQY7 768w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091446; x=1706696246; 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=Am9lbFOfXcPiDrwnR+bkztaDbspfqwYjvrmc5JlSn2c=; b=Nxlz4NIMA9jTsVsim1bysPvi6btjRNpS4IECCp+DRbfL+XnbDj2QsG+1b2hf6pVI/q x38Ptb15dVX6MmhHD6zgN+tovWYWdHd65DhmSPjn8ZwVrBf7sjY29PDw1uCkDrDHh75z XUGZHzt92GooIoVN/5hcfLBHBXgxJbhV4Pd0QXlzESzZe/cwE0+RqOcsOML4Xnax4gLH DbO+osYeTwbHSQTMdg6VLQBvb4iaP0VzEZvkMhcCtbgxnv/O0rRDzka62FM5xwNl78eW /kySI6XulJBiwyN0QSzQNbM7v46Jlbvw0EgJOGul/7HzSSs7mRIQCwzLpfLitH0GY+Bf mffQ== X-Gm-Message-State: AOJu0YyeNw4XW8Bnyfac9903EYynqNEZgY4vOQPRUSHlIUmiMjUiFaLH t4I7S8mc/VZ0VJwt42BpJ191rhTKGqwofM+rLjPt9y25MuICvdyg5BDTj0haozc= X-Google-Smtp-Source: AGHT+IFgUbTQFWpKFYBz920IezFeznw97CB8BwTvyN0wNYTJZ+6PdxbitusY+bAyH2on8H3il4xlTQ== X-Received: by 2002:ac2:5b5e:0:b0:510:ab6:e418 with SMTP id i30-20020ac25b5e000000b005100ab6e418mr1156806lfp.33.1706091445750; Wed, 24 Jan 2024 02:17:25 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id t19-20020a1709067c1300b00a2cab4514a2sm14281787ejo.133.2024.01.24.02.17.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Subject: [PATCH 7/9] target/i386: Extract x86_need_replay_interrupt() from accel/tcg/ Date: Wed, 24 Jan 2024 11:16:37 +0100 Message-ID: <20240124101639.30056-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Move this x86-specific code out of the generic accel/tcg/. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Pavel Dovgalyuk --- target/i386/tcg/helper-tcg.h | 1 + accel/tcg/cpu-exec.c | 9 --------- target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++ target/i386/tcg/tcg-cpu.c | 1 + 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index ce34b737bb..253b1f561e 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS); */ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY +bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); #endif diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 4ab7d6c896..5a978a9e72 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -768,21 +768,12 @@ static inline bool cpu_handle_exception(CPUClass *cc, CPUState *cpu, int *ret) } #ifndef CONFIG_USER_ONLY -/* - * CPU_INTERRUPT_POLL is a virtual event which gets converted into a - * "real" interrupt event later. It does not need to be recorded for - * replay purposes. - */ static inline bool need_replay_interrupt(CPUClass *cc, int interrupt_request) { -#if defined(TARGET_I386) - return !(interrupt_request & CPU_INTERRUPT_POLL); -#else if (!cc->tcg_ops->need_replay_interrupt) { return true; } return cc->tcg_ops->need_replay_interrupt(interrupt_request); -#endif } #endif /* !CONFIG_USER_ONLY */ diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c index 1cb5a0db45..e6f42282bb 100644 --- a/target/i386/tcg/sysemu/seg_helper.c +++ b/target/i386/tcg/sysemu/seg_helper.c @@ -127,6 +127,16 @@ void x86_cpu_do_interrupt(CPUState *cs) } } +bool x86_need_replay_interrupt(int interrupt_request) +{ + /* + * CPU_INTERRUPT_POLL is a virtual event which gets converted into a + * "real" interrupt event later. It does not need to be recorded for + * replay purposes. + */ + return !(interrupt_request & CPU_INTERRUPT_POLL); +} + bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { X86CPU *cpu = X86_CPU(cs); diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index e1405b7be9..255d56d4c3 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -123,6 +123,7 @@ static const struct TCGCPUOps x86_tcg_ops = { .do_unaligned_access = x86_cpu_do_unaligned_access, .debug_excp_handler = breakpoint_handler, .debug_check_breakpoint = x86_debug_check_breakpoint, + .need_replay_interrupt = x86_need_replay_interrupt, #endif /* !CONFIG_USER_ONLY */ }; From patchwork Wed Jan 24 10:16:38 2024 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: 1890151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=OZpQtAtA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzq0rC2z23f0 for ; Wed, 24 Jan 2024 21:18:15 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaKH-00041Z-A5; Wed, 24 Jan 2024 05:17:45 -0500 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 1rSaK7-0003cC-TO for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:38 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaK6-0003rF-7U for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:35 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-559f92bf7b6so9562604a12.0 for ; Wed, 24 Jan 2024 02:17:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091451; x=1706696251; 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=X94AmIL+mNsGxo00rh8nsvmtFlP/7iCFJPTsu1PEIEI=; b=OZpQtAtAucMqQuCNBUkJge29NiCtNb3k7ii9ODvmv72snZiuYg4U1UDBSBF3Cac7jQ YjAGLYeeD0O8LK87QayTdTVpJNT21ekY7aU2XiDsbh1TQlrfVExGRLPebJp8NsbDHv2n fz6L6fqC0JqzzTrUoN8Z0k20jQCoekU7SKLetnHtUKj1kyyV679WnQA0Y3gt+WowqO0O uIZmjCLxzVG9SfJkWKdThYNU+HrdxH99L+kaHT5qOLBe+c12iRBeWugG15Jx404oqZVL CSCqZD0ZQhqOVfu9erKwqoXHBHwOCdhnrOjgosfW8mhuCd3Fr+atlrjql0Fpe/u5aWMV nYGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091451; x=1706696251; 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=X94AmIL+mNsGxo00rh8nsvmtFlP/7iCFJPTsu1PEIEI=; b=wgYkKYjqfj1AoJS4NFCGBOF3rL2kUXEPiLf9Ik57VBKDgVAvuVI1LgapI1Xr5ti5xu fzmGQkYgrdWif+HGecYbX2Fob2tvczwNeRnCzAcEK90aG4GCLqMiKC3DLkTcZOH7AvI+ /MqghashjR3YHPTFaPaZw48VU0t7btxswPy33rR+Xtv/6c+RwvXoh+Nk4HbDPUlKLtik 0YdPYJwl7cyUKTFo2zQkh0qCQzD9glYFP/vkR1dhBG9XGVWcLSzFTjkSzV9TIw/j6Dhg 6uG/yKwnNeVkbBtjyD8QbEI8r5QOfGJvQHgyZQ38UvZ9rOkR4N/d8X5nN1Jy7xILdT0m Uo3w== X-Gm-Message-State: AOJu0YxJzeQ4hq336w8da7kBwBUlW5udy97F02zOxNZxiZcKF/KyFOQm gvsxyQErpRNrzWAclUeCNcpWu+nhpTCeBgc+l5M43eYa2g2xelWi7E8u9sec6KU= X-Google-Smtp-Source: AGHT+IHEZ2Xnctj0Ypz0sXKJndqrCnF8cX6WEK/A2zQJz49zqqAFc/OtE0tBaogsHCqJdSK1fX/MGQ== X-Received: by 2002:aa7:d3c8:0:b0:55c:8d17:1bea with SMTP id o8-20020aa7d3c8000000b0055c8d171beamr1038023edr.17.1706091451682; Wed, 24 Jan 2024 02:17:31 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id e9-20020a056402104900b0055c15c5919csm4080051edu.86.2024.01.24.02.17.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 8/9] accel/tcg: Introduce TCGCPUOps::cpu_exec_halt() handler Date: Wed, 24 Jan 2024 11:16:38 +0100 Message-ID: <20240124101639.30056-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=philmd@linaro.org; helo=mail-ed1-x52a.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In order to make accel/tcg/ target agnostic, introduce the cpu_exec_halt() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/core/tcg-cpu-ops.h | 2 ++ accel/tcg/cpu-exec.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 2fae3ac70f..3307338c80 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -114,6 +114,8 @@ struct TCGCPUOps { void (*record_sigbus)(CPUState *cpu, vaddr addr, MMUAccessType access_type, uintptr_t ra); #else + /** @cpu_exec_halt: Callback for handling halt in cpu_exec */ + void (*cpu_exec_halt)(CPUState *cpu); /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */ bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); /** diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5a978a9e72..390a9644da 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -681,6 +681,9 @@ static inline bool cpu_handle_halt(CPUClass *cc, CPUState *cpu) bql_unlock(); } #endif /* TARGET_I386 */ + if (cc->tcg_ops->cpu_exec_halt) { + cc->tcg_ops->cpu_exec_halt(cpu); + } if (!cpu_has_work(cpu)) { return true; } From patchwork Wed Jan 24 10:16:39 2024 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: 1890153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=O2fAohS+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKfzy5VZvz23g5 for ; Wed, 24 Jan 2024 21:18:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSaKI-0004Cw-7S; Wed, 24 Jan 2024 05:17:46 -0500 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 1rSaKD-0003hF-3T for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:41 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSaKB-0003t0-DX for qemu-devel@nongnu.org; Wed, 24 Jan 2024 05:17:40 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a30b3a9e9c6so209303566b.2 for ; Wed, 24 Jan 2024 02:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706091458; x=1706696258; 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=gpEb2PEYPX2zoYAlv9rul3UN8M152eCIu+XSN9MDjH0=; b=O2fAohS+Poviqif5YxxMHRgGtHn0QJ8/pStftmB1hYL/k8NoETwOMrKYCN+kpgNACQ 6jxyU+tSqtmphUGc4H5GPB+TSXri8rbsJEhg+/R7y6HgKCns9Ygn/jYelcD8Tf+zR3QH T1M2O10H/zZWMbuYtJH5bL/KpRJKo87umqaf59fKtTSLIyOb/gB5HyhkEXGnF7KwHdMa a5dprPWuPgJhHhU6qD9cfhPLx7Vfv73Mud6QolgeA1Zypo30l0WGKKUGYW2xpaI3G2xJ 4+AzqystCX7wW6xlvAXfLnnMoIuWf0a14QD2nXHF8+QbRYZRSAu8sygFFt7IPLj2YXiP E2DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706091458; x=1706696258; 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=gpEb2PEYPX2zoYAlv9rul3UN8M152eCIu+XSN9MDjH0=; b=wbUma8ZPw5pOYWqRaoSVmX512CMTQEv7T7XslM1CrgJ/NbY5DsKH834wwwj7jJLgvk 6IEFPXei5fLn6jp33YnvkFA3dk7PjlhYe0mUkGYpsB5uuuTzUMFsykfNj1uHuABK3XQa QwmV+FrTa2k8JUUJZJF2OxOkj2ydAvhcwoLd6PRZUSJesYeV5lAGObxfcO2CbBuV29yD soi9GVjKdddQ0t5nweSlCMistWwl+QX3OGzOIkcJxrZK9JfmAo8SlByjqAeZfCgIfsI/ Py1wDq+E7EwR0PNcXAHcftM4jiTZeEvlZqNYV4aX7MvzWy8RRulXfoB6ep52wJKrjJy9 gSDg== X-Gm-Message-State: AOJu0YxqVlBOufCepcfo0xBuROHViHpy7p9TZ/9LtO1exFyhG7xQdFg4 JK3eRURi4cZ1Hnmcdx0rRk5++bJ1HuQdiQXIHCKMm7QwdnOPDuj7zzXiiuuPipo= X-Google-Smtp-Source: AGHT+IGAX8mq8S4UC+lQnwqIxhDW1uaxnZ4vzpUfX7QVDiewYICyao4JkcpFe58Lpc4HfYtSOkPReg== X-Received: by 2002:a17:906:c50:b0:a30:8497:4db2 with SMTP id t16-20020a1709060c5000b00a3084974db2mr325628ejf.201.1706091457794; Wed, 24 Jan 2024 02:17:37 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id tj4-20020a170907c24400b00a311082cd00sm599770ejc.37.2024.01.24.02.17.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 02:17:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Anton Johansson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Pavel Dovgalyuk , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Subject: [PATCH 9/9] target/i386: Extract x86_cpu_exec_halt() from accel/tcg/ Date: Wed, 24 Jan 2024 11:16:39 +0100 Message-ID: <20240124101639.30056-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124101639.30056-1-philmd@linaro.org> References: <20240124101639.30056-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Move this x86-specific code out of the generic accel/tcg/. Reported-by: Anton Johansson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 1 + accel/tcg/cpu-exec.c | 12 ------------ target/i386/tcg/sysemu/seg_helper.c | 13 +++++++++++++ target/i386/tcg/tcg-cpu.c | 1 + 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index 253b1f561e..effc2c1c98 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS); */ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY +void x86_cpu_exec_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); #endif diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 390a9644da..7662f4973d 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -30,9 +30,6 @@ #include "qemu/rcu.h" #include "exec/log.h" #include "qemu/main-loop.h" -#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) -#include "hw/i386/apic.h" -#endif #include "sysemu/cpus.h" #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" @@ -672,15 +669,6 @@ static inline bool cpu_handle_halt(CPUClass *cc, CPUState *cpu) { #ifndef CONFIG_USER_ONLY if (cpu->halted) { -#if defined(TARGET_I386) - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - X86CPU *x86_cpu = X86_CPU(cpu); - bql_lock(); - apic_poll_irq(x86_cpu->apic_state); - cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); - bql_unlock(); - } -#endif /* TARGET_I386 */ if (cc->tcg_ops->cpu_exec_halt) { cc->tcg_ops->cpu_exec_halt(cpu); } diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c index e6f42282bb..2db8083748 100644 --- a/target/i386/tcg/sysemu/seg_helper.c +++ b/target/i386/tcg/sysemu/seg_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" @@ -127,6 +128,18 @@ void x86_cpu_do_interrupt(CPUState *cs) } } +void x86_cpu_exec_halt(CPUState *cpu) +{ + if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + X86CPU *x86_cpu = X86_CPU(cpu); + + bql_lock(); + apic_poll_irq(x86_cpu->apic_state); + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); + bql_unlock(); + } +} + bool x86_need_replay_interrupt(int interrupt_request) { /* diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 255d56d4c3..3028b57c97 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -119,6 +119,7 @@ static const struct TCGCPUOps x86_tcg_ops = { #else .tlb_fill = x86_cpu_tlb_fill, .do_interrupt = x86_cpu_do_interrupt, + .cpu_exec_halt = x86_cpu_exec_halt, .cpu_exec_interrupt = x86_cpu_exec_interrupt, .do_unaligned_access = x86_cpu_do_unaligned_access, .debug_excp_handler = breakpoint_handler,