From patchwork Tue Mar 11 12:57:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 872448 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:4124:b0:290:25b2:841c with SMTP id u36csp1945878ltt; Tue, 11 Mar 2025 06:13:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhiS8j2gVB5tivkl5WkqzAVRYPGVj1uRVSZxhJ99oMu6VV4SycIosQHqBALxofTfuAw6gXKA==@linaro.org X-Google-Smtp-Source: AGHT+IEKacbPiND1uZ4eSeT+XyGz6nZM58Ke3vSbd+FdxwZexdYsip79M4tBUbcNwLcjBQK8nb/E X-Received: by 2002:a05:600c:1c17:b0:43c:ec28:d310 with SMTP id 5b1f17b1804b1-43d01bdd1d0mr56597625e9.10.1741698787548; Tue, 11 Mar 2025 06:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741698787; cv=none; d=google.com; s=arc-20240605; b=BAHwKHNgpmw0XRr+MyeGIz/t/u29AU8eUOGELVvXIi7KG64it5Md+DjgaBCJnMIbcl AviVFo3aepJg/m/wMoU8h1Jw+1kVlQUkBScqf9sMv+LsqpP6xAbkDlE3BD1PwHscw5zk eC1UWC11V+Pio3vkyQBZ55F2L5IXU0DNmqWqEP9NlM0HyWGLY/PW3rwJ3IIfo2B1C6H/ ggVW8V91NKkpHFC/Pq8Vf5TkA9U7EnrPnTt3sZ6vAGA3LqHy5ysmaD1kvIb/x/l7iFbE DDG/PqTVv9rr/Ya/Jpa6YzL5m+0KSPZ5XX/kjzVitdOdMuZqTv/0MFLEzU7Z0jhmLcNq o2Qg== 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=VyPpxpR1LPgC7kHmIhSLHr8dyizfyqPn+5SkC4Qa1kM=; fh=PkF7jflgJiZpfPxT2d1/BQy11Jk+ja8ZZBdWooMT1pU=; b=LxgkBUayUPk0zqh13ZIViTBa8p3e2fjnUsMmmqycGFt+3q2fOSkCF6tx+Kt5M4gRcF uaknybGFqTrzgulNcfScV/mEspXvzBedN0K/mboAxAAKysuhNU6BkvQ7C+18Iwr5zCu4 f3wJ7G9W0j8sWOgBH8svoRXxK9Q9vaP7W1UpEyYJNkZeqW05ex6NzyQlf2+2WxAhjgfd 9eCrYijVrUyy7kZEzdlU0NzFJcRk7YdQrkTRjRSGc5Vg/osrLrgo8uLmI1/QmfAp5EQd UELPHMeFft0AmpAP6PJVWft7LjxPtr1nRd/v+irJliQLYRz+t4tqGPrkM2+3psqSbGJE 77fA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eb69PDmc; 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=QUARANTINE dis=NONE) header.from=gmail.com; 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 5b1f17b1804b1-43cfaecb68fsi45007945e9.21.2025.03.11.06.13.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Mar 2025 06:13:07 -0700 (PDT) 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=@gmail.com header.s=20230601 header.b=eb69PDmc; 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=QUARANTINE dis=NONE) header.from=gmail.com; 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 1trzJN-0004B4-Nv; Tue, 11 Mar 2025 09:06:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trzEB-0005HS-O1; Tue, 11 Mar 2025 09:01:04 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1trzE4-0000AK-NB; Tue, 11 Mar 2025 09:00:58 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-224341bbc1dso67994515ad.3; Tue, 11 Mar 2025 06:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741698051; x=1742302851; 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=VyPpxpR1LPgC7kHmIhSLHr8dyizfyqPn+5SkC4Qa1kM=; b=eb69PDmc6vgFL5ZGMpEkb/6i2Vb6ANHUT0/1zgouWOqdAJIZMQmqTrjh1BuBT6V+ua aSwtkdo7d7cm2cise4vFKrUK9eZgrvNYCuTS9SQ34kQHWt+LTAErsw+GdZyDC+1a7AYv jeGDJEgmU7mEaSGEzf89rLqgKLG4QkPJwQQ+ewqYfvQ6gEv6LoNltHtglWnZCnIqZ+Cj /vI3denqz7CA9Zl5wS5k23382xW+uImEslHyMAxfDti/i6lMh8/IItJtbiJoOPm7B6u1 BmhySgYv766x1l3XPSjgWwvGxR6ONRBzlWOfpD/XcvIuKUuXNLr7KNLGbzs16jU33FlU Rd6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741698051; x=1742302851; 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=VyPpxpR1LPgC7kHmIhSLHr8dyizfyqPn+5SkC4Qa1kM=; b=dBLpFqJxPXPy+2Kmi6Ky0ZjVAx/RpSKjVlZWPyQE26NFywZZMZtOscK9sYG9LuuBCp ott9VHRo6xBu7Xbwdx8Bi39i6ziIZE85RHSxs+tzZ3dM9qppTWLF15ic2L8PliNlapSz W9yeUpemkPZXPaLfmx2cRp6GDAdNid7yJLVoJKP+8Va8rXOlsN7rhbmUquh495r216T0 DNyH7HouvDwi/s2i3RlHcNSYco1+eqEkvZ8MRg4Pz+AMghXMP4bzdlQ7YsugRDYrmwAA 92nspWVqbaGj7Kmpl3q/bHK5WitawxBK9yR4+3hu3RYyw4Tbk40VrdSX3cRwAoDVi10H 4xwA== X-Forwarded-Encrypted: i=1; AJvYcCXohdBXpmIkIppv/mAraqR+QnWhjykf7WOHbxBDgmK4qJyZf1l/mMoRlqtW6jWGGVH0z7lL2m06gQ==@nongnu.org X-Gm-Message-State: AOJu0Yz4k3Y8ih8Uotb6UvBN1Gnp4/iPYxD8CrH9ewlRFxS+GxJ9QHrJ jzYgtTH0dEtZCvW2KF7pUkkwezi1/dXtvNAYwv1F3LbvPr5Y0FvNiPlwrA== X-Gm-Gg: ASbGncti2/TSZvvHusWKJGyPkg8dMIZDgt2utdFE/6MIV9NOVTkgc7/4JCXs412q4WL 4WDXBQKscmNi81SVIdPFfeo7PFiY3JvrED7LfbgNcVJ+OwmYYTt2JB67Ougsym2xxYEn+0lQ2jc y+AuakrGvwAenWjxK3LLwC9ogU4OObuyjj2EwYaJhFyripNlRSHLRYpBkQFVScmWO4VdZd1RL9T cug2PUMdZ26nsDyvmVQ69Ueyumm/9zDBZR2qQPyrO4JF1N8OKDPi3qPQER7TgE5jopV+FlDeu92 h+kHVQw3jSZvDcvCXHB81940gnhTJ5uVpEHIPhU1QGTlsCjgYXY= X-Received: by 2002:a17:902:c94d:b0:220:c066:94eb with SMTP id d9443c01a7336-22592e407damr48788845ad.25.1741698050538; Tue, 11 Mar 2025 06:00:50 -0700 (PDT) Received: from wheely.local0.net ([118.208.151.101]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ff4e773dddsm11822318a91.12.2025.03.11.06.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 06:00:50 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Harsh Prateek Bora Subject: [PULL 47/72] target/ppc: Restrict powerpc_checkstop() to TCG Date: Tue, 11 Mar 2025 22:57:41 +1000 Message-ID: <20250311125815.903177-48-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250311125815.903177-1-npiggin@gmail.com> References: <20250311125815.903177-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62b.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Expose powerpc_checkstop() prototype, and move it to tcg-excp_helper.c, only built when TCG is available. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Harsh Prateek Bora Message-ID: <20250127102620.39159-8-philmd@linaro.org> Signed-off-by: Nicholas Piggin --- target/ppc/excp_helper.c | 26 -------------------------- target/ppc/internal.h | 4 +++- target/ppc/tcg-excp_helper.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b08cd53688..236e5078f5 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -400,32 +400,6 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, target_ulong vector, } #ifdef CONFIG_TCG -/* - * This stops the machine and logs CPU state without killing QEMU (like - * cpu_abort()) because it is often a guest error as opposed to a QEMU error, - * so the machine can still be debugged. - */ -static G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason) -{ - CPUState *cs = env_cpu(env); - FILE *f; - - f = qemu_log_trylock(); - if (f) { - fprintf(f, "Entering checkstop state: %s\n", reason); - cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP); - qemu_log_unlock(f); - } - - /* - * This stops the machine and logs CPU state without killing QEMU - * (like cpu_abort()) so the machine can still be debugged (because - * it is often a guest error). - */ - qemu_system_guest_panicked(NULL); - cpu_loop_exit_noexc(cs); -} - #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) void helper_attn(CPUPPCState *env) { diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 46db6adfcf..62186bc1e6 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -289,7 +289,9 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, void ppc_cpu_debug_excp_handler(CPUState *cs); bool ppc_cpu_debug_check_breakpoint(CPUState *cs); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); -#endif + +G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); +#endif /* !CONFIG_USER_ONLY */ FIELD(GER_MSK, XMSK, 0, 4) FIELD(GER_MSK, YMSK, 4, 4) diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 6950b78774..93c2d6b5a0 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -17,7 +17,9 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "exec/cpu_ldst.h" +#include "system/runstate.h" #include "hw/ppc/ppc.h" #include "internal.h" @@ -199,6 +201,32 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) return false; } +/* + * This stops the machine and logs CPU state without killing QEMU (like + * cpu_abort()) because it is often a guest error as opposed to a QEMU error, + * so the machine can still be debugged. + */ +G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason) +{ + CPUState *cs = env_cpu(env); + FILE *f; + + f = qemu_log_trylock(); + if (f) { + fprintf(f, "Entering checkstop state: %s\n", reason); + cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP); + qemu_log_unlock(f); + } + + /* + * This stops the machine and logs CPU state without killing QEMU + * (like cpu_abort()) so the machine can still be debugged (because + * it is often a guest error). + */ + qemu_system_guest_panicked(NULL); + cpu_loop_exit_noexc(cs); +} + /* Return true iff byteswap is needed to load instruction */ static inline bool insn_need_byteswap(CPUArchState *env) {