diff options
author | Palmer Dabbelt <palmer@sifive.com> | 2018-10-23 02:38:26 +0200 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-10-23 02:38:26 +0200 |
commit | 4e4101cfefd382176b05356c5ef112561ae10384 (patch) | |
tree | b60173dc3824f7da801b33d5d1d172c4a6f9e41f /arch/riscv/kernel/cpufeature.c | |
parent | RISC-V: Cosmetic menuconfig changes (diff) | |
parent | Auto-detect whether a FPU exists (diff) | |
download | linux-4e4101cfefd382176b05356c5ef112561ae10384.tar.xz linux-4e4101cfefd382176b05356c5ef112561ae10384.zip |
riscv: Add support to no-FPU systems
This patchset adds an option, CONFIG_FPU, to enable/disable floating-
point support within the kernel. The kernel's new behavior will be as
follows:
* with CONFIG_FPU=y
All FPU codes are reserved. If no FPU is found during booting, a
global flag will be set, and those functions will be bypassed with
condition check to that flag.
* with CONFIG_FPU=n
No floating-point instructions in kernel and all related settings
are excluded.
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/riscv/kernel/cpufeature.c')
-rw-r--r-- | arch/riscv/kernel/cpufeature.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 652d102ffa06..5493f3228704 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -22,6 +22,9 @@ #include <asm/hwcap.h> unsigned long elf_hwcap __read_mostly; +#ifdef CONFIG_FPU +bool has_fpu __read_mostly; +#endif void riscv_fill_hwcap(void) { @@ -65,4 +68,9 @@ void riscv_fill_hwcap(void) } pr_info("elf_hwcap is 0x%lx", elf_hwcap); + +#ifdef CONFIG_FPU + if (elf_hwcap & (COMPAT_HWCAP_ISA_F | COMPAT_HWCAP_ISA_D)) + has_fpu = true; +#endif } |