From patchwork Tue Mar 19 15:42:47 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: 1913657 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=v7Nl1bsE; 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-ppc-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 4Tzbfq10sMz1yWs for ; Wed, 20 Mar 2024 02:46:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmbeF-0000YO-Nz; Tue, 19 Mar 2024 11:45:07 -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 1rmbdw-0007rh-3t for qemu-ppc@nongnu.org; Tue, 19 Mar 2024 11:44:50 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmbdu-0005Mv-9r for qemu-ppc@nongnu.org; Tue, 19 Mar 2024 11:44:47 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41412411622so15736015e9.2 for ; Tue, 19 Mar 2024 08:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710863085; x=1711467885; 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=NFX4++ImuD2EMXqBk24v8xDkpJQsfeFGsz4R2q2Dmzg=; b=v7Nl1bsEgu2N1g2/sg8QQa9gd/k9/esWP9SUTdz0DuVGtHzCGqe4yKZkSKfQjF0CUp b3p8YZADPWidLpE+Ck6dWeEg+Ra5gstFKgZd72IHLi7R/s2CA1PgNUqwsfdswFkr9WS5 EXFkzqfXotXmWfsR79J8rrOPUWozUb4SKt2gVjiSRyc5Hiz/D9JjcTIseQtaqubSG5r5 dOSd+9uVeyw8RXB9C2Ih/EPX4xEueMGLC1MU9kLsj+PC8m5v8wYqQfVKtcXutDbYPwT0 MXNOdkFi9rjoFJoXkqFOik2PEzBV5PhGNnWB//irbNqSTnVYnYEzxMxyeav+Nm9I9BvJ 7YlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710863085; x=1711467885; 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=NFX4++ImuD2EMXqBk24v8xDkpJQsfeFGsz4R2q2Dmzg=; b=f5sucl4hzAROU7rOEG/oQcvyNZwzM0rlxrhdKjJQn+jrCzoI3NIJAlhIKM//Kp1ieX LfZugeCy1oemxitys5btqhlgXE0kj1Bo7WoplEzy4lkNp9CLYLY1hLIeUgh+KwSAnC/W 5vJP/woGOe6EbDCHSzL/b4mPy1mM5WEjMVGy7ykbl/Bp3M3qHb3oYG+EjLe8G3w23TkX /dHW95meI3x1UuxB4T6Lm2m5nHv3I2y3yolf0ByLg3bOu70KYDnPLbRibvLwPunfLGQx 7mmvgSaVOb88MHLH7VBBuqIirMkyKNBeXMfdhnijppo2tSMT+ZiFniRuTiOwdGiNROIj E2yQ== X-Forwarded-Encrypted: i=1; AJvYcCVMKdzwKzNdKOTBzd7QDAnW1ahSBIjQ4HIpvRoNwAkObtB479C5++Jdb6/T5il4v9U1quGURmVwo4MJWBBeH6URkO8j X-Gm-Message-State: AOJu0YxBMsJiyGmO6b3X9Xg27Pjh0VScmIt8kC+CsFIm7bvhvy9L/GLl jzHUHwRSQANqAld4ZrRyiE/GVSjSoQ/5zd0fsJFaDyo3+dj6snfWmYfHb4cvdGk= X-Google-Smtp-Source: AGHT+IHzPpf9ptxXW9pOcfECwglVsTmJA1zwSgI/vuEbMPwyM7mqdsQjjpPqbYwc+XIFAqUwI2Ws7g== X-Received: by 2002:a05:600c:1c15:b0:414:c64:f3d0 with SMTP id j21-20020a05600c1c1500b004140c64f3d0mr5088397wms.27.1710863084853; Tue, 19 Mar 2024 08:44:44 -0700 (PDT) Received: from m1x-phil.lan ([176.176.166.129]) by smtp.gmail.com with ESMTPSA id n20-20020a05600c4f9400b00414610d9223sm4091610wmq.14.2024.03.19.08.44.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 19 Mar 2024 08:44:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [PATCH-for-9.1 18/27] target/ppc: Convert to TCGCPUOps::get_cpu_state() Date: Tue, 19 Mar 2024 16:42:47 +0100 Message-ID: <20240319154258.71206-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240319154258.71206-1-philmd@linaro.org> References: <20240319154258.71206-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Convert cpu_get_tb_cpu_state() to TCGCPUOps::get_cpu_state(), unifying with the method declared in target/ppc/helper_regs.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- target/ppc/cpu.h | 16 +++------------- target/ppc/cpu_init.c | 1 + target/ppc/helper_regs.c | 13 +++++++------ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index ced4e53024..6aa18db335 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2716,19 +2716,9 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer); */ #define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B)) -#define TARGET_HAS_CPU_GET_TB_CPU_STATE - -#ifdef CONFIG_DEBUG_TCG -void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *flags); -#else -static inline void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *flags) -{ - *pc = env->nip; - *cs_base = 0; - *flags = env->hflags; -} +#ifdef CONFIG_TCG +void ppc_get_cpu_state(CPUPPCState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *flags); #endif G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 464e91faa2..673559b444 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7362,6 +7362,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = { static const TCGCPUOps ppc_tcg_ops = { .initialize = ppc_translate_init, .restore_state_to_opc = ppc_restore_state_to_opc, + .get_cpu_state = ppc_get_cpu_state, #ifdef CONFIG_USER_ONLY .record_sigsegv = ppc_cpu_record_sigsegv, diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index 25258986e3..e62591067c 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -217,25 +217,26 @@ void hreg_update_pmu_hflags(CPUPPCState *env) env->hflags |= hreg_compute_pmu_hflags_value(env); } -#ifdef CONFIG_DEBUG_TCG -void cpu_get_tb_cpu_state(CPUPPCState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *flags) +#ifdef CONFIG_TCG +void ppc_get_cpu_state(CPUPPCState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *flags) { uint32_t hflags_current = env->hflags; - uint32_t hflags_rebuilt; *pc = env->nip; *cs_base = 0; *flags = hflags_current; - hflags_rebuilt = hreg_compute_hflags_value(env); +#ifdef CONFIG_DEBUG_TCG + uint32_t hflags_rebuilt = hreg_compute_hflags_value(env); if (unlikely(hflags_current != hflags_rebuilt)) { cpu_abort(env_cpu(env), "TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n", hflags_current, hflags_rebuilt); } -} #endif +} +#endif /* CONFIG_TCG */ void cpu_interrupt_exittb(CPUState *cs) {