Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2096683rwn; Fri, 9 Sep 2022 08:28:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6j2aRI5q/IqGJEm1pk9fme4E3KRlQZN9nrWDYbnpjZ0LKpzIoAhvXCEsjBBkTv6hed65Om X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr10367935ejg.645.1662737320548; Fri, 09 Sep 2022 08:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662737320; cv=none; d=google.com; s=arc-20160816; b=tX0YKQm4B+6TsuZFOqew2BmUXUh96J6LdLGJdwacIT+WsC+yt8HIybUxFudqV7CqDV WplVBtF6ZzOlF7Dsu6LXE/FPK41aNwpAIq50oEPWu296E64bbE9raTAqakfUb5SD+VJy AWNPXtoX11b2LEaol8SC8714dRZed3c0wa1VB0DP7+u/tJWkYYgv0HCUtCARy6pWLQEN 2Jrc+CHlU19C4gfbw9P3zj2T4JRowuDvbQUEQ2XJrpiduhx0Q5iIFGAifX4yOH6MBbNW Nq7IiwKNWa749R19IwvA0G9MDSRVJekS7mkkHgdYGDwtKEOn6DJ7YbF0FAn7+sTzGCd/ CR5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=HstlTOdtQkjHF/xEwXhcQ1/GWti/Mb1CyWVyUEqskt4=; b=YG/uwxei8kejO46pw/UmlAvRtGBlkmQajlkJmi53/9C5TIbllWT/QIOpCi7B/xORpn i0vkXbWOSJvY/C916D6LsW1uLsNlBv0m2+yPIJowuBfDovXSe+V7WRWrySOxutv2EKdb FcVc4JiulhkWCOF6HTNMJa29c9OLoJyF1t4MJULJN7rrUVoWeKKW6dULsh/Qr9cJ3oiO s5JwUg4YmAS3oQbC9ASM0yY+GloDkeR2ZhxF3I5r/zX+d/CUGXYuW2Q4zSl8gSNknqG6 j9yRh+zkC+jMjgSl8ttJGRxPSN5ke9m1Nu+jN56OOEnf35qVvb/fH3I04PXqttuTEVo2 tPUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz5-20020a1709072ce500b00774afdfb3f2si699273ejc.495.2022.09.09.08.28.14; Fri, 09 Sep 2022 08:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbiIIOR2 (ORCPT + 99 others); Fri, 9 Sep 2022 10:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiIIORZ (ORCPT ); Fri, 9 Sep 2022 10:17:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A0C112D574 for ; Fri, 9 Sep 2022 07:17:23 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1676C165C; Fri, 9 Sep 2022 07:17:29 -0700 (PDT) Received: from [10.57.15.197] (unknown [10.57.15.197]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E170B3F93E; Fri, 9 Sep 2022 07:17:20 -0700 (PDT) Message-ID: <28b35935-4e7f-2bd5-dda5-ed81402a527e@arm.com> Date: Fri, 9 Sep 2022 15:17:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] Report support for optional ARMv8.2 half-precision floating point extension Content-Language: en-GB To: George Pee Cc: Russell King , "Russell King (Oracle)" , Catalin Marinas , "Kirill A. Shutemov" , Austin Kim , Ard Biesheuvel , Mike Rapoport , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220901141307.2361752-1-georgepee@gmail.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-09-09 14:34, George Pee wrote: > Adding the hwcap was part of the diagnosis process-- I added it just > to make sure that the cpu in question supported the optional > extension. > It seems like it could be useful to be able to check for support in > /proc/cpuinfo. Sure, but "support" is about more than just what happens to be present in hardware. Observe that you can build the 32-bit kernel with CONFIG_VFP=n, and it then does not report and VFP or NEON hwcaps, because those features will not be usable in that configuration, even if you know the hardware implements them. Note that this looks different on arm64, since there we always expect to have FPSIMD hardware available, so support in the kernel is unconditional, plus that kernel support is also a lot simpler since we don't have a soft-float ABI with all the corresponding trapping stuff either. It might just be the case here that the call_fpe logic needs a bit of tweaking to provide proper support, but I'm not sufficiently familiar with the ARM VFP code in general to be sure. Thanks, Robin. > On Fri, Sep 9, 2022 at 7:46 AM Robin Murphy wrote: >> >> On 2022-09-01 15:13, george pee wrote: >>> Report as fphp to be consistent with arm64 >> >> Wasn't the original problem that the VFP support code doesn't understand >> the new FP16 instruction encodings, so in practice they don't actually >> work reliably? Exposing a hwcap to say they're functional doesn't >> inherently make them functional - if there is already another patch >> somewhere for that, it should be made clear that this depends on it. >> >> Robin. >> >>> Signed-off-by: george pee >>> --- >>> arch/arm/include/uapi/asm/hwcap.h | 1 + >>> arch/arm/kernel/setup.c | 1 + >>> arch/arm/vfp/vfpmodule.c | 2 ++ >>> 3 files changed, 4 insertions(+) >>> >>> diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h >>> index 990199d8b7c6..f975845ce5d3 100644 >>> --- a/arch/arm/include/uapi/asm/hwcap.h >>> +++ b/arch/arm/include/uapi/asm/hwcap.h >>> @@ -28,6 +28,7 @@ >>> #define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) >>> #define HWCAP_LPAE (1 << 20) >>> #define HWCAP_EVTSTRM (1 << 21) >>> +#define HWCAP_FPHP (1 << 22) >>> >>> /* >>> * HWCAP2 flags - for elf_hwcap2 (in kernel) and AT_HWCAP2 >>> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c >>> index 1e8a50a97edf..6694ced0552a 100644 >>> --- a/arch/arm/kernel/setup.c >>> +++ b/arch/arm/kernel/setup.c >>> @@ -1249,6 +1249,7 @@ static const char *hwcap_str[] = { >>> "vfpd32", >>> "lpae", >>> "evtstrm", >>> + "fphp", >>> NULL >>> }; >>> >>> diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c >>> index 2cb355c1b5b7..cef8c64ce8bd 100644 >>> --- a/arch/arm/vfp/vfpmodule.c >>> +++ b/arch/arm/vfp/vfpmodule.c >>> @@ -831,6 +831,8 @@ static int __init vfp_init(void) >>> >>> if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000) >>> elf_hwcap |= HWCAP_VFPv4; >>> + if ((fmrx(MVFR1) & 0x0f000000) == 0x03000000) >>> + elf_hwcap |= HWCAP_FPHP; >>> } >>> /* Extract the architecture version on pre-cpuid scheme */ >>> } else {