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: 781132 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1998384wrs; Tue, 19 Mar 2024 08:51:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBulFRunbe1PYlqk8R4s5QDj/QpeScjFXrm/etaRnTNut3mIX8hARJ2pZ6eCvqwwxkgBQJohtzQD8niCQNupEV X-Google-Smtp-Source: AGHT+IFJwq/W3HdpqIfCaK6x8PcPUj8f4uTAVzDnjKExJL4jC5iFyinu7Qxn8LLshTl8p+/TwpaI X-Received: by 2002:ae9:e41a:0:b0:789:d43b:3702 with SMTP id q26-20020ae9e41a000000b00789d43b3702mr16398037qkc.59.1710863482163; Tue, 19 Mar 2024 08:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710863482; cv=none; d=google.com; s=arc-20160816; b=RFRVnVUOyKIrCwYtKv71ZuH0l4PXwrWpvoPQHm6FubLbP6p/sJPT/XAb7bZwkHBJs/ EPmdb2Ue1g70OOK+e033G9RvhrHftW/E+Q+ZAFYbWUA7uHVAqAQmWZ/JdPJfke6aPZoT bu5QDRdtSVOOl4aUqDkpWvS1bQ8uPTwQCBXpjXLsjfN2RQ9Yz5YsD7FvwhHZmXibdfa3 Xyb37ZRATv1qIA28/OE1WYCRKL6zHhqpyMpLvgxWBi9uIQx71+OYVbkgy9fu+5NJJm0d BQ4JQPbjMDv3mVkDRnJghCQTJY6hC0JpfEUwcvY6Byvsc1GN1Re56VMvg6PXvG/bPPum zXsg== 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=NFX4++ImuD2EMXqBk24v8xDkpJQsfeFGsz4R2q2Dmzg=; fh=29miLo/05aoBg0FXoBKcg0HwkOWF5H76kS5MePHzFjo=; b=FtJBYHpKlCHACgKldpWKFDe1V1ai/BIR8bPBuzaNK4VatCLi9+39qghm6xjgCuLZdD 5Vrmam1mUJcM9H0BVRU1KjjiORug2PkMDN9kIKULPZzvGbAVpeBndfag5eA7dda9ntyq FwhsDZy6+fS6teQngqI2Gu8Zk4E7yMzHm66lspfHAshQ97869NAQ5yrDyw87FJMKuIxO H7LXTYLgG+a5Pzgx2AfTsWitaonqwq4eAL7zzAZYrTx5inID2BP0HbdBpMjL4CllcwNp N6zTa3fnIWRJ0xDaCUy7w0rlqOLvTlQXfYWtUy+uZbwYP5flsMRqDI3324+Y4JG2fmkJ YH2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v7Nl1bsE; 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 z13-20020a05620a100d00b00787bb6786d9si11605539qkj.513.2024.03.19.08.51.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2024 08:51:22 -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=@linaro.org header.s=google header.b=v7Nl1bsE; 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 1rmbeH-0000iQ-My; Tue, 19 Mar 2024 11:45:09 -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 1rmbdz-0007uZ-Mx for qemu-devel@nongnu.org; Tue, 19 Mar 2024 11:44:52 -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-0005N6-L1 for qemu-devel@nongnu.org; Tue, 19 Mar 2024 11:44:50 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-414617882b3so10530275e9.3 for ; Tue, 19 Mar 2024 08:44:46 -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=JxmH7Srpji0w4rwxrDrjqqw7ylzBRIhUA534+QK6b97aNaadAQ9Q01IitrHOqXdLbV Ls1V4Rd455CMBHiYw0Ui7r/E3pPLNldOHIb/vtcH3AKEr4UdYSQqbwWwgni6O5peQ83E GHeArX/TGyROtxYxlDZimSLAneZ1Nh9IF+TKwBjubdmfP6SqTdXIdUciKC5B2DvHloVZ /XZoAZKErc9E6x94vnwr2uOeLLiGxvusk4hoIdG5ePGTKmbSveYUzmD5OlYQRlg5RqJj /E3BD5YMueN1c0a182u0U0MpegrfvTBkj3TRTlEiTcx+h/QtBBxnZoOOv3zl4NOmQ/0I OM0g== X-Gm-Message-State: AOJu0YxTV1ljhIFm1SDElVD+qyCjAEHDKFi0xqGfHT9uelsZyygLOI9p cEt7FXpBl6jHkSIKwlWwO6/TswS8GioIdaKagKQqLhQUFji7CGa2SqlOv1t47PGCR66i8fIigj+ l 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=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 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) {