From patchwork Sat Jul 15 13:53:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703233 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157882wrt; Sat, 15 Jul 2023 06:57:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEuuWxesVuO7kWncX6JLg2GtEr5AmFS4/Nu+r06nkcpJhHEiAvZnZCmnx6Rhb0kPO5FMhWt X-Received: by 2002:a0c:f20c:0:b0:635:dc38:f6d6 with SMTP id h12-20020a0cf20c000000b00635dc38f6d6mr7150364qvk.21.1689429454290; Sat, 15 Jul 2023 06:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429454; cv=none; d=google.com; s=arc-20160816; b=JAsuVYDD21sEVHUVU/vZZGXI8NvkD3VW3yjeoztDC7kTX+WEAxxAmCbW837V7egC7c APRHWUofX5FW8idAAjHlfJq/YY2Qdoy0t/pHqxSZResRNkY2T2+fXD9dCtBy0+h8x07G oTSg+Ryu3Lqjm5BC/R9wu4nNyeNVZ4f2dGaDLKlIS9Spwun4WE+fUWLtPhIp4YDKtrYc Wbe3c4a4bX2Lgx3OIQh/p0l1r5C6YA9x3bXdDBni3LqLf+T74nu3VfTtk8jTQGZrK5VE MCu9sTNlDHp8yBp9uMPV1scsY45CeH3Dqdq+/2fb3r3PM9eWCkBRVALNfdC5mBfT+n9e TCqA== 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=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; fh=exhpOcIcC0vGFDagsg3ldbYWYFKMrGchVSllK9BlNPw=; b=QcX1cKf5C/7B9mfVhILsmxhYzRD1a1GVFRsS+Ko0R6LpKXm/dYecFyxpITEFn78oU3 TqZtgK+IK+U9gE/dTj0s1KQMAGUrsN0H/0Q3DG27am63SxOHxRgJomoe2g12My0xdhVz JtqEOlrN4JamcjWZSYBMlDh6Hy0h+e1ilfObLp70tQpENjgu1fKVMxDy+cSKP8ySpT0+ hR4VgKQUIzcyi38MERXQlPfjJbyse5Sk9tLMGy/CEh5YaaUU5Tzk/fXEs0SKAe4Kb4Fw 6O744GywN/xkKcIxTEZu2zfheEWSQIX3QW95Tbcn6fejhRRVbGBzF5myeqHdRb4mtDT1 0xyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKL0sVkP; 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 y1-20020a0ce041000000b00635fb8442a1si5820351qvk.314.2023.07.15.06.57.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:34 -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=UKL0sVkP; 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 1qKfll-0001OQ-1x; Sat, 15 Jul 2023 09:57:13 -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 1qKflb-00018I-D1 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflZ-0003UC-OK for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so26670805e9.0 for ; Sat, 15 Jul 2023 06:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429416; x=1692021416; 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=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; b=UKL0sVkPD5MSqpKA1oiDlkuHHXXIAaxMiwtf13zBQfJXzIYKZbTj6fAfHocoKqzs1a YWenrtWmrIHZsd8ddf0urAvr11i3iMBf7/M9SKdWUtLUjf716o7wnxjH/TKAcB2o62gq 0o9lWjLXqaRVuT52Jjw7g7g09s91sSGBynEjIpSLGelOGbqE7No+XIfIcF6Vt7t1svuS 5egGcuchWQ51tLrF+TsUxd4wFxa/7e9Lz0Gw6u9TmqVIZ3rFYFDGUoBMuqlxtyCsws8s 3Go2QsqJhHQMLmNCms4NTTQMP/XVWtE4a4Y6/Fvw38g929cazieJ5N599wBXRpLvhiVg JhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429416; x=1692021416; 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=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; b=HVF/iTdwmSdYOL28P/2FVvp2wcKfNQ6edIvs+2TZplG9/tdO/WbHBYfvnb9gK+lQkg uYsQi6/MkEvMEYo5ydIFaYnduspBuXoRQynMHWydx7vb8OlGeOh3Gma6tU74Qr40fW/g SAA5afyBpHf2WazFKx0vANGux2ti5+GHSxKV4NmZn912bc56i3XNueI1OHK8EuzubFBR MQAsI5z9daSpUkoht7fNQproalE1zX7MHK1xKobLXG4y7piGpqLmHi2Aerb5UieU2VV1 wEtm2PsWi1vn+Fhu21QaP5/LJrKUPBnO9uxTWubYAuucuZKf48nIwmd0x3xD5ZEDdTNm sLXw== X-Gm-Message-State: ABy/qLZQE8T7jQuF2LIsKQgUGqealmey6SEyzW8CjUteJSS0bvEZetEB QbejFU5IR6IqaLoW2nxF26N3C9o4Wi05+NF5MEqgnw== X-Received: by 2002:a5d:664d:0:b0:314:3954:7ff6 with SMTP id f13-20020a5d664d000000b0031439547ff6mr5781995wrw.56.1689429415852; Sat, 15 Jul 2023 06:56:55 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 47/47] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128 Date: Sat, 15 Jul 2023 14:53:17 +0100 Message-Id: <20230715135317.7219-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.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-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 We adjust CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 with CONFIG_ATOMIC128_OPT in atomic128.h. It is difficult to tell when those changes have been applied with the ifdef we must use with CONFIG_CMPXCHG128. So instead use HAVE_CMPXCHG128, which triggers -Werror-undef when the proper header has not been included. Improves tcg_gen_atomic_cmpxchg_i128 for s390x host, which requires CONFIG_ATOMIC128_OPT. Without this we fall back to EXCP_ATOMIC to single-step 128-bit atomics, which is slow enough to cause some tests to time out. Reported-by: Thomas Huth Tested-by: Thomas Huth Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 2 +- include/exec/helper-proto-common.h | 2 ++ accel/tcg/cputlb.c | 2 +- accel/tcg/user-exec.c | 2 +- tcg/tcg-op-ldst.c | 2 +- accel/tcg/atomic_common.c.inc | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 39e68007f9..186899a2c7 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -58,7 +58,7 @@ DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG, DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG, i64, env, i64, i64, i64, i32) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 DEF_HELPER_FLAGS_5(atomic_cmpxchgo_be, TCG_CALL_NO_WG, i128, env, i64, i128, i128, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgo_le, TCG_CALL_NO_WG, diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h index 4d4b022668..8b67170a22 100644 --- a/include/exec/helper-proto-common.h +++ b/include/exec/helper-proto-common.h @@ -7,6 +7,8 @@ #ifndef HELPER_PROTO_COMMON_H #define HELPER_PROTO_COMMON_H +#include "qemu/atomic128.h" /* for HAVE_CMPXCHG128 */ + #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-proto.h.inc" #undef HELPER_H diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c2b81ec569..e0079c9a9d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -3105,7 +3105,7 @@ void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index df60c7d673..ac38c2bf96 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -1433,7 +1433,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, vaddr addr, MemOpIdx oi, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 0fcc1618e5..d54c305598 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -778,7 +778,7 @@ typedef void (*gen_atomic_op_i64)(TCGv_i64, TCGv_env, TCGv_i64, #else # define WITH_ATOMIC64(X) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 # define WITH_ATOMIC128(X) X, #else # define WITH_ATOMIC128(X) diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index ee222fd7e7..95a5c5ff12 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -41,7 +41,7 @@ CMPXCHG_HELPER(cmpxchgq_be, uint64_t) CMPXCHG_HELPER(cmpxchgq_le, uint64_t) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 CMPXCHG_HELPER(cmpxchgo_be, Int128) CMPXCHG_HELPER(cmpxchgo_le, Int128) #endif