From patchwork Mon Feb 24 22:22:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183786 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp925243ile; Mon, 24 Feb 2020 14:27:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzyiOdVlDHcFa8115F0ktgL5MRTw4I9wc8khRBfhlG7IPNJ6r1MS3THLCo3/R4yoYZRIhxT X-Received: by 2002:ac8:a8b:: with SMTP id d11mr48549563qti.94.1582583262548; Mon, 24 Feb 2020 14:27:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582583262; cv=none; d=google.com; s=arc-20160816; b=qR/rpHbGkicI2YfpKWzURs8hR12QAtBXdPdbecdg41iAN0JVr4sAXQM0MYzaI5kHpb 8sMI5O26kAMH9cwlHKsSf+W3f/tF4AN65UveIbztSTf3dZJ7kwwEmMVPuT5m5lZW4KCJ 6TAaU5abVW25scSXE2ys4Rbk5hSEF+88NgVCTr8pHFW5cxs8JuBvAvfBwmFkjJ9zobYP kmb3JUoJKjh32ETKfq/aUiulZJVw5AkXK68ae8p7KTrTEKJZ9gbNr9LKO1X35ns/tB7d WLu7YOjueklgHTpS25eOa1yqppW+nLktkcCVQAMkpzfK6JQD+G2vuduiDz/2910e5KYY AWpA== 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=+oOoLUU3WLw+5ICoiVu4+Hc3ZhB0R58hfDF27U8damo=; b=XL9ogU1Q1+I5G4u62LdzjsjiTvWCk9epIXsirtEiJDu7PM0FPJF4wbFkYZgGWpidcq fmva4SV614HSTtUMd8Hn3bGn2eXsY/X+RpCFwbkTYx9Q8ApFB+x2946Ryy0fHh0MnQM/ RNpuGhGdGhTPvUB0+O+O9ySB5o/9c05cmBKQbweFNmgZ8G+hjVDs1HPAQJiLh8k7LhYZ kFZcU+27wYny8LV+QkCa1w7Z4ksocsahwJcx1ZQpoXYk/ojOIgqwTLJi+3Hkspmgw+d+ /9iDkxe/0sNEEyTj6dPLhOb4j2zzV8eZ/DprOYmRkDTYstRvEKgAto2JLPZyjbVaEhRE 9dDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rdl7P8Hq; 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 d5si6372685qtq.370.2020.02.24.14.27.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Feb 2020 14:27:42 -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=rdl7P8Hq; 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]:45305 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6MCU-0004pz-21 for patch@linaro.org; Mon, 24 Feb 2020 17:27:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37983) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6M7q-0004cD-Dj for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6M7p-0005wD-9i for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:54 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:42366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6M7p-0005va-4s for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:53 -0500 Received: by mail-pf1-x441.google.com with SMTP id 4so6063337pfz.9 for ; Mon, 24 Feb 2020 14:22:53 -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=+oOoLUU3WLw+5ICoiVu4+Hc3ZhB0R58hfDF27U8damo=; b=rdl7P8Hq3/Kg6rc5J+JkXLQCkrD0N+nW18ABtWYzqGWWkBGsh7eEjsudKWGDZ7ZfEY wZoQL1mW+Hc49keUzSaVOAlix7bgnO1oLscek8OrwZ32UHD6WQoIgb+ZdMIm1eXyYzbU UAa4rWrVsgHqo601t0T5xz00ihQS1EL0lCeJgC/jyJAQzcLyattgoA717oZhwROmD7Q4 tTDjkP/nIgC5ApOYGOu7JhW7323wE4rWCpGlZylwqmLrMdlWxl28SNhzcfjyff7dOvcj wMLhEU7rGOCfm1JNTy7p8quWT4edfyC1/VPbxboWZUjgZUqv4wxOIuM1XYNTe/FSWHV/ OkkQ== 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=+oOoLUU3WLw+5ICoiVu4+Hc3ZhB0R58hfDF27U8damo=; b=mL0YQ1wRfHxjtG0m3dJwT/d5fONL/kNsC0MhxS/VyzLZ6+SLz9SpiwhQJcRjtVfjQB OOSZJEVSQwDBI/KS0gG5h5T89BOwNqYcg+Nj7PLZydUM0CPeM3a74RNegQ2HdEl/Hcja exmqRr4vNodd/wh5Hssb7vLGLFmLCKxP5AMBb6tnyHPLop4PzeqkHGApjf7mumb+Hvt3 RFWntUut5Al4gOD3SzYhjzdsa2Ri5iuPxDnk9IG2PGKoNj/7m9R7Iuta0gdtjvmO7sHz w95QyC4XdjqzgGYFCY73QSPBNUmWzdNMjWDriJXhkoRVjosIkgBfOACfEGamLWmP28JL N1Dg== X-Gm-Message-State: APjAAAWIAewxJFMWEphoVfdPhZsI+D0c90XqGaayUtk8Tp3+GT1ymBoS dgis1ti52NvgTEuUeDcnL7o5QRROvgI= X-Received: by 2002:a62:1dca:: with SMTP id d193mr54769709pfd.140.1582582971891; Mon, 24 Feb 2020 14:22:51 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id o6sm13897097pgg.37.2020.02.24.14.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 14:22:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/17] linux-user/arm: Replace ARM_FEATURE_VFP* tests for HWCAP Date: Mon, 24 Feb 2020 14:22:28 -0800 Message-Id: <20200224222232.13807-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200224222232.13807-1-richard.henderson@linaro.org> References: <20200224222232.13807-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::441 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, qemu-arm@nongnu.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 --- v2: Use isar_feature_aa32_vfp. --- linux-user/elfload.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.20.1 Reviewed-by: Peter Maydell diff --git a/linux-user/elfload.c b/linux-user/elfload.c index b1a895f24c..86cda127b7 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -468,22 +468,25 @@ 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(aa32_arm_div, ARM_HWCAP_ARM_IDIVA); GET_FEATURE_ID(aa32_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. - */ - GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); - GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); + GET_FEATURE_ID(aa32_vfp, ARM_HWCAP_ARM_VFP); + + if (cpu_isar_feature(aa32_fpsp_v3, cpu) || + cpu_isar_feature(aa32_fpdp_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; }