From patchwork Sat Sep 16 03:30:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723577 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp710407wro; Fri, 15 Sep 2023 20:38:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFIr1kxMDhg6fUCa7ZeY/Cklgy5q4Iqwf8B8X71Jfdtm44G1hh47dDJG6XDrmDIFV0SZsA X-Received: by 2002:a05:620a:2944:b0:773:a229:5a24 with SMTP id n4-20020a05620a294400b00773a2295a24mr3766992qkp.33.1694835531190; Fri, 15 Sep 2023 20:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694835531; cv=none; d=google.com; s=arc-20160816; b=fd8WlWRUrZHOLQkK4O2D8PiZGEClbIEbxOJT1siQKtoD3XPdZRIuRa2cna0b/6KWt7 0PihncOpNBk/wKI0IC87U/k+paA8s2r27h1SCMtt+4Qty1AQLkvrw3KDzeyKZYHQATVZ b4HGiHF9yo2IIVtwbTaE06f5dGADJJMZOV4ysZmmFYlJdiN4YSVX4D5RH7XqgcBgUg/r 6uFzAx6aMKdhHOZgEVtbBQIOW19Ewjed5Fmd+3y9eZqJZGYcVFRBbIF/AiEz9JiCWLRS ngh9B1LDPQxlnLlLF6AJmHWjSvNbaHF3ZZZHvJGouPIQ9WPT7GuFtTEJn9sPYy3L7nb8 moaQ== 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=CxYJcRT+ApT8daGSsr/KMFMBCHy6Uv2L7Z2orIOqHHk=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=Y7KNCK3ugsSMXtwrc1juqqGrthODil5aChoKFQXSC+ew69rTH4ILZiWcEIDkrZNNOO bn3RumRygiLJAajxlaM4LYgEDtL4gisa5fFCHj4TnlkU+IbjvQOjtahYekZqU6pSOJO9 2FgHLB0DMywtT6UTseU0RizLH+0cp8/9QltBIgXUtqTfsilv6DMxJkPW7ftaxQ4Fu8Ka 3YTCEQtkCmzWR0WreMWU92NUBiZ/WExVIM8x3bbV4ZCEPMcBwRmG1vEMNx8s/PJjdmKH sI7YItm8293jgriGsS8xEkRwAup7kQ1PkZnNpbOXEdROIYR3ZgNQxhhZpQwQaNYhLL6U fO6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s+f1ui1B; 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 j12-20020a05620a288c00b00768b6bc7aa0si3382355qkp.713.2023.09.15.20.38.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 20:38:51 -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=s+f1ui1B; 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 1qhM1D-0006Am-Bb; Fri, 15 Sep 2023 23:30:51 -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 1qhM1C-0006AA-0B for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:50 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhM1A-00087p-Ep for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:49 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5717f7b932aso1697444eaf.0 for ; Fri, 15 Sep 2023 20:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694835047; x=1695439847; 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=CxYJcRT+ApT8daGSsr/KMFMBCHy6Uv2L7Z2orIOqHHk=; b=s+f1ui1BJ8K95+7G9F6gYuXfnZgrklTYEBcWfkNPWjZ771FEZ0omkHlKf5NUG0r3KQ RJiOGbmlRBlGIMZfaKxIxQ3AUZAAkzKizRXy3+an7JPvY3XBIpgiWk/kfwzW+CxJLWHq hGQkg82E9CPeJaPOT9gvqvnSaE3Fdo4DMDM5Vn+szAiGozlNOBan6ML/t8pPpjI3WTjJ tBVm96+bn+EkSCbQP2Nz49SvKvMUlHpVYwxuN2EmKmiEgdTGJtHQfEoreq6uNvO0J/rS dm/2Zcj1U7iEM+LC9NCZot+UMXsz0H8LAo1y3h995fwB96R8INYR8+SVJxCDoM4iHGFI aIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694835047; x=1695439847; 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=CxYJcRT+ApT8daGSsr/KMFMBCHy6Uv2L7Z2orIOqHHk=; b=RSw5Ffap0W3Tu9nhTiSQH4Xe7St+ezEgqoxwzgsUD6jaEzyBaqveuk4Db86Wku+v2G qdtGauBsQN+EHqMjRG95hjcs/FEL4t14RZ2CEXGtoFhrzpNRzFBS+sdekOsucxhgnpHy jlFfCGWfD0N8bu/mgBfYmo1EHZ/VX3+pzPFOgveSME430o8oPKfHl+UoXrEOL5WmZ8N9 RDym1pH8/10jR+lx5uyONh7rUQ4Vq/etkFONbGlpkR9KCXW3ndMEvCB7UYYMH+9S5zU4 BEe08IRMdOqYP42AQg9/ywOFpY86HSUcrHcrVgavyIXXLWxye3j4OMjOEWWymSwdrfC1 4qbw== X-Gm-Message-State: AOJu0YwQ+GxWfIoghHP1PyH3hi+pk1KDL+SN15NYxMZw2je9F0/LG7Yb RwOR3QztJdAUykjrTfb0zBmgGbKVayAnuCMP0V4= X-Received: by 2002:a05:6870:2422:b0:1bf:4f5e:55e2 with SMTP id n34-20020a056870242200b001bf4f5e55e2mr3998518oap.53.1694835047071; Fri, 15 Sep 2023 20:30:47 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id j26-20020aa783da000000b00687a4b70d1esm3577320pfn.218.2023.09.15.20.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:30:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 37/39] util/cpuinfo-aarch64: Add CPUINFO_BTI Date: Fri, 15 Sep 2023 20:30:09 -0700 Message-Id: <20230916033011.479144-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916033011.479144-1-richard.henderson@linaro.org> References: <20230916033011.479144-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.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=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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- host/include/aarch64/host/cpuinfo.h | 1 + util/cpuinfo-aarch64.c | 7 +++++++ 2 files changed, 8 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 7d39f47e3b..e11b76491c 100644 --- a/util/cpuinfo-aarch64.c +++ b/util/cpuinfo-aarch64.c @@ -13,6 +13,9 @@ # include # include "elf.h" # endif +# ifndef HWCAP2_BTI +# define HWCAP2_BTI 0 /* added in glibc 2.32 */ +# endif #endif #ifdef CONFIG_DARWIN # include @@ -57,11 +60,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;