Skip to content

Commit cb2b7b7

Browse files
SiFiveHollandakpm00
authored andcommitted
ARM: implement ARCH_HAS_KERNEL_FPU_SUPPORT
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. [[email protected]: ARM: do not select ARCH_HAS_KERNEL_FPU_SUPPORT] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Borislav Petkov (AMD) <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nicolas Schier <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Russell King <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Will Deacon <[email protected]> Cc: Thiago Jung Bauermann <[email protected]> Cc: Ard Biesheuvel <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6cbd1d6 commit cb2b7b7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

arch/arm/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ endif
130130
# Accept old syntax despite ".syntax unified"
131131
AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
132132

133+
# The GCC option -ffreestanding is required in order to compile code containing
134+
# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
135+
CC_FLAGS_FPU := -ffreestanding
136+
# Enable <arm_neon.h>
137+
CC_FLAGS_FPU += -isystem $(shell $(CC) -print-file-name=include)
138+
CC_FLAGS_FPU += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
139+
133140
ifeq ($(CONFIG_THUMB2_KERNEL),y)
134141
CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
135142
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb

arch/arm/include/asm/fpu.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2023 SiFive
4+
*/
5+
6+
#ifndef __ASM_FPU_H
7+
#define __ASM_FPU_H
8+
9+
#include <asm/neon.h>
10+
11+
#define kernel_fpu_available() cpu_has_neon()
12+
#define kernel_fpu_begin() kernel_neon_begin()
13+
#define kernel_fpu_end() kernel_neon_end()
14+
15+
#endif /* ! __ASM_FPU_H */

0 commit comments

Comments
 (0)