History

LoongArch: Fix wrong fpu version

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

Tiezhu Yang committed 4 years ago

Commit ad82eef1 parent 26808ce1 file · +1 −1Browse files

Unified · Split

arch/loongarch/kernel/cpu-probe.c+1−1
@@ -263,7 +263,7 @@ void cpu_probe(void) · 262 unmodified lines
263263
264264 c->cputype = CPU_UNKNOWN;
265265 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;
267267
268268 c->fpu_csr0 = FPU_CSR_RN;
269269 c->fpu_mask = FPU_CSR_RSVD;