From patchwork Tue May 16 19:40:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682426 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp21124wrt; Tue, 16 May 2023 12:59:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BWQUv2Bm8hrLWqDmllpd2hy/yOQyDUrhW5h0kFoZRLI8AuCUK4o7tzRE41CMvIDmZWyq4 X-Received: by 2002:adf:ee0c:0:b0:2fd:c43a:b713 with SMTP id y12-20020adfee0c000000b002fdc43ab713mr28553466wrn.7.1684267182539; Tue, 16 May 2023 12:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684267182; cv=none; d=google.com; s=arc-20160816; b=k3pMCPaaOoyCR/WD0JHJe4DJU6pnOrvo/gv2lEJoTLBZONRykcl0WzW2vt+fTz41kA F6V5JMMmT467yh1C0CEl1n/+2OM70cEaSefCGjCGJFqGDiiE87Dcn8JNee95/kcamGyY O7MQdAG55i/Hu59QTR7oErFBD6LH1JWFAwCswZCIxN55w1IIKxl45PtxlBOVgiCe11lA k8oQ3LxcDBZOFWVZbm/YJNNqS9oOsxFa2jsbUxcqcVqlXTq8SDf2UB20+Y5kbMLbc6/E BH0hFT4jGRe+TI0scOLc8bkmHB7XUtCLhb82UxXWA8nqs38Fp09qUiDWrOE5IDSo40qu o2oQ== 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=WjHj7SEbww3DXTRNkJQIziiBJKKRW1RlTjQnuos+9yc=; b=URaPQJMZsvoEaIqKxd6y7lq5r76idkaPzMLINSYqfBI3g32siyuLD+LxrzMyCcp22H Cp2pK6k+UxRf682DGytE1nKLhM+1J/QHJv5jPlOR9sD7AWe/PHasrYDzergCCZpq3hLJ XOtkiG7bNAaMCSqsPO+2PgjtRIOmpNNjZsVvmTtemW6nHlX8lsr2lUHQRR9CxMez9xw4 N9L0+t66k3YELvkzXcQ3+78Xy0kPxevV2gnhpLySiXVuBpKf4Q8JigK3HuUVtF8A5nRQ odbUX3ZG6PwiEQDZg6wsau6XonPVQ059l6QXiNJhQrj3jwcVVllnzyCvndK1zHW1jLJD pWtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsiVpDJY; 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 z3-20020a5d44c3000000b00307acec2584si177709wrr.805.2023.05.16.12.59.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:59:42 -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=KsiVpDJY; 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 1pz0Yc-0006e0-RP; Tue, 16 May 2023 15:42:02 -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 1pz0Ya-0006cz-1v for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:00 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0YY-0002jf-40 for qemu-devel@nongnu.org; Tue, 16 May 2023 15:41:59 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-643a1fed360so9087809b3a.3 for ; Tue, 16 May 2023 12:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266117; x=1686858117; 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=WjHj7SEbww3DXTRNkJQIziiBJKKRW1RlTjQnuos+9yc=; b=KsiVpDJYD8d/RF/XrK5LWLpzgDuo7ljc4I+V7F2FZvX8E55ib6eiM61CFVukCliHUK qvtOimiXk25FcsAtWR3f8t7B/+aJzObJzNieC/HmodK6vJ0Ze7dZql9uce9PGr0n+Wyi qbr1eURBiJyEBAGaFkRwOsm62VkREDSP/6i/nGvXNlZxdc01xl3VUvcx2DWIKYJ4gFm+ ulc3NRLrqP9j1KZeqJ7/Ew2rgrCSVTRK+eFj3dSioTBxenqv3Ael+UMVcNgB2ZrQmMmq HzSrAkXdXFllKmqABWniSuOfEluWPqguzlB2MhbE4qnYovgCfGtrKf36ojmyO50ueYyU QoFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266117; x=1686858117; 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=WjHj7SEbww3DXTRNkJQIziiBJKKRW1RlTjQnuos+9yc=; b=PhYHQeCMw9WCcYuHiQ+ZkaYVt5bt0CAybPpGzZ41lciLpKhzN8ReQM7F16M+RE4Fgy QuN78ZHB6Z8XHcpmycW6zznYUp5tbRXwuG4XgvtTH0KFr8ThLnzWalit/6SgROEj1UII 4N0izG0vybqPdh496Ey4hheF1KSV5eVvwN/OtCSwUwyjpBoqk94NvYTTe4QkdYFB+KbH HdR8aPF0PpRajD/PGvzwBRQHiVWT33dZo4ozE7yKaFM3z8fmY+6uLPICx2p/IeOjSqQ4 jcsOiyzZ0O9HsyfwJODuRoiGawocgisheXMaM+vh/YNSWTGpScdVwluN8h2+mYnWPrVk xeIA== X-Gm-Message-State: AC+VfDy2My1aaC0RU602QN/d8yHRMwzyxJYiPso6eexoPXnMNz9bcZ6H 7yEqFhTH1uxjeQW7VxsO1bv5sLN5LvGu4Y4WjSs= X-Received: by 2002:a05:6a00:1390:b0:646:3162:31a2 with SMTP id t16-20020a056a00139000b00646316231a2mr41795260pfg.17.1684266117268; Tue, 16 May 2023 12:41:57 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id z21-20020aa791d5000000b006260526cf0csm13771165pfa.116.2023.05.16.12.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:41:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 11/80] tcg/aarch64: Detect have_lse, have_lse2 for linux Date: Tue, 16 May 2023 12:40:36 -0700 Message-Id: <20230516194145.1749305-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Notice when the host has additional atomic instructions. The new variables will also be used in generated code. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 3 +++ tcg/aarch64/tcg-target.c.inc | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index c0b0f614ba..3c0b0d312d 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -57,6 +57,9 @@ typedef enum { #define TCG_TARGET_CALL_ARG_I128 TCG_CALL_ARG_EVEN #define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL +extern bool have_lse; +extern bool have_lse2; + /* optional instructions */ #define TCG_TARGET_HAS_div_i32 1 #define TCG_TARGET_HAS_rem_i32 1 diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index e6636c1f8b..fc551a3d10 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -13,6 +13,9 @@ #include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" #include "qemu/bitops.h" +#ifdef __linux__ +#include +#endif /* We're going to re-use TCGType in setting of the SF bit, which controls the size of the operation performed. If we know the values match, it @@ -71,6 +74,9 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) return TCG_REG_X0 + slot; } +bool have_lse; +bool have_lse2; + #define TCG_REG_TMP TCG_REG_X30 #define TCG_VEC_TMP TCG_REG_V31 @@ -2899,6 +2905,12 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) static void tcg_target_init(TCGContext *s) { +#ifdef __linux__ + unsigned long hwcap = qemu_getauxval(AT_HWCAP); + have_lse = hwcap & HWCAP_ATOMICS; + have_lse2 = hwcap & HWCAP_USCAT; +#endif + tcg_target_available_regs[TCG_TYPE_I32] = 0xffffffffu; tcg_target_available_regs[TCG_TYPE_I64] = 0xffffffffu; tcg_target_available_regs[TCG_TYPE_V64] = 0xffffffff00000000ull;