[RFC PATCH 04/12] arm64: Implement ARCH_HAS_KERNEL_FPU_SUPPORT
Will Deacon
will at kernel.org
Wed Dec 13 08:19:44 PST 2023
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 <samuel.holland at sifive.com>
> ---
>
> 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 <arm_neon.h>
> +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
More information about the linux-arm-kernel
mailing list