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
Unified · Split
| @@ -263,7 +263,7 @@ void cpu_probe(void) · 262 unmodified lines | |||
| 263 | 263 | ||
| 264 | c->cputype = CPU_UNKNOWN; | 264 | c->cputype = CPU_UNKNOWN; |
| 265 | c->processor_id = read_cpucfg(LOONGARCH_CPUCFG0); | 265 | c->processor_id = read_cpucfg(LOONGARCH_CPUCFG0); |
| 266 | c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) >> 3) & 0x3; | 266 | c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) & CPUCFG2_FPVERS) >> 3; |
| 267 | 267 | ||
| 268 | c->fpu_csr0 = FPU_CSR_RN; | 268 | c->fpu_csr0 = FPU_CSR_RN; |
| 269 | c->fpu_mask = FPU_CSR_RSVD; | 269 | c->fpu_mask = FPU_CSR_RSVD; |