From patchwork Fri Feb 14 18:15:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183510 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2127645ile; Fri, 14 Feb 2020 10:20:39 -0800 (PST) X-Google-Smtp-Source: APXvYqx1VAATTPyu58McYwY5kmunKprL3zy7UbAPqZcOQ9BR/soz7FOdIofwJ0HT1yWeho41v928 X-Received: by 2002:a05:620a:8ca:: with SMTP id z10mr3432594qkz.242.1581704438892; Fri, 14 Feb 2020 10:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581704438; cv=none; d=google.com; s=arc-20160816; b=VGsuTcdCFFKR0tc+9+zp5BtpvfQtEANFWB8Co7nQg20Zzj/L+fS4/6Y8iA/hfB36rn 50WO6AMW2+Dg8w4/WYLnjsAsjNuTzzIruPoHApUY/x+HMp/TdMCmTbqaACi1Q7AGMQPa tzll9K3B/PaEHxjfT5xoYnBF+GmDLKiJmSv+RifynkgGwQyI+tQl7sD3aKVPkVIypPOz chVXzkt827F4w1hVgAdIz7q16zzWC0X4oQ/qev8+3wx19RY3aCxSf5bl5gvowJVfdgG5 eulGz6oJQDTrAydrvSyA+EQx6aD1yEmSF34XOl3dg+ASKJDOMUnITI2r6ogLD8uCVFWP SXGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=M8UM5e+3VRfykuEhj/KpHZJCPyatXYB/tx3EOhHQRHg=; b=Br4xz9/tIshDWUW0shLyCPQm6xjf3LehCEYMFaf3t3kOJl7BBoqsavLkD36FhyyOlv Z0tLpKhch1w5ZO91QnUYDsqiJEWSh0QM+Tmg4J5BsCGCHaEELVoZug+YUrToe25/eRaN qZO5s09l8mMKEgjv9V9qqhlm4eYcBZlSo59h2PbLe7Q0fJ4oNb2+rnYnzpfbuuYAlWjl ejT9r52AD5ar3oo9Qn93hR9Mn663se4ppeYBvOZgq+3Pq4Y1j41qCRKq//5YTQyUUBcb 7rCXr7jnl+I4H6A1N89pYjqCP5kBKhy+rydyZriwlzZ/FABrtkBUCWy3Lp8eg+41HJk9 48mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P2a3DJc5; 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 s189si3436203qke.311.2020.02.14.10.20.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Feb 2020 10:20:38 -0800 (PST) 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=P2a3DJc5; 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]:43624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2fZu-0004iW-DK for patch@linaro.org; Fri, 14 Feb 2020 13:20:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60941) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2fVZ-0004cJ-3E for qemu-devel@nongnu.org; Fri, 14 Feb 2020 13:16:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2fVX-0000Hq-W1 for qemu-devel@nongnu.org; Fri, 14 Feb 2020 13:16:09 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:38895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2fVX-0000HU-Pz for qemu-devel@nongnu.org; Fri, 14 Feb 2020 13:16:07 -0500 Received: by mail-pg1-x542.google.com with SMTP id d6so5339844pgn.5 for ; Fri, 14 Feb 2020 10:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M8UM5e+3VRfykuEhj/KpHZJCPyatXYB/tx3EOhHQRHg=; b=P2a3DJc5xDlZOW9ERiwMm2spp1DfTNP6HytA05EBy4VJ6VjnjDmpDWo3u1al6wnrcu 4eu6uz1lmVNk6+n8YQXvZiGj5XOPC6yDBt+InvAaKmEL8VzaJEqN8LYaPc5FyxFiTW8I jgC8s+c8/9a+WSFRPcmhBnXkeQY6VAmslVw/KczReCT3bLvNxKRXX3VkJA6TL3+Et0aF QZrP78lB5CGcujeJHbaIMvCTAPAi63ZochngZinYJgXgxCQIy+0lEC+TIDCZMYo08hpk 4dTnDb9lPrj94DvEAsVuo1/AUPjITVSIZqKsqpcvmr0uaCwPFCmfyIuoI17/snwsk3b4 +EzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M8UM5e+3VRfykuEhj/KpHZJCPyatXYB/tx3EOhHQRHg=; b=oNiJ7Ga/K1wtov2rRFMSHKTtD0/z3lEkwDJL32oN2ekmhDgNGwrWVOtgeLtM2UwqAD iIHhRYpLoiUpKC5UuNZypNjSdacoMLmc2MgVbEc72YP+r1XpldH8vq5pGYtOWkep8/pd I45o30G63gkuwEaiV8NJcXc1+Rh6R6F8YZPfccAI6LjkcYkKw343K3cufUtLRPWy1BbL PhwrgAP/MGmRQtzjapA6MgiVbky7rrehSh7eE4TR7litY717cz62BoNFqe7b2pGnAA11 fZqYzzbtmjjV/jr7nZ/RH/0Nqn3RNnGqF3wzcbaC/2dhc2TJvTLElAoo8wVDkCHaw3ma kMyg== X-Gm-Message-State: APjAAAXAjZSDaXHiZiFCIadShd9PJJGcbTbfFZloqqn5nZTzIg3RR4Bs OJKYK3Pyo6tNLsvU5FBqFY+Q6mB/Sbk= X-Received: by 2002:a63:5a65:: with SMTP id k37mr5002076pgm.264.1581704166488; Fri, 14 Feb 2020 10:16:06 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id i3sm7525123pfg.94.2020.02.14.10.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 10:16:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/19] linux-user/arm: Replace ARM_FEATURE_VFP* tests for HWCAP Date: Fri, 14 Feb 2020 10:15:43 -0800 Message-Id: <20200214181547.21408-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214181547.21408-1-richard.henderson@linaro.org> References: <20200214181547.21408-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use isar feature tests instead of feature bit tests. Although none of QEMUs current cpus have VFPv3 without D32, replace the large comment explaining why with one line that sets ARM_HWCAP_ARM_VFPv3D16 under the correct conditions. Mirror the test sequence used in the linux kernel. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index f3080a1635..c52c814a2e 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -468,22 +468,28 @@ static uint32_t get_elf_hwcap(void) /* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */ GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); - GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); - GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); - GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4); + GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); + GET_FEATURE_ID(arm_div, ARM_HWCAP_ARM_IDIVA); GET_FEATURE_ID(thumb_div, ARM_HWCAP_ARM_IDIVT); - /* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c. - * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of - * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated - * to our VFP_FP16 feature bit. + /* + * Note that none of QEMU's cpus have double precision without single + * precision support in VFP, so only test the single precision field. */ - GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); - GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); + GET_FEATURE_ID(aa32_fpsp_v2, ARM_HWCAP_ARM_VFP); + if (cpu_isar_feature(aa32_fpsp_v3, cpu)) { + hwcaps |= ARM_HWCAP_ARM_VFPv3; + if (cpu_isar_feature(aa32_simd_r32, cpu)) { + hwcaps |= ARM_HWCAP_ARM_VFPD32; + } else { + hwcaps |= ARM_HWCAP_ARM_VFPv3D16; + } + } + GET_FEATURE_ID(aa32_simdfmac, ARM_HWCAP_ARM_VFPv4); return hwcaps; }