From patchwork Thu Nov 2 17:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740478 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp964530wrv; Thu, 2 Nov 2023 10:47:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1eqyyZDhjvHEU0rqwfjiSA4ENjyNT9xM5vXm+D1+N/DzE4ee790SNmDmoFAEQJ/B5fZgy X-Received: by 2002:a05:600c:4f92:b0:401:a0b1:aef6 with SMTP id n18-20020a05600c4f9200b00401a0b1aef6mr16469619wmq.2.1698947226405; Thu, 02 Nov 2023 10:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698947226; cv=none; d=google.com; s=arc-20160816; b=Vkr++Yj8jsqOdiwWlBBJYTsHSlOUMza+v0uluemtG072HluqS/DhlHKFvaitvJM3mi YDlRGdXc89YEh7o3Sz5Qn8dr1kuvcfUTCZdGhDx91lP7Bp+DVPhqYsUY1O+/OB8pTA5T a8qRmM01wW1DNK5/ZRdWhEkTRHzBj6I9D6mNqIHB3loj+f/7gWvpxjyOOZuxbBrWaKLK mDSxzpg2Ig9PQcEVfuAa5Me5MjS0cE6vJ+OyzZKNO3Rby/0wBLWadTuM3Mxkiyevghk8 wkMWKbeBfr7wYnDbU/Bcg9VejUMuDtWDuTuPRQ7Zn9Gq0onmMPBGy1gSZO+vYMetLDvK k0Gg== 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:to:from :dkim-signature; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c1ZZc10kcr9pCWtHDYNIqqZyBwknnpeDUMJA/o/laRVwUWYrF4tDylPCdRAGm4luAn hsJPdvKgbTxlqyMbV/OiZYi+WxEsJD62ifNdMLHbt/q+ycc+b9n9QROD2V8Jk/iBoaB3 o7hphuHVkMQpxOJlvhrbOgv6fhzsUTE63cqVtrgfEGN3V9jCv8vxe8mZOXk54vw6AqfU ObIncwHcArE92NBtXwrewiLXTDpBlj7/CjROkGEz9TCbL7suXfaS8bSusNJ0BMKYOuTY dY/G//DKZR1YvBKUvJ/tOLRLLSbQHs8wtgppZkK0z4zYdhxNMBUBpvOkvLZEZiPDlljI cpTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBt8No7y; 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 l9-20020a05600002a900b0032d849f6204si1959367wry.37.2023.11.02.10.47.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:47:06 -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=TBt8No7y; 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 1qybfO-0003l4-12; Thu, 02 Nov 2023 13:39:38 -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 1qybeh-0003H8-OM for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybed-0002pq-EK for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4079ed65582so9470815e9.1 for ; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946730; x=1699551530; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; b=TBt8No7ybyc+cpj3PYpbLojzVQpoZXIl1qLCvJnHkCWoQHqTl9iHSoiJkvxgIuKBzY d5epeotaxEvidTOYjzuCB7YIwLVkdLEz7iIUXSEFzcTQnKNlPBgpaQcksLHYZI6C+UW3 bnC9yM6MPxf2AbGsvndxKb5KQFx6a9X1pvURT7xapMTVtnl7dx+L9AUf/ill5R2UwrVL OVMb/hY14MGPkjTn+cDcagXClJ4D14B1bB91INGnqCrHly8nixpLFQfHExAY0x14bLds fkW7nJ8Q5hEIL4kgSRPtqAPJK3wpWGKW1VTTXDJrjQOLQzzKLc5evZDZ8tFR3Q3UqKjY nA8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946730; x=1699551530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KvWivuRtwwwvha4YHNrmTGvIkSjxbhYcjuu+AWQQ3Q0=; b=Xr/SNfkX5qlwAdgBWK/20yHiHTeeppdS3di8+pX3+svmR95+WH4a+UE9b0uUbQ/sDG t5i701bkBEwSJDfB1tUoeIxtWhvo8jBEGg/vMihY8M2KISnyacrZH9NOM5ntdL6vlYaZ U2lfJpDYJ7dVwdLnocSQEyf2h+56fDLPGu1UaAfAqBbH9cVnm8o1e4tKhBvajgh6qHeR v8MXKxYdNU/fqhpkByXkMSE9sCEbotf4rTvJ3llxVR4/Z0rZMB4ewZUFpiQVkkL/kphy QSHKl8YouQebLh3qs8vhLC+xarp7SuBebMZEQFuhA1I1G9H9wyq15J2KSBvOkUg0HJer mN8Q== X-Gm-Message-State: AOJu0YzOGB0Lr8/XgIdb5K5h8yaajfcVtryZNdEDtMMYtz8Rv8UvkXOO n5/aJFAXWQAbsL/Q6gqZeDF+EMelqZix979qSS8= X-Received: by 2002:adf:f211:0:b0:32d:a7b0:62b with SMTP id p17-20020adff211000000b0032da7b0062bmr12903123wro.26.1698946730007; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/33] linux-user: Report AArch64 hwcap2 fields above bit 31 Date: Thu, 2 Nov 2023 17:38:26 +0000 Message-Id: <20231102173835.609985-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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 The AArch64 ELF hwcap2 field is 64 bits, but our get_elf_hwcap2() works with uint32_t, so it accidentally fails to report any hwcaps over bit 31. Use uint64_t here. The Arm hwcap2 is only 32 bits (because the ELF format makes these fields be the size of "long" in the ABI), but since it shares the prototype declaration for get_elf_hwcap2() it is easier to also expand it to 64 bits. The only hwcap fields we implement already that are affected by this are the HBC and MOPS ones, neither of which were implemented in a previous release, so this doesn't need backporting to older stable branches. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20231030174000.3792225-3-peter.maydell@linaro.org --- linux-user/loader.h | 2 +- linux-user/elfload.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-user/loader.h b/linux-user/loader.h index a0834290e7d..e102e6f4108 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -103,7 +103,7 @@ uint32_t get_elf_hwcap(void); const char *elf_hwcap_str(uint32_t bit); #endif #if defined(TARGET_AARCH64) || defined(TARGET_ARM) -uint32_t get_elf_hwcap2(void); +uint64_t get_elf_hwcap2(void); const char *elf_hwcap2_str(uint32_t bit); #endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 3f3975352af..4cd6891d7b6 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -552,10 +552,10 @@ uint32_t get_elf_hwcap(void) return hwcaps; } -uint32_t get_elf_hwcap2(void) +uint64_t get_elf_hwcap2(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); - uint32_t hwcaps = 0; + uint64_t hwcaps = 0; GET_FEATURE_ID(aa32_aes, ARM_HWCAP2_ARM_AES); GET_FEATURE_ID(aa32_pmull, ARM_HWCAP2_ARM_PMULL); @@ -818,10 +818,10 @@ uint32_t get_elf_hwcap(void) return hwcaps; } -uint32_t get_elf_hwcap2(void) +uint64_t get_elf_hwcap2(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); - uint32_t hwcaps = 0; + uint64_t hwcaps = 0; GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP); GET_FEATURE_ID(aa64_sve2, ARM_HWCAP2_A64_SVE2);