diff options
author | Tiezhu Yang <yangtiezhu@loongson.cn> | 2022-06-18 07:50:31 +0300 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2022-06-25 13:05:59 +0300 |
commit | ad82eef3cebf8cd4f67e20b902e6d02e679e2ef1 (patch) | |
tree | 3c5b9264efc55a4f3e08ce8dd07d19ce27e06c1d | |
parent | 26808cebf14cdf1d835ae256188ece116d2ab377 (diff) | |
download | linux-ad82eef3cebf8cd4f67e20b902e6d02e679e2ef1.tar.xz |
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
Fixes: 628c3bb40e9a ("LoongArch: Add boot and setup routines")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r-- | arch/loongarch/kernel/cpu-probe.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c index 6c87ea36b257..529ab8f44ec6 100644 --- a/arch/loongarch/kernel/cpu-probe.c +++ b/arch/loongarch/kernel/cpu-probe.c @@ -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; |