]> git.baikalelectronics.ru Git - kernel.git/commitdiff
LoongArch: Fix wrong fpu version
authorTiezhu Yang <yangtiezhu@loongson.cn>
Sat, 18 Jun 2022 04:50:31 +0000 (12:50 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 25 Jun 2022 10:05:59 +0000 (18:05 +0800)
According to the configuration information accessible by the CPUCFG
instruction in LoongArch Reference Manual [1], FP_ver is stored in
bit [5: 3] of CPUCFG2, the current code to get fpu version is wrong,
use CPUCFG2_FPVERS to fix it.

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Fixes: 637fba705cec ("LoongArch: Add boot and setup routines")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/cpu-probe.c

index 6c87ea36b2573b3d4b152759894649ee25e88cb9..529ab8f44ec6d9fcecbba29099c224fa087d9c08 100644 (file)
@@ -263,7 +263,7 @@ void cpu_probe(void)
 
        c->cputype      = CPU_UNKNOWN;
        c->processor_id = read_cpucfg(LOONGARCH_CPUCFG0);
-       c->fpu_vers     = (read_cpucfg(LOONGARCH_CPUCFG2) >> 3) & 0x3;
+       c->fpu_vers     = (read_cpucfg(LOONGARCH_CPUCFG2) & CPUCFG2_FPVERS) >> 3;
 
        c->fpu_csr0     = FPU_CSR_RN;
        c->fpu_mask     = FPU_CSR_RSVD;