Skip to content

Commit 071d2f0

Browse files
committed
MIPS: r4k-bugs64: Limit R4k bug checks to affected systems
Only build the checks for R4k errata workarounds if we expect that the kernel might actually run on a system with an R4k CPU - ie. CONFIG_SYS_HAS_CPU_R4X00=y & we're targeting a pre-MIPSr1 ISA revision. Rename cpu-bugs64.c to r4k-bugs64.c to indicate the fact that the code is specific to R4k CPUs. Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org
1 parent 4bf841e commit 071d2f0

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,10 @@ config CPU_R4000_WORKAROUNDS
25542554
config CPU_R4400_WORKAROUNDS
25552555
bool
25562556

2557+
config CPU_R4X00_BUGS64
2558+
bool
2559+
default y if SYS_HAS_CPU_R4X00 && 64BIT && (TARGET_ISA_REV < 1)
2560+
25572561
config MIPS_ASID_SHIFT
25582562
int
25592563
default 6 if CPU_R3000 || CPU_TX39XX

‎arch/mips/include/asm/bugs.h‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ extern void check_bugs64(void);
2626

2727
static inline void check_bugs_early(void)
2828
{
29-
#ifdef CONFIG_64BIT
30-
check_bugs64_early();
31-
#endif
29+
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
30+
check_bugs64_early();
3231
}
3332

3433
static inline void check_bugs(void)
@@ -37,19 +36,18 @@ static inline void check_bugs(void)
3736

3837
cpu_data[cpu].udelay_val = loops_per_jiffy;
3938
check_bugs32();
40-
#ifdef CONFIG_64BIT
41-
check_bugs64();
42-
#endif
39+
40+
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
41+
check_bugs64();
4342
}
4443

4544
static inline int r4k_daddiu_bug(void)
4645
{
47-
#ifdef CONFIG_64BIT
46+
if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
47+
return 0;
48+
4849
WARN_ON(daddiu_bug < 0);
4950
return daddiu_bug != 0;
50-
#else
51-
return 0;
52-
#endif
5351
}
5452

5553
#endif /* _ASM_BUGS_H */

‎arch/mips/kernel/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ obj-$(CONFIG_KGDB) += kgdb.o
8080
obj-$(CONFIG_PROC_FS) += proc.o
8181
obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
8282

83-
obj-$(CONFIG_64BIT) += cpu-bugs64.o
83+
obj-$(CONFIG_CPU_R4X00_BUGS64) += r4k-bugs64.o
8484

8585
obj-$(CONFIG_I8253) += i8253.o
8686

‎arch/mips/kernel/genex.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ isrdhwr:
657657
.set pop
658658
END(handle_ri_rdhwr)
659659

660-
#ifdef CONFIG_64BIT
660+
#ifdef CONFIG_CPU_R4X00_BUGS64
661661
/* A temporary overflow handler used by check_daddi(). */
662662

663663
__INIT

0 commit comments

Comments
 (0)