Skip to content

Commit 372f662

Browse files
SiFiveHollandakpm00
authored andcommitted
LoongArch: implement ARCH_HAS_KERNEL_FPU_SUPPORT
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>
1 parent 4be0739 commit 372f662

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ config LOONGARCH
1818
select ARCH_HAS_CURRENT_STACK_POINTER
1919
select ARCH_HAS_FORTIFY_SOURCE
2020
select ARCH_HAS_KCOV
21+
select ARCH_HAS_KERNEL_FPU_SUPPORT if CPU_HAS_FPU
2122
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
2223
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
2324
select ARCH_HAS_PTE_SPECIAL

arch/loongarch/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ endif
2626
32bit-emul = elf32loongarch
2727
64bit-emul = elf64loongarch
2828

29+
CC_FLAGS_FPU := -mfpu=64
30+
CC_FLAGS_NO_FPU := -msoft-float
31+
2932
ifdef CONFIG_UNWINDER_ORC
3033
orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
3134
orc_hash_sh := $(srctree)/scripts/orc_hash.sh
@@ -59,7 +62,7 @@ ld-emul = $(64bit-emul)
5962
cflags-y += -mabi=lp64s
6063
endif
6164

62-
cflags-y += -pipe -msoft-float
65+
cflags-y += -pipe $(CC_FLAGS_NO_FPU)
6366
LDFLAGS_vmlinux += -static -n -nostdlib
6467

6568
# When the assembler supports explicit relocation hint, we must use it.

arch/loongarch/include/asm/fpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
struct sigcontext;
2323

24+
#define kernel_fpu_available() cpu_has_fpu
2425
extern void kernel_fpu_begin(void);
2526
extern void kernel_fpu_end(void);
2627

0 commit comments

Comments
 (0)