From patchwork Thu Jan 2 18:25:20 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: 854745 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7909450wrq; Thu, 2 Jan 2025 10:28:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUMsoYyVNK3GlCk5PnjNwnztvQhLlUOxWM8IZXojnd1oDG2rYdyBdKRrcfcmUurL2AX1kTN3g==@linaro.org X-Google-Smtp-Source: AGHT+IFdIpu0DjVx+S+kndSl/y/cl+JM939LeCVd8Cd0V9Yf2lKYLGyZIKodBL8bd8Ko2JOJgRxt X-Received: by 2002:a05:6214:2b84:b0:6d8:a1fe:729e with SMTP id 6a1803df08f44-6dd233af2b4mr740316906d6.46.1735842510701; Thu, 02 Jan 2025 10:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735842510; cv=none; d=google.com; s=arc-20240605; b=cdYKJ7T0FjidDRfpCb0WrCVRb/a21cxrnaxXnLoSMwTo3n55M3jD4/npSoKEi1d2Bs fLMsa3p6izOPiO4TcV6jYb3PmmBLtbxV04eEgE+cAAeXp9zn/VWURv4craxQY2Ajh03d ONrQroFkiXiB9cr7JGl3iEap2rimoMbu+WJRk2xvSkV1a0BDsKjM1qbzOIEtncDBgboJ /Iet9ZF5Bo1oF9LDuWGaoCZUUroz/A8OdU/n6ZsJ3E8QY3j/wEUwWBgbhbM7idesJT5Z ciTcdWIN9Ix8kCywXvuLfR/RnjjPZMif9l7QDKkD7ZDB9JZxwHWM1L7jHTUeEDgE5lK6 C9RQ== 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=peARTf2/KC6klqYofRoAuLkEwM6US8QQU7qQEt05x1c=; fh=efowiL6AZOegheg6QBG5RWVtD3FmOXl14QhVe5Pw/BI=; b=c73BDVxmtGEEOCDZIHUFuxETNlCeGcjal9fnkpRq74Dximvg28/mNdDyGpmfiJTOcU fTvL222hzjdtFCC+KeyQWHpnZJ8Xlfoh+QF5pffWAZ6P6AB6bUUyXBkbDbOt4s4YDI+o bku2OuR3hi3E0ae+TbPV+BpbcKjHiayM2frFmBFF3Q25NhXjhT7F8wOB2C9jXozwdFqV 25f6IGTta/addzcTOzWZCiAiZ/hasCtYP2SY6B3oS4fmbLR7RIC5UZTcjZ2p05iE7HYM ydr9YKhnZ5OanzdJ0cjUvK1jk7Me8/O+MHbaoit+cI9BWXYEC+83PHzBTdyEgNXI8Xfp 6kXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SKO6p/2Z"; 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 6a1803df08f44-6dd18250810si346647976d6.361.2025.01.02.10.28.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 10:28:30 -0800 (PST) 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="SKO6p/2Z"; 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 1tTPtu-0008Op-PL; Thu, 02 Jan 2025 13:26:31 -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 1tTPt5-00082i-BW for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:25:41 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTPt3-0007uG-LS for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:25:39 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385deda28b3so8027606f8f.0 for ; Thu, 02 Jan 2025 10:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735842335; x=1736447135; 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=peARTf2/KC6klqYofRoAuLkEwM6US8QQU7qQEt05x1c=; b=SKO6p/2Z38NhBURzbzssUwzCiDschSx9YPnpO0lR8QMUqzjU6QevyleU2UCi8/lhqI F34QwStX2YbbuR+hT2/QPClzxZ9XFCvCQF4UxbGsLe1dQNbdUf3y8KuD+tyhJdDbhhK6 y8Hw5QqH8XiUpTf3EtksCmQzm3rYOgLBLhbrHvq//cUq9K1OsuRIXgOvykTKaWEbXGzG VAP2Nc+1Hl1xbimmudpAUWVIhTwIN4I9a3eitX5n8BhuxTUTf6KpLZLeD9y/+m/jrW30 4n4479pOA2kzANQBETY6TmVKMy9PpYsInejJlS2kFOCAvR0njLSfNewN5wgt2GwsKj2M /VEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735842335; x=1736447135; 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=peARTf2/KC6klqYofRoAuLkEwM6US8QQU7qQEt05x1c=; b=eqRvN8KhYjJ+6RefO9HlcNjoc+IlnR43SIvnJJ1ms0zsPnui1YuGdOp/jF3dzbc0dc dKH2X9QFesvT5xEkYm6ADk4pfloquC60BF+5ygswkJ65zhvdIs9n/xkVBxPzjzosSWeT j0MuAI9YAc1yhMYzuf0EYgrnr1wey28CPzjahGWPbQII2La4mcaIrYrk2j3TZznfmonY XCknj8hv6l0+sLytVoDvBlAG8zw+YlgoUaPC033jvWmRMmd3wG4WAg0SN95nxmW6uVvR eQofOZ9Tc6WftDOJwgDE7zXJWAWwNOX0r+sdWTXWNXVtSF/IQ75DKXhg+F4ClAiwzHzb 0vgw== X-Gm-Message-State: AOJu0YxTucXV1U/dqfeR0UiW5uay4rs2XOF2ytS9A0foywryll+FGxjx bLlDCHznCvxDfx2NTHyXzHvRqmsZmpLK+buJl5t4tS2TQsWOGbf1pw1jh+Nh8y1FRvgOJb3EjMr 9oSH9wQ== X-Gm-Gg: ASbGnctn26/ICfvWnQPgD/mDgAQRGMSbxR/XSbdqRsOzpk9Jw8OHTTWqFFFS6wlY8jO aeH5Nsp40DQcYztbwTtG2pyDSycykCctH/x8owwCMI6ODUiP105t9kzX6vgwHYv6TDBsKp5M0XZ pk2ThO0OJL4SLFpqujH9W03IWB3mkEmkAI31FgbquQEjFnzKEy/C6EUj2UOcmAFgcyEaUnlv6dz TeUg2xT282yHS+BJNrp4hHY/PHTySEwS53KFoZnGegS1B2bisTmDeUEWAuEGi/fg4inWQjee5dO kG033jtYTzijwUCrIliteuzLMWU/AS8= X-Received: by 2002:a5d:6da3:0:b0:386:32ea:e70d with SMTP id ffacd0b85a97d-38a223fd30dmr29606830f8f.50.1735842335194; Thu, 02 Jan 2025 10:25:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e2f9sm39723531f8f.81.2025.01.02.10.25.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 10:25:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , Pierrick Bouvier , Riku Voipio , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] accel/tcg: Factor out common tcg_exec_reset() helper Date: Thu, 2 Jan 2025 19:25:20 +0100 Message-ID: <20250102182521.65428-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102182521.65428-1-philmd@linaro.org> References: <20250102182521.65428-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Since tcg_cpu_reset_hold() is a system emulation specific helper, factor tcg_exec_reset() out so we can use it from user emulation, similarly to the [un]realize() handlers. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 1 + accel/tcg/cpu-exec-common.c | 6 ++++++ accel/tcg/tcg-accel-ops.c | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index c8d714256cb..8b474fc1256 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -55,6 +55,7 @@ void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, bool tcg_exec_realizefn(CPUState *cpu, Error **errp); void tcg_exec_unrealizefn(CPUState *cpu); +void tcg_exec_reset(CPUState *cpu); /* current cflags for hashing/comparison */ uint32_t curr_cflags(CPUState *cpu); diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 6ecfc4e7c21..72ab9c3d977 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -21,6 +21,7 @@ #include "system/cpus.h" #include "system/tcg.h" #include "qemu/plugin.h" +#include "exec/tb-flush.h" #include "internal-common.h" bool tcg_allowed; @@ -56,3 +57,8 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index = EXCP_ATOMIC; cpu_loop_exit_restore(cpu, pc); } + +void tcg_exec_reset(CPUState *cpu) +{ + tcg_flush_jmp_cache(cpu); +} diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 6e3f1fa92b2..4fe6821b017 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -34,7 +34,6 @@ #include "qemu/timer.h" #include "exec/exec-all.h" #include "exec/hwaddr.h" -#include "exec/tb-flush.h" #include "exec/translation-block.h" #include "gdbstub/enums.h" @@ -44,6 +43,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 */ @@ -83,7 +83,7 @@ int tcg_cpu_exec(CPUState *cpu) static void tcg_cpu_reset_hold(CPUState *cpu) { - tcg_flush_jmp_cache(cpu); + tcg_exec_reset(cpu); tlb_flush(cpu); }