Merge branches 'x86/early-printk', 'x86/microcode' and 'core/objtool' into x86/urgent...
[sfrench/cifs-2.6.git] / arch / riscv / kernel / cpufeature.c
index 17011a870044c0beeee89d05491af5534f4562ff..5493f3228704740e913e0d5883d1cca99ba7f645 100644 (file)
@@ -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)
 {
@@ -57,5 +60,17 @@ void riscv_fill_hwcap(void)
        for (i = 0; i < strlen(isa); ++i)
                elf_hwcap |= isa2hwcap[(unsigned char)(isa[i])];
 
+       /* We don't support systems with F but without D, so mask those out
+        * here. */
+       if ((elf_hwcap & COMPAT_HWCAP_ISA_F) && !(elf_hwcap & COMPAT_HWCAP_ISA_D)) {
+               pr_info("This kernel does not support systems with F but not D");
+               elf_hwcap &= ~COMPAT_HWCAP_ISA_F;
+       }
+
        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
 }