Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5427935rdb; Wed, 13 Dec 2023 08:20:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNIgmKje+cChPCirTffacgr19jbwDwAvPnyTXbx4+FwzCxMPKYEWG2FKfUKUO3y2sRB60H X-Received: by 2002:a05:6a20:3b1d:b0:18f:e269:a5e3 with SMTP id c29-20020a056a203b1d00b0018fe269a5e3mr3237067pzh.41.1702484442858; Wed, 13 Dec 2023 08:20:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702484442; cv=none; d=google.com; s=arc-20160816; b=jEPVY3y/nLf5rv5kPjSYIi6dscjxgeRzWd007B+ZbqBkMwnYP2lRD5nBwrQnYbQls/ +chvzWcf8WtrXJ8+yJI36EK4rHaJ9E52x8gshrQiaeMNwd4ABIvEE4sBuAc0S3DGJz2E tQop4FQ/5oFadYRLXScuGt8lSdr5v/n8LwL58v31eF+zTnr5X1BRqJC6QplyAZ+eDnZZ jg52UERGwxhHYTwGADg4Dkn9Bax/ydVwX4wRvea00bDAcFDmFvXHTHWCnX8N4L835WNp YcTtjo+s7KrBijKUMf3Iay01x6hrhz6N8UeJplQfV8fnuTvQlsx+BKvT6yQuNwplTHzj 8eHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=u2Po/ubIX63zpZmoH40ju+uUT9tpgd/QYRPcUCLsEqQ=; fh=sxrq73WU0gEvV0W01eM6oupJUaMCyB90jvDyxWsrZyI=; b=GJxEagO02u9edTBEId3UguQUdJdYSXmL/YtKtc1NizMx0DnfRc4iqGFswXBMq66oQt b3arKFm2ybpJN2VTNwv8DUEhukVc7cnMbAOnL5SNBBtIV4+VNzWOE1Tmaj1z222qqh8a Sy8QGw+vlI+SpcKpwxTNArkJ35YVrVp5Wv6h/fbRWgJDzfQpwKI1vRhQ1mYdLw0cqnIW UvfXVumchaAlurnJIWtCmsaCIVJXdUdy7aF7vOoyimKfDN9uO63ME1kkRql6ADU/FXUO TIFcj1rlVCcRkiksKgC1wuwlJaGjDiXsVR82zmvrrpCLb52wri2i606LUIT4/Fcgy17i +4fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PSNZEtly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o66-20020a634145000000b005c1eadbacb3si9564738pga.104.2023.12.13.08.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 08:20:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PSNZEtly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8C4D380BFEE1; Wed, 13 Dec 2023 08:20:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233450AbjLMQTz (ORCPT + 99 others); Wed, 13 Dec 2023 11:19:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235370AbjLMQTo (ORCPT ); Wed, 13 Dec 2023 11:19:44 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E713010B for ; Wed, 13 Dec 2023 08:19:50 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D2AC433C9; Wed, 13 Dec 2023 16:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702484390; bh=rtYsdGUgzG4gShOq5eir9uSz6Dv02AOWRgbvbC1z6QE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PSNZEtlyKCT/FLY4w9ZppFBut3oFTo86KvXQ19A5ut2LSqARZgZyhF61vRtVNrlEe Ay6EDQ78iJiWMBryaP7r58sTbMMPPeFtYOwsHvf0y/xUOHdevS95ZXyDZ5996bVweU sv4KhhPsk0N6ZxNbb6aTXaRmvvfIxXMebINNc1JCdEbg3xS5+77zm0cfnfALLOjYaI LOX2IHnhNjki/2k4b+A3P3mcp4sjgIq92Q/94wAC7sdnVuHgtC7eESr3vtcaq3I9gA 6uX/hRFS0gmB3XF6ZMoRq4x6IVDRMvD7vXlc24FhXwedhXTL2t+QN7yPIx4aLREPb6 C/OnndWIpOX3Q== Date: Wed, 13 Dec 2023 16:19:44 +0000 From: Will Deacon To: Samuel Holland , ardb@kernel.org Cc: linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-riscv@lists.infradead.org, Christoph Hellwig , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arch@vger.kernel.org Subject: Re: [RFC PATCH 04/12] arm64: Implement ARCH_HAS_KERNEL_FPU_SUPPORT Message-ID: <20231213161944.GA32062@willie-the-truck> References: <20231208055501.2916202-1-samuel.holland@sifive.com> <20231208055501.2916202-5-samuel.holland@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208055501.2916202-5-samuel.holland@sifive.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 08:20:23 -0800 (PST) On Thu, Dec 07, 2023 at 09:54:34PM -0800, Samuel Holland wrote: > arm64 provides an equivalent to the common kernel-mode FPU API, but in a > different header and using different function names. Add a wrapper > header, and export CFLAGS adjustments as found in lib/raid6/Makefile. > > Signed-off-by: Samuel Holland > --- > > arch/arm64/Kconfig | 1 + > arch/arm64/Makefile | 9 ++++++++- > arch/arm64/include/asm/fpu.h | 17 +++++++++++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) > create mode 100644 arch/arm64/include/asm/fpu.h > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 7b071a00425d..485ac389ac11 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -30,6 +30,7 @@ config ARM64 > select ARCH_HAS_GCOV_PROFILE_ALL > select ARCH_HAS_GIGANTIC_PAGE > select ARCH_HAS_KCOV > + select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON > select ARCH_HAS_KEEPINITRD > select ARCH_HAS_MEMBARRIER_SYNC_CORE > select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 9a2d3723cd0f..4a65f24c7998 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -36,7 +36,14 @@ ifeq ($(CONFIG_BROKEN_GAS_INST),y) > $(warning Detected assembler with broken .inst; disassembly will be unreliable) > endif > > -KBUILD_CFLAGS += -mgeneral-regs-only \ > +# The GCC option -ffreestanding is required in order to compile code containing > +# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel) > +CC_FLAGS_FPU := -ffreestanding > +# Enable > +CC_FLAGS_FPU += -isystem $(shell $(CC) -print-file-name=include) > +CC_FLAGS_NO_FPU := -mgeneral-regs-only > + > +KBUILD_CFLAGS += $(CC_FLAGS_NO_FPU) \ > $(compat_vdso) $(cc_has_k_constraint) > KBUILD_CFLAGS += $(call cc-disable-warning, psabi) > KBUILD_AFLAGS += $(compat_vdso) Can you use this to replace the same logic in arch/arm64/lib/Makefile, like you do for arch/arm/? Will