From patchwork Mon Dec 11 21:19:57 2023 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: 752542 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1549087wrs; Mon, 11 Dec 2023 13:27:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHL/li4FdqvQK470wyFEXko1BFOwlopfcVfnjM1C6H6IrTZEoT7XHmNP24lXAa7kch38ljy X-Received: by 2002:a05:620a:c0a:b0:77e:fba3:9d23 with SMTP id l10-20020a05620a0c0a00b0077efba39d23mr4750903qki.135.1702330070617; Mon, 11 Dec 2023 13:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702330070; cv=none; d=google.com; s=arc-20160816; b=DaAggUK5NUfwtp4o7cGxU7+1EsVGorj53OR+z5ol4FIinnkJQEMhNYvadhbCtL/2dh FEuJTXK1VDBFgKi1RCPEqFIwTpT0SQfJuoBcR6kPuw64D3fNQqWGmLQATOuTAYet5jkt CPhYOPT+ceai4V9vo5i80qjFOYjC5eVwSKO3Pe8bozZsSzJiTlZBmOcAwJAuNFuWqn9o zLClgSM/kDwl3Vg/eJedqh0RIs4Qxi06cSoS86cAeYRbzX/uWS2Bidp2z0Ew/n5Hc9jC aEsFWk1dN45IJ1uFQ5pDiPS31lMiI62x+L5vHKfKt73DwSQKejTzHKpr5xCiIqyQjOkC yWhw== 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=t6uthcvrcMhZYh7TDKG7c2NiXaXu0mJGOW4mt+82VSg=; fh=6uA3yvXeN55FEhLQ+7xhayEyGzy+Y3z2qOYV5oRrcR8=; b=tvRWMsSJJggpB3PWkRAMTzehoXax8dnI85aT6thj0K1BpreGKY2oU3/+mkoRhtx0P0 rAMfztBgFYy00oGbbe8+LnQAqii7MYSslVW/Ma+o05uq89aFTXbTWl1DSEAIVpZ0In78 U6AXi+OwZzXGGPlUANMP0LUalT+UKb9rspyjP+U+y9iDsDElUCwYL1/EXaNA0b6kBD74 ASeEOtx4Gv0buWiO1VEdqnsnoy01bcFO9/xzZhBZ1DBKodko6ALMrFBZsmiAGb50l5tv NOL2XvbJFh2DbvBSG9++1Flv597teroUzKjxddRefr2uLYnSba+niltkfseQsjIMBAla W5Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bPZHzTPr; 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 j9-20020a05620a410900b0077efd646e89si9314269qko.634.2023.12.11.13.27.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Dec 2023 13:27:50 -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=bPZHzTPr; 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 1rCnjx-0004tm-AN; Mon, 11 Dec 2023 16:23:01 -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 1rCnju-0004oL-Sn for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:22:58 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rCnjq-0005on-S3 for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:22:58 -0500 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a1e35c2807fso661961266b.3 for ; Mon, 11 Dec 2023 13:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702329771; x=1702934571; 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=t6uthcvrcMhZYh7TDKG7c2NiXaXu0mJGOW4mt+82VSg=; b=bPZHzTPrBMqsZQgq+L+fsyRS5L0K8Uuinr0Y1f19IGXTtPwEYVT1ySFYRj/IzFrbWS V9/kliGFEkRrogO3xWCb8n9UcRLYkmLDL5wj3YDWCWpl6z9fxj9XVBio2U1BheViFwfF nChIz+gnd1Xb+tq7ciC1n9V74a9DgtXjuMD4rBbQrTk2eukbUrJg8VlMKVavFW6xKuRC O6VTN8SzJE0FEHL3zaOn4ankuNseIKpMUfkzHmwjlab5MSUlJ0+e7bl3H2WniKAxIeOY x69ujnLHhxRPG3SSoZzHMeAAf1SqCuTut9Lv33ngp9OchzED7aqbL7QaAik61egyjKDk Vd4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702329771; x=1702934571; 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=t6uthcvrcMhZYh7TDKG7c2NiXaXu0mJGOW4mt+82VSg=; b=nEl4AayIi0D+pk0Ju+U931k0Rs4WrJju45qtfJ1rqXS80U5WXpO21T0B1J7vfH3GiO Zlk80/ewX3M3gGavHOoYKC9kBq6YbAAE1Lqc28aHCei1M984E/X7CpTlG5aYTaJMuD4F tEZXES7NQ2783P0fmyYrtTx+0MiZj8rFLwI2JhX1hWmozxKZRuzAS05CzJ8tLiQanxmp ggmiuqjLrzu5ooK7H9JRbByfOcPjX7PgqoCFIiHIPhUop8pQIZcobt2tCWTF54YWhZCc Greo+bZUAgnmxMVBIVrSvnsmOQ8jQsnKPmvR1aU/bWvHfKvpx8TXg5wQSwXfS1uwou7V 8OLg== X-Gm-Message-State: AOJu0YzVS8DKMpANLoVNPxIEbCYYyV+WwiYy3obtGot0DnCLy1udUlZn J8/CzzYPSa33BJf09w7Ifdth6aesiGLhrdyXSJjsPw== X-Received: by 2002:a17:906:284:b0:a19:940f:b9d3 with SMTP id 4-20020a170906028400b00a19940fb9d3mr2189538ejf.25.1702329771198; Mon, 11 Dec 2023 13:22:51 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id tj10-20020a170907c24a00b00a1db7b77675sm5407638ejc.90.2023.12.11.13.22.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Dec 2023 13:22:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Peter Xu , Liu Zhiwei , Peter Maydell , Mark Cave-Ayland , Eduardo Habkost , qemu-arm@nongnu.org, Paolo Bonzini , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-riscv@nongnu.org, David Hildenbrand , Warner Losh , Claudio Fontana , Brian Cain , Daniel Henrique Barboza , Richard Henderson , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 20/24] exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header Date: Mon, 11 Dec 2023 22:19:57 +0100 Message-ID: <20231211212003.21686-21-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211212003.21686-1-philmd@linaro.org> References: <20231211212003.21686-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=philmd@linaro.org; helo=mail-ej1-x62e.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 The abi_ptr type is declared in "exec/cpu_ldst.h" with all the load/store helpers. Some source files requiring abi_ptr type don't need the load/store helpers. In order to simplify, create a new "tcg/abi_ptr.h" header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/exec/cpu_ldst.h | 17 +++-------------- include/exec/exec-all.h | 1 + include/exec/translator.h | 5 ++++- include/tcg/abi_ptr.h | 32 ++++++++++++++++++++++++++++++++ accel/tcg/cputlb.c | 1 + 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 include/tcg/abi_ptr.h diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 25e7239cc5..c69f02b699 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -65,18 +65,9 @@ #include "exec/memopidx.h" #include "qemu/int128.h" #include "cpu.h" +#include "tcg/abi_ptr.h" #if defined(CONFIG_USER_ONLY) -/* sparc32plus has 64bit long but 32bit space address - * this can make bad result with g2h() and h2g() - */ -#if TARGET_VIRT_ADDR_SPACE_BITS <= 32 -typedef uint32_t abi_ptr; -#define TARGET_ABI_FMT_ptr "%x" -#else -typedef uint64_t abi_ptr; -#define TARGET_ABI_FMT_ptr "%"PRIx64 -#endif #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x) @@ -120,10 +111,8 @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len) assert(h2g_valid(x)); \ h2g_nocheck(x); \ }) -#else -typedef target_ulong abi_ptr; -#define TARGET_ABI_FMT_ptr TARGET_FMT_lx -#endif + +#endif /* CONFIG_USER_ONLY */ uint32_t cpu_ldub_data(CPUArchState *env, abi_ptr ptr); int cpu_ldsb_data(CPUArchState *env, abi_ptr ptr); diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index df3d93a2e2..6a634c0889 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -22,6 +22,7 @@ #include "cpu.h" #if defined(CONFIG_USER_ONLY) +#include "tcg/abi_ptr.h" #include "exec/cpu_ldst.h" #endif #include "exec/translation-block.h" diff --git a/include/exec/translator.h b/include/exec/translator.h index 6d3f59d095..16d2449292 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -19,7 +19,10 @@ */ #include "qemu/bswap.h" -#include "exec/cpu_ldst.h" /* for abi_ptr */ +#include "exec/cpu-common.h" +#include "exec/cpu-defs.h" +#include "cpu.h" +#include "tcg/abi_ptr.h" /** * gen_intermediate_code diff --git a/include/tcg/abi_ptr.h b/include/tcg/abi_ptr.h new file mode 100644 index 0000000000..415e31cabb --- /dev/null +++ b/include/tcg/abi_ptr.h @@ -0,0 +1,32 @@ +/* + * TCG abi_ptr type + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ +#ifndef TCG_ABI_PTR_H +#define TCG_ABI_PTR_H + +#include "cpu-param.h" + +#if defined(CONFIG_USER_ONLY) +/* sparc32plus has 64bit long but 32bit space address + * this can make bad result with g2h() and h2g() + */ +#if TARGET_VIRT_ADDR_SPACE_BITS <= 32 +typedef uint32_t abi_ptr; +#define TARGET_ABI_FMT_ptr "%x" +#else +typedef uint64_t abi_ptr; +#define TARGET_ABI_FMT_ptr "%"PRIx64 +#endif + +#else /* !CONFIG_USER_ONLY */ + +#include "exec/target_long.h" + +typedef target_ulong abi_ptr; +#define TARGET_ABI_FMT_ptr TARGET_FMT_lx + +#endif /* !CONFIG_USER_ONLY */ + +#endif diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index db3f93fda9..c4500d3261 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -41,6 +41,7 @@ #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" #endif +#include "tcg/abi_ptr.h" #include "tcg/tcg-ldst.h" #include "tcg/oversized-guest.h"