Skip to content

Commit 65fee01

Browse files
chenhuacaitsbogend
authored andcommitted
MIPS: Loongson: Fix cpu_probe_loongson() again
Commit 7db5e9e ("MIPS: loongson64: fix FTLB configuration") move decode_configs() from the beginning of cpu_probe_loongson() to the end in order to fix FTLB configuration. However, it breaks the CPUCFG decoding because decode_configs() use "c->options = xxxx" rather than "c->options |= xxxx", all information get from CPUCFG by decode_cpucfg() is lost. This causes error when creating a KVM guest on Loongson-3A4000: Exception Code: 4 not handled @ PC: 0000000087ad5981, inst: 0xcb7a1898 BadVaddr: 0x0 Status: 0x0 Fix this by moving the c->cputype setting to the beginning and moving decode_configs() after that. Fixes: 7db5e9e ("MIPS: loongson64: fix FTLB configuration") Cc: stable@vger.kernel.org Cc: Huang Pei <huangpei@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent e47084e commit 65fee01

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/mips/kernel/cpu-probe.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,10 @@ static inline void decode_cpucfg(struct cpuinfo_mips *c)
16771677

16781678
static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
16791679
{
1680+
c->cputype = CPU_LOONGSON64;
1681+
16801682
/* All Loongson processors covered here define ExcCode 16 as GSExc. */
1683+
decode_configs(c);
16811684
c->options |= MIPS_CPU_GSEXCEX;
16821685

16831686
switch (c->processor_id & PRID_IMP_MASK) {
@@ -1687,7 +1690,6 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
16871690
case PRID_REV_LOONGSON2K_R1_1:
16881691
case PRID_REV_LOONGSON2K_R1_2:
16891692
case PRID_REV_LOONGSON2K_R1_3:
1690-
c->cputype = CPU_LOONGSON64;
16911693
__cpu_name[cpu] = "Loongson-2K";
16921694
set_elf_platform(cpu, "gs264e");
16931695
set_isa(c, MIPS_CPU_ISA_M64R2);
@@ -1700,14 +1702,12 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
17001702
switch (c->processor_id & PRID_REV_MASK) {
17011703
case PRID_REV_LOONGSON3A_R2_0:
17021704
case PRID_REV_LOONGSON3A_R2_1:
1703-
c->cputype = CPU_LOONGSON64;
17041705
__cpu_name[cpu] = "ICT Loongson-3";
17051706
set_elf_platform(cpu, "loongson3a");
17061707
set_isa(c, MIPS_CPU_ISA_M64R2);
17071708
break;
17081709
case PRID_REV_LOONGSON3A_R3_0:
17091710
case PRID_REV_LOONGSON3A_R3_1:
1710-
c->cputype = CPU_LOONGSON64;
17111711
__cpu_name[cpu] = "ICT Loongson-3";
17121712
set_elf_platform(cpu, "loongson3a");
17131713
set_isa(c, MIPS_CPU_ISA_M64R2);
@@ -1727,7 +1727,6 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
17271727
c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */
17281728
break;
17291729
case PRID_IMP_LOONGSON_64G:
1730-
c->cputype = CPU_LOONGSON64;
17311730
__cpu_name[cpu] = "ICT Loongson-3";
17321731
set_elf_platform(cpu, "loongson3a");
17331732
set_isa(c, MIPS_CPU_ISA_M64R2);
@@ -1737,8 +1736,6 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
17371736
panic("Unknown Loongson Processor ID!");
17381737
break;
17391738
}
1740-
1741-
decode_configs(c);
17421739
}
17431740
#else
17441741
static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) { }

0 commit comments

Comments
 (0)