Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3701453rdb; Wed, 27 Dec 2023 17:42:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgYUtAYtAkxIYel07726kHaeVmoWr/mAvBQUQEd1U35F2RJ4/pvDxOvtsIJGg1vCChxaLe X-Received: by 2002:a05:620a:ed8:b0:77f:95a5:8109 with SMTP id x24-20020a05620a0ed800b0077f95a58109mr9672652qkm.141.1703727775226; Wed, 27 Dec 2023 17:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703727775; cv=none; d=google.com; s=arc-20160816; b=ca2gNdNzH+t4nnwLtUDTwA5CoQyy8lymCQdXJa8rTb8BK6sv0WS7MepZYNplQl+vMo 4XJocyuoSF8mtn8TwHd0qVLo+Es92RzdkHgmnpKYwIhzYDgxTnOzMJWD1PSKvNgL8htc 1mr0M4CIZ+JXTSeUXZtm3Q1cZi1WP+nC+g1agk5OWOILrgwxg7dJBk2SiY2M/Tu77ieX BfaGJzkONJI6RWn0WQDxy95fHKyQim3kpp/kP0Ph9Ag1T83zgj0nHk4v+u6TDmY2nh82 jMMnoIU046CoqpB3yAbV8yklpG6NvPAMa/pRn1V0c4dqGNuv+jI796OH9sDK53a6q9nD ZueQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xuiZ+dA63qa6KuTRM/9EMSF12UiDXQURMhZ59hCd4g8=; fh=xcb3qhkLQEi6t+Vw3J1T1wFra1a2BdIsNlygM9Jzpag=; b=g2nz/hEWidB82jV5/gy5DZddz6glUuvWXXh63WB8F3MP1ZsfE3CTnCO6LKJBmpNmK4 P6STZR4qyWGn8HSdf9ySZ5IaNx26e3fx3G9BF4tS2zT1g1T+rL98NZ070//lvLxzj/Hp 7T10C+gzMs8e8gEYluCOSBoIDIIZL+47dVuUS5w+LYEJka0VM+fH3LpLpI2toPtOgTmH btiAKaS10krm7c/FGhCRicGELQOnARNnKCu4AMWXJxjh35QGMAHm3zdcZt8RT4G4aN++ JQhaAm7NhyO1zOyFCJPqSO9roIf49MQe8hCZ1muqcmVYpPom40u4pHpFDZS2GkpX/jjT eevg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=hrprsTQ7; spf=pass (google.com: domain of linux-kernel+bounces-12368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m21-20020a05620a24d500b0077f60bceed5si17323885qkn.351.2023.12.27.17.42.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:42:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=hrprsTQ7; spf=pass (google.com: domain of linux-kernel+bounces-12368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E592B1C20EE3 for ; Thu, 28 Dec 2023 01:42:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E810C2572; Thu, 28 Dec 2023 01:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="hrprsTQ7" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC18F15C4 for ; Thu, 28 Dec 2023 01:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6d98ce84e18so3891032b3a.3 for ; Wed, 27 Dec 2023 17:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1703727745; x=1704332545; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xuiZ+dA63qa6KuTRM/9EMSF12UiDXQURMhZ59hCd4g8=; b=hrprsTQ71tPBhB2Fb/uL9FCkSQ7BtyqZJrmMSgxTQxDECXYvzerZcG5VXtzqhIhvk8 VHTf336LUSs3GJ8YczHMGB6xTrkQGjCf1NA9gOiq1bEMfMA70gCy13o0fqeg0LAnPBlX bqfySVi47x95fL3M5cUDfJmhRMetJXHR3uhzCSeDlm3Bi+7s0ikAa55hhPxK70GiZoUY cnfga12XDILrBR0P7wblA5Z6DAj8MW+dJ9Ov3wP2BEGNfpgri9DimtrN0+ZVN+FEsmR3 lunUaE5XV4gSo7HKgNB32RexxF4VjJkjmEooeo5jF8gVNkVIlDbLSBhRRLNhCT+TpyLp 2c6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703727745; x=1704332545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xuiZ+dA63qa6KuTRM/9EMSF12UiDXQURMhZ59hCd4g8=; b=BxzqfOV7fR1P64akSowKzZSxUIs6LkMClRAqGQjCkSfLYBZNnodTyVEtpwL+d548fZ DsYIa5UZxQK7d84EX1jAlLcHSAR1JmIZCRdn4Z9RjHhRDz1T3nSMDuzgnaoZL5WhAbik UlLp4UPxUpG72pZINzpDgIDsRRjTIMZykBuUArfXxndrno3DbKnN4aREqC1PfQkzlhZq jDpt2SI6Dzojuulw5DW+iZqBPVdPMyZMNTIHVnKj23uq1G3YSBlClumJts76XlxIjnFT KeL3r18iIl5LHLS507rJFpKArnYt/Z5Roz4a3Gp+LLTx/JaFX2WpBqoexV7x5QLkVTA3 KnFQ== X-Gm-Message-State: AOJu0YzdgYjzMpP7aFCMPKP7sUEypzk5vh6eVhuShAfWh6A9x7/oQ2s2 iUpX4uMH9ldaBwnwzBp3zPbUBUUVn4XzOA== X-Received: by 2002:aa7:9142:0:b0:6d9:cbb1:7818 with SMTP id 2-20020aa79142000000b006d9cbb17818mr4021989pfi.20.1703727745150; Wed, 27 Dec 2023 17:42:25 -0800 (PST) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id g24-20020aa78758000000b006d49ed3effasm7335440pfo.63.2023.12.27.17.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:42:24 -0800 (PST) From: Samuel Holland To: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-riscv@lists.infradead.org, Christoph Hellwig Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arch@vger.kernel.org, Samuel Holland Subject: [PATCH v2 02/14] ARM: Implement ARCH_HAS_KERNEL_FPU_SUPPORT Date: Wed, 27 Dec 2023 17:41:52 -0800 Message-ID: <20231228014220.3562640-3-samuel.holland@sifive.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231228014220.3562640-1-samuel.holland@sifive.com> References: <20231228014220.3562640-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARM 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. Reviewed-by: Christoph Hellwig Signed-off-by: Samuel Holland --- Changes in v2: - Remove file name from header comment arch/arm/Kconfig | 1 + arch/arm/Makefile | 7 +++++++ arch/arm/include/asm/fpu.h | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 arch/arm/include/asm/fpu.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f8567e95f98b..92e21a4a2903 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -14,6 +14,7 @@ config ARM select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_KEEPINITRD select ARCH_HAS_KCOV + select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON select ARCH_HAS_MEMBARRIER_SYNC_CORE select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_SPECIAL if ARM_LPAE diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 5ba42f69f8ce..1dd860dba5f5 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -130,6 +130,13 @@ endif # Accept old syntax despite ".syntax unified" AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) +# 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_FPU += -march=armv7-a -mfloat-abi=softfp -mfpu=neon + ifeq ($(CONFIG_THUMB2_KERNEL),y) CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN) AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb diff --git a/arch/arm/include/asm/fpu.h b/arch/arm/include/asm/fpu.h new file mode 100644 index 000000000000..2ae50bdce59b --- /dev/null +++ b/arch/arm/include/asm/fpu.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2023 SiFive + */ + +#ifndef __ASM_FPU_H +#define __ASM_FPU_H + +#include + +#define kernel_fpu_available() cpu_has_neon() +#define kernel_fpu_begin() kernel_neon_begin() +#define kernel_fpu_end() kernel_neon_end() + +#endif /* ! __ASM_FPU_H */ -- 2.42.0