]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
LoongArch: implement ARCH_HAS_KERNEL_FPU_SUPPORT
authorSamuel Holland <samuel.holland@sifive.com>
Fri, 29 Mar 2024 07:18:22 +0000 (00:18 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 19 May 2024 21:36:18 +0000 (14:36 -0700)
LoongArch already provides kernel_fpu_begin() and kernel_fpu_end() in
asm/fpu.h, so it only needs to add kernel_fpu_available() and export the
CFLAGS adjustments.

Link: https://lkml.kernel.org/r/20240329072441.591471-8-samuel.holland@sifive.com
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Acked-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/loongarch/Kconfig
arch/loongarch/Makefile
arch/loongarch/include/asm/fpu.h

index 4bda59525a1340ab51051c4ae708efcbf1b2eaca..b94223f589083c79b1c75e668ffbb8d33f93b0d3 100644 (file)
@@ -18,6 +18,7 @@ config LOONGARCH
        select ARCH_HAS_CURRENT_STACK_POINTER
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_KCOV
+       select ARCH_HAS_KERNEL_FPU_SUPPORT if CPU_HAS_FPU
        select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
        select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
        select ARCH_HAS_PTE_SPECIAL
index df6caf79537a9d884aa97161a32840782147460e..efb5440a43ec4c0d7e2992ce894f219a49230d40 100644 (file)
@@ -26,6 +26,9 @@ endif
 32bit-emul             = elf32loongarch
 64bit-emul             = elf64loongarch
 
+CC_FLAGS_FPU           := -mfpu=64
+CC_FLAGS_NO_FPU                := -msoft-float
+
 ifdef CONFIG_UNWINDER_ORC
 orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
 orc_hash_sh := $(srctree)/scripts/orc_hash.sh
@@ -59,7 +62,7 @@ ld-emul                       = $(64bit-emul)
 cflags-y               += -mabi=lp64s
 endif
 
-cflags-y                       += -pipe -msoft-float
+cflags-y                       += -pipe $(CC_FLAGS_NO_FPU)
 LDFLAGS_vmlinux                        += -static -n -nostdlib
 
 # When the assembler supports explicit relocation hint, we must use it.
index c2d8962fda00bec9b6a7fa1fee0a3ff720823a01..3177674228f8961408be4e2e028d5d083fb8e71c 100644 (file)
@@ -21,6 +21,7 @@
 
 struct sigcontext;
 
+#define kernel_fpu_available() cpu_has_fpu
 extern void kernel_fpu_begin(void);
 extern void kernel_fpu_end(void);