From patchwork Wed Aug 16 14:25:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 714028 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp2374000wrp; Wed, 16 Aug 2023 07:29:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExaeB57mIe0+fisfDVzN7Cd/gulj+TFNHH2GeZkLEXh+fHPttHJdncVVLxysmD9ecc7GIt X-Received: by 2002:a05:6358:880b:b0:133:9da:8d9f with SMTP id hv11-20020a056358880b00b0013309da8d9fmr2479336rwb.14.1692196183145; Wed, 16 Aug 2023 07:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692196183; cv=none; d=google.com; s=arc-20160816; b=vsyx10wCOZI+YmROA4TqIAfXb53Ot05pjRqRF3ngE58eAqyvdqQMAwly+v1bvaEjl6 1PuHCbw9KkCiyNNtWu06K8wDvWnFz/yfqszjKVIAbTaAI3LIk60F3D4u2vz9XpXYkr24 W4JhDksnbJNbSUNxzXPF4YDEOngUt9NSifwTP0iKi81O/niKGhS5auAYPG4wu79RMUTr UHFnbyCPs1DOQRIsoiJB/Gy1x9qThHfO9JCQ6jGv5cQyiX/SIi4tzmVw6uBc8aJ0G1qJ mJurexlrFdQ45zFB6ESApVTLs2PWzRhzwNvMPcH12ODP6nr+5KTO++o7cCmqUw1QoTRh n9Bg== 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=2WfUiBV4R48StsRGeWaef0j9aTh/ONctxiuXo83IRGs=; fh=oweadga+1U1BKjDqlK8hSmEWEC1EUfcsKuPkDinEDsU=; b=Ys6WGhkx4La7DGyXy4qmUAogU9S9jfj23SKStbFs68e9gdzDAXI970KBC/tnX7rUCs eSap0YHEENGSaEn+VpKEuZOKge5RAUBR5t9pxPG9L27H6HvDArW3a0on1xcubjIxdgy2 R/yXdoOdTu5HSrPQHqPjH8fUOOnide9sxkok3+Up+r+I6sZcNOaEF4ix8VColSwy531b uJBS+dDqQTyQr1uLapJKCZ/CKwR5OxmU084stV6agNhH9pfjkbLI6YOcuf5twYrOOlCo v5H3hFHBnrJRM4iiZno4lFyAwkMkNKq3LX046D7X7tYvuUC6iNmnB+4ibAomcrmRLJbw kUuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=er27MzP+; 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 y17-20020a05622a121100b00403a8e58423si8843397qtx.448.2023.08.16.07.29.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Aug 2023 07:29:43 -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=er27MzP+; 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 1qWHSg-0003xp-3M; Wed, 16 Aug 2023 10:25:26 -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 1qWHSd-0003uu-UC for qemu-devel@nongnu.org; Wed, 16 Aug 2023 10:25:23 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWHSb-0003k6-Bv for qemu-devel@nongnu.org; Wed, 16 Aug 2023 10:25:23 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68878ca7ca0so935353b3a.0 for ; Wed, 16 Aug 2023 07:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692195920; x=1692800720; 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=2WfUiBV4R48StsRGeWaef0j9aTh/ONctxiuXo83IRGs=; b=er27MzP+gSmorkX/8Xc1MNooYKFHycdKoxgHrnnJF93qmqML5QCzqsT7SceFsZFKfS oxcQVeiCiUqX9ElvbhaZIT9ek6KorYpZR3nR6Gu0WdsSRpQY0XTIVTUfCXd/9iUYb9/w pRKqt2JiKNyE59Udx2iX4FKaBKMtbWXEazkts+pAREml7sIf7J2qGrJPnuwqzakh2KFi Kbh2doJIItF4RxAtbcjXvIplFryYOPg70l8bDpNniCmAnAWLNWzGF3LEb/PogAnSAmwG mW55LJ8kjUmthwNTXWx3O2J4tejT5lgCRV9mPvwCBRVpbMR5IhEhCMOOB2lzXEVjUX6g CO8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692195920; x=1692800720; 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=2WfUiBV4R48StsRGeWaef0j9aTh/ONctxiuXo83IRGs=; b=FF6b90jYbDQ+t6nNatrm6CiNyt2o57fAipkFnTgqDYjM+qwtxqBC21+hmlBASS62kz nqVbUqWW8rM7ZHtAEOtvEA8ywDxWIYYQFPUhJOFLgTIl3nZQmgSyiLEvxwgPVZW2I+Jy esmjE+4ybPZKi/fHQ/xqLHyAaHupROldWypx59xCLWAwLoFAHy64ogdKjlsUTCJmAddN egAhnuuiB3Ep3Sy1O4fqdbirHfV4JNP01H7tIOWmJjpFobk87TIEtaJAnhVVOqgvg6Mf tP96mQx+hjC5ShzeBXLu7qrcuBNHSp1ieK+OX1Xauidu9ZxOAswb6/0cFmvroNJEijlU so+w== X-Gm-Message-State: AOJu0Yz3guLqC7gIfvsEuhRpekKtuUzpmEn/IEzGXRzBbQEMrxp2Eu12 t86myg6XXfBW9YS/7+XSfzP5YMl9olquADgP4JA= X-Received: by 2002:a05:6a00:2444:b0:687:3f06:5939 with SMTP id d4-20020a056a00244400b006873f065939mr1818513pfj.32.1692195919804; Wed, 16 Aug 2023 07:25:19 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:a064:e3f9:a812:973b]) by smtp.gmail.com with ESMTPSA id i12-20020aa78b4c000000b00678cb337353sm11156019pfd.208.2023.08.16.07.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 07:25:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 2/4] util/cpuinfo-aarch64: Add CPUINFO_BTI Date: Wed, 16 Aug 2023 07:25:14 -0700 Message-Id: <20230816142516.469743-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816142516.469743-1-richard.henderson@linaro.org> References: <20230816142516.469743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- host/include/aarch64/host/cpuinfo.h | 1 + util/cpuinfo-aarch64.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/host/include/aarch64/host/cpuinfo.h b/host/include/aarch64/host/cpuinfo.h index 769626b098..a59c8418d2 100644 --- a/host/include/aarch64/host/cpuinfo.h +++ b/host/include/aarch64/host/cpuinfo.h @@ -10,6 +10,7 @@ #define CPUINFO_LSE (1u << 1) #define CPUINFO_LSE2 (1u << 2) #define CPUINFO_AES (1u << 3) +#define CPUINFO_BTI (1u << 4) /* Initialized with a constructor. */ extern unsigned cpuinfo; diff --git a/util/cpuinfo-aarch64.c b/util/cpuinfo-aarch64.c index ababc39550..97f5548a95 100644 --- a/util/cpuinfo-aarch64.c +++ b/util/cpuinfo-aarch64.c @@ -57,11 +57,15 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0); info |= (hwcap & HWCAP_USCAT ? CPUINFO_LSE2 : 0); info |= (hwcap & HWCAP_AES ? CPUINFO_AES: 0); + + unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2); + info |= (hwcap2 & HWCAP2_BTI ? CPUINFO_BTI : 0); #endif #ifdef CONFIG_DARWIN info |= sysctl_for_bool("hw.optional.arm.FEAT_LSE") * CPUINFO_LSE; info |= sysctl_for_bool("hw.optional.arm.FEAT_LSE2") * CPUINFO_LSE2; info |= sysctl_for_bool("hw.optional.arm.FEAT_AES") * CPUINFO_AES; + info |= sysctl_for_bool("hw.optional.arm.FEAT_BTI") * CPUINFO_BTI; #endif cpuinfo = info;