From patchwork Thu Jan 5 16:43:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 639269 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp320970pvb; Thu, 5 Jan 2023 08:45:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+jjTEonpF1lqgTfMCFt8AfFCBaqDv1/vCtB6WMvHg4qaMIxAXFHYpThy//O2a5roeA477 X-Received: by 2002:ad4:4514:0:b0:531:c610:b6a6 with SMTP id k20-20020ad44514000000b00531c610b6a6mr20767263qvu.32.1672937110322; Thu, 05 Jan 2023 08:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937110; cv=none; d=google.com; s=arc-20160816; b=fkhW0V4CD/yH2fFr+prGxu2aiFuEw2q2uk+ygZ8BhkLm39EXp9hh93qym4JJWp/+Uy 9c9j+7cyyECunHJ9Asst8gQVfTV3vFVMik383XCNLbM9+TuU/HEHtlmh9JhCrxZnmOGA znv9iDd+ut2lneVwKRy2ca1pi9P8bNxQcFUKQF1qobxXbWrR89D39jS9DYynLdmZ7Fe8 aWQzlbhtehz2/K3fdhWNlnSf+6lAAo7RREyIK9C0nZqoGfgqRl615Q35JVK6hpqQLEqV yOndJfP/2DVIUKbxxzWkZNOrStl4d6BIGSdLgDVDOkSFT8WRXhKFxHWPJocZNIzzGKPn SGDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=sWBghNRfs+o8f2uXTrle+6cdLR5bpS0KuHksMIrrbp4=; b=bydTtHMsP21W3AmPcdQ5/OnM79AQDe+O1n2s1HpSgurgCh+ff0dZ9MoXLsJzV1IGbw zFhJkHUCcS3TG8Svg+3UDa/KbBoofzoqepYC4MDSdnsEhgUAeg8Ew7ojawiTuIDjnVqg 68Y81btJ6w1CYuMpUXru2RHLeH5qsnTRjOVmQT9IZ5L655YUpxwazC5xEGnuGXq4x/0O oQTVMB7OvX33qGpRGoGyO1buJEEEtlxXACrdYT2/Aszca7zGxuL4SjYp68ghlQHabcjn xkLTfQDXbwUZqUeAznlOZRU5eaYalWM2Dm8yyGiNJU2KqyoN68uMz8Jv4tuuwy4dRWQn 6aFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XkdT0d8U; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t64-20020a375f43000000b006ff85e546dasi18809969qkb.75.2023.01.05.08.45.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:45:10 -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=XkdT0d8U; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDTL8-00077w-Ul; Thu, 05 Jan 2023 11:43:38 -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 1pDTL7-00073N-AF for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:43:37 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTKw-0006yT-EL for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:43:36 -0500 Received: by mail-wm1-x334.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so1745352wmb.2 for ; Thu, 05 Jan 2023 08:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=sWBghNRfs+o8f2uXTrle+6cdLR5bpS0KuHksMIrrbp4=; b=XkdT0d8UhLfUe0zMZTzoskefBa8BP3bXjtPMyvTZFgOlxQvZLOTGb8VCO6jtm7NqVY ysMbwMZbX9kChrhO9s/9274o0YRHvUrj2P66ruX+hTM5r+3F7o+yJY0/H6JjkQT24GiD olkXurjvm36Dcsch44Z90u3JbowGLghvouYjtoqcKWU6OqHQeCBb70MWxWIqvQ6QMkji ghx+hkPg22bQsLataXoC7H3ef6k3l7nXdSaBS+G41qZSM/0EaSLKBdaZ+h68DjNd2uwn X3Vk5OYtgWdxSEJSje7z3ZCyBHdPszvGcfmQS4nl1ZzLhn0q4NVfbXVxBC7bFQwuP6fm HsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=sWBghNRfs+o8f2uXTrle+6cdLR5bpS0KuHksMIrrbp4=; b=N6oJVpYFr5NR3WPjRG/YOej0uF8GC3l4GNrxp0RPIyTfxF4c4+y9WzB9M0lIlIUqx8 RR8Jjd2Aui+eyXzBaIO5zF1qny9pI7wC+ts+SS72ArFNolzJTA9jRF+Z2yOdhZtfLdqq 8OaoMWHO+AkrrjojpdGL/AiLazMkF1CWTdhF60x7aPFvQcgnOJk220I+ySH+OR0Bbhus iW3hnPWxHSQz+kMQOaFCobVedGbMyLqkhwZm6kOBWqwqig2UOytjZVXl0k6MRtAa+4LF 1JON2OcnxIzvwSKI2Z8emzuGHopy0DCjhaCJfXB6XWLlpNeVDFCdUrKyiyz4LrvXLyH6 qOQA== X-Gm-Message-State: AFqh2krq6FwaxH07DSJ6PGpGaJEQ3EKSvhvPUKYySaD0HNA4qVfTQ8O7 IkHLrWMmyFvIljtSVNqt7ZoS1g== X-Received: by 2002:a05:600c:3acc:b0:3d9:a145:91a with SMTP id d12-20020a05600c3acc00b003d9a145091amr15821976wms.28.1672937004776; Thu, 05 Jan 2023 08:43:24 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c458700b003c6b7f5567csm8330565wmo.0.2023.01.05.08.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:43:22 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C91621FFBF; Thu, 5 Jan 2023 16:43:20 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org, alex.bennee@gmail.com Cc: David Hildenbrand , Sunil Muthuswamy , Aurelien Jarno , Michael Rolnik , Aleksandar Rikalo , Greg Kurz , Ilya Leoshkevich , Thomas Huth , qemu-ppc@nongnu.org, Laurent Vivier , Max Filippov , Yanan Wang , Marek Vasut , Stafford Horne , Peter Maydell , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?Alex_Benn=C3=A9e?= , Taylor Simpson , Marcel Apfelbaum , Alexandre Iooss , Chris Wulff , Richard Henderson , Eduardo Habkost , Song Gao , Mark Cave-Ayland , =?utf-8?q?C=C3=A9dric_Le_?= =?utf-8?q?Goater?= , Artyom Tarasenko , Paolo Bonzini , qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Alistair Francis , "Edgar E. Iglesias" , Bastian Koppelmann , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Mahmoud Mandour , David Gibson , Yoshinori Sato , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH v2 07/21] includes: move tb_flush into its own header Date: Thu, 5 Jan 2023 16:43:06 +0000 Message-Id: <20230105164320.2164095-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230105164320.2164095-1-alex.bennee@linaro.org> References: <20230105164320.2164095-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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 This aids subsystems (like gdbstub) that want to trigger a flush without pulling target specific headers. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- v2 - actually include the header and rename to tb-flush.h - better kerneldoc style comment for the function --- include/exec/exec-all.h | 1 - include/exec/tb-flush.h | 26 ++++++++++++++++++++++++++ linux-user/user-internals.h | 1 + accel/stubs/tcg-stub.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/translate-all.c | 1 + cpu.c | 1 + gdbstub/gdbstub.c | 1 + hw/ppc/spapr_hcall.c | 1 + plugins/core.c | 1 + plugins/loader.c | 2 +- target/alpha/sys_helper.c | 1 + target/riscv/csr.c | 1 + 13 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 include/exec/tb-flush.h diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 25e11b0a8d..b4a893648c 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -685,7 +685,6 @@ void tb_invalidate_phys_addr(target_ulong addr); #else void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); #endif -void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end); void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr); diff --git a/include/exec/tb-flush.h b/include/exec/tb-flush.h new file mode 100644 index 0000000000..d92d06565b --- /dev/null +++ b/include/exec/tb-flush.h @@ -0,0 +1,26 @@ +/* + * tb-flush prototype for use by the rest of the system. + * + * Copyright (c) 2022 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef _TB_FLUSH_H_ +#define _TB_FLUSH_H_ + +/** + * tb_flush() - flush all translation blocks + * @cs: CPUState (must be valid, but treated as anonymous pointer) + * + * Used to flush all the translation blocks in the system. Sometimes + * it is simpler to flush everything than work out which individual + * translations are now invalid and ensure they are not called + * anymore. + * + * tb_flush() takes care of running the flush in an exclusive context + * if it is not already running in one. This means no guest code will + * run until this complete. + */ +void tb_flush(CPUState *cs); + +#endif /* _TB_FLUSH_H_ */ diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index 0280e76add..ea11549c41 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -20,6 +20,7 @@ #include "exec/user/thunk.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "qemu/log.h" extern char *exec_path; diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index c1b05767c0..e0d371c3a7 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "exec/tb-flush.h" #include "exec/exec-all.h" void tb_flush(CPUState *cpu) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 1b8e860647..1d7435bfc2 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -22,6 +22,7 @@ #include "exec/cputlb.h" #include "exec/log.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "exec/translate-all.h" #include "sysemu/tcg.h" #include "tcg/tcg.h" diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 51ac1f6c84..ff7cc87f1f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -47,6 +47,7 @@ #include "exec/cputlb.h" #include "exec/translate-all.h" #include "exec/translator.h" +#include "exec/tb-flush.h" #include "qemu/bitmap.h" #include "qemu/qemu-print.h" #include "qemu/timer.h" diff --git a/cpu.c b/cpu.c index 4a7d865427..1a374ac4a8 100644 --- a/cpu.c +++ b/cpu.c @@ -36,6 +36,7 @@ #include "sysemu/replay.h" #include "exec/cpu-common.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "exec/translate-all.h" #include "exec/log.h" #include "hw/core/accel-cpu.h" diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 505beafad7..92b2f5c3db 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -46,6 +46,7 @@ #include "sysemu/runstate.h" #include "semihosting/semihost.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "exec/hwaddr.h" #include "sysemu/replay.h" diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 925ff523cc..ec4def62f8 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -8,6 +8,7 @@ #include "qemu/module.h" #include "qemu/error-report.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "helper_regs.h" #include "hw/ppc/ppc.h" #include "hw/ppc/spapr.h" diff --git a/plugins/core.c b/plugins/core.c index ccb770a485..584b5f3c5e 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -24,6 +24,7 @@ #include "exec/cpu-common.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "exec/helper-proto.h" #include "tcg/tcg.h" #include "tcg/tcg-op.h" diff --git a/plugins/loader.c b/plugins/loader.c index 88c30bde2d..809f3f9b13 100644 --- a/plugins/loader.c +++ b/plugins/loader.c @@ -29,7 +29,7 @@ #include "qemu/plugin.h" #include "qemu/memalign.h" #include "hw/core/cpu.h" -#include "exec/exec-all.h" +#include "exec/tb-flush.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" #endif diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c index 25f6cb8894..c83c92dd4c 100644 --- a/target/alpha/sys_helper.c +++ b/target/alpha/sys_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "exec/helper-proto.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 5c9a7ee287..b02a536bbc 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -25,6 +25,7 @@ #include "time_helper.h" #include "qemu/main-loop.h" #include "exec/exec-all.h" +#include "exec/tb-flush.h" #include "sysemu/cpu-timers.h" #include "qemu/guest-random.h" #include "qapi/error.h"