From patchwork Thu Mar 2 19:08:27 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: 658127 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp64715wrb; Thu, 2 Mar 2023 11:10:03 -0800 (PST) X-Google-Smtp-Source: AK7set940kAJx5zbuXpKKFWIUxcHVKB7mwTUlrBBtzwyp1Yd69avzCUpMGt+oAuTYUNZHpIsOXIv X-Received: by 2002:a05:622a:14d2:b0:3bf:ce2f:576c with SMTP id u18-20020a05622a14d200b003bfce2f576cmr18959273qtx.66.1677784203686; Thu, 02 Mar 2023 11:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677784203; cv=none; d=google.com; s=arc-20160816; b=CTaFx5RDBkcSKj4Fv6XcGH6n3fKFSmJJs8/EHdNr5O9HvSyx1AxJkihBQc2yjueVKW 3PRmqxbMskrmAcDIzIeo7Vc6bVWiZep+YAo0485m7muNd2DpB/iZnSPCJTIKaDkiV7ti fAu0KlJvdDbw/okrHJj1kiPow4hOUBwnsB6cw7AY9zvoLUlQfT9pNQEahWqyIJjv2Uaf zVlqDALVjYRPZ8WrGA/CgCiskC44Hcpkt81ij06uG4vHHmZ6amZytAQGYulnibQKsCqj 8PfqilSLLBs5bGcbl37amf5fcgyNS4luOPC0bJ/czBWu20NVW/vZJLcxhMpioYZYualZ zPOA== 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=qHG5a70mU/vdhEiN0TqoaDRVD6IGcOS4m6Ff3FRj3Ls=; b=waAmmq9Sz798elNhlnZSkoK10hRHT39B8HuWbcOGQvzVbNKa4zP8AjwR8C5aTOxTAM 3iVqXCb2fYZLwhtMNbawudUR5va7ihIzD83VCke9SVSwDpyflXBDstqg596nZYzy336f /azESVxqmp7GABKpaE1ZVCgyZmZAYJfJ+5njZQIN2JSq0Y8XyA2Hp2x99a2yr4A8/22b M1iIPPmTaOuqplFko97iBLqyOQCALgQxVGyr4vMEXFaHBcJ+gX7jw/krMoNUuNfwrCSq EbIK/2l6hfW6iqjgxS406LyXxJDdOmqG1ykRgJpm3sNNZtX2+LAMDA2fhzA0LDoEjc0s EMzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eam2nW5g; 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 s39-20020a05622a1aa700b003bb746bb1e2si228904qtc.452.2023.03.02.11.10.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 11:10:03 -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=eam2nW5g; 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 1pXoIY-0007Qg-Gk; Thu, 02 Mar 2023 14:09:02 -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 1pXoIW-0007OA-RH for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:09:00 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXoIN-0004Vt-Gy for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:09:00 -0500 Received: by mail-wr1-x42b.google.com with SMTP id h14so142065wru.4 for ; Thu, 02 Mar 2023 11:08:50 -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=qHG5a70mU/vdhEiN0TqoaDRVD6IGcOS4m6Ff3FRj3Ls=; b=eam2nW5gIEG2rWFxXwZdk6Yl1SSbmX88rua4KYH8TdKEItiEx9DfKp/vx3K7u3+atP vjwW56bGByb9DjVP9B2EC9W0+R+FEVVQy6evbThDWlhIgT8H4YEFVcl5Zp5Wcy5VVPMr dVZKHKCbQOq84QYqfCx1IfxGaz/78cswscf6YtZv+KX1Yc+9oKvJEb5uGDBZQ/orUaUh GC/d2qEMlzf6euaI5bE8Jfu6O93K9LywpHQq9vk1c/97BkAUzywPFdsBDLFQ+Os8bXeY hW1LYtm/TzU/fI6Bs+b3jNoXjL84MMp06eJlJzcJBT/lFlvDazZjAbpkDv1PO6CkUmQc C56g== 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=qHG5a70mU/vdhEiN0TqoaDRVD6IGcOS4m6Ff3FRj3Ls=; b=1hs9XMm/e2VfaDbcGPe21y8e4UnDhJky+ePEgLiDvxfz8bvjx5FUxYH39ac8imA/iN Yy2eoXxMf3qLGPIMtBF9bXsPSq5QWXWwOYnUwfPN0pOaoQNBJKQ4T5brsvWyUzdxUrum PdQKAkNbln2snTA+SLxuwq2F9vGU/Xs+RCknuVAmEtnDvpMLMMqGakGUxlomfc0i6PXo yYSyQnPztrI5gOzN3L9QVqZMeK6U7YG7SeqZECbKTajLYWutKQRL7iYO/0TpiO4Fenp9 O6pRj1fHKVeKKachCLJXygAiqPcj49sMh5tE/U65+ueshLMYa3oY9g2mXhmQDrVYy0tg lV9Q== X-Gm-Message-State: AO0yUKWpDhQd2Xn8MljYk7n3RlOxsJ8Grs+gO0qhAsi0sISk8TRl5Fxt xhuTnIL/mpk5KdcxoZqwwT2nzA== X-Received: by 2002:a5d:60d2:0:b0:2c5:587e:75ba with SMTP id x18-20020a5d60d2000000b002c5587e75bamr7564414wrt.55.1677784129808; Thu, 02 Mar 2023 11:08:49 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s4-20020adff804000000b002c705058773sm135258wrp.74.2023.03.02.11.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:08:48 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 773D71FFBF; Thu, 2 Mar 2023 19:08:47 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Weiwei Li , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Palmer Dabbelt , Laurent Vivier , nicolas.eder@lauterbach.com, Ilya Leoshkevich , kvm@vger.kernel.org, "Edgar E. Iglesias" , David Gibson , Max Filippov , Sunil Muthuswamy , qemu-s390x@nongnu.org, Stafford Horne , Bin Meng , Marek Vasut , Greg Kurz , Song Gao , Aleksandar Rikalo , Liu Zhiwei , Alistair Francis , Chris Wulff , qemu-riscv@nongnu.org, Michael Rolnik , qemu-arm@nongnu.org, Cleber Rosa , Artyom Tarasenko , Marcel Apfelbaum , Eduardo Habkost , Yoshinori Sato , Alexandre Iooss , Daniel Henrique Barboza , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , mads@ynddal.dk, Mark Cave-Ayland , qemu-ppc@nongnu.org, Richard Henderson , John Snow , Xiaojuan Yang , Thomas Huth , Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno , Bastian Koppelmann , Yanan Wang , David Hildenbrand , Taylor Simpson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v4 07/26] includes: move tb_flush into its own header Date: Thu, 2 Mar 2023 19:08:27 +0000 Message-Id: <20230302190846.2593720-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302190846.2593720-1-alex.bennee@linaro.org> References: <20230302190846.2593720-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 v4 - update MAINTAINERS --- MAINTAINERS | 1 + 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 | 2 ++ 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 + 14 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 include/exec/tb-flush.h diff --git a/MAINTAINERS b/MAINTAINERS index 76662969d7..234800e3dc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -136,6 +136,7 @@ F: docs/devel/decodetree.rst F: docs/devel/tcg* F: include/exec/cpu*.h F: include/exec/exec-all.h +F: include/exec/tb-flush.h F: include/exec/helper*.h F: include/sysemu/cpus.h F: include/sysemu/tcg.h diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index e09254333d..ad9eb6067b 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -677,7 +677,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 3576da413f..9333db4f51 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 96af23dc5d..813695b402 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 efefa08ee1..7246c1c46b 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 4b5abc0f44..7096e68406 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/main-loop.h" diff --git a/cpu.c b/cpu.c index 2e9f931249..e6abc6c76c 100644 --- a/cpu.c +++ b/cpu.c @@ -36,6 +36,7 @@ #include "exec/replay-core.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 ef506faa8e..abb1777e73 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -47,6 +47,8 @@ #include "semihosting/semihost.h" #include "exec/exec-all.h" #include "exec/replay-core.h" +#include "exec/tb-flush.h" +#include "exec/hwaddr.h" #include "internals.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 e04ffa1ba4..04632886b9 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 1b0a0c1693..74c64d4902 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"