OSDN Git Service

MIPS: r4k-bugs64: Limit R4k bug checks to affected systems
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 23:04:32 +0000 (23:04 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:38:53 +0000 (09:38 -0700)
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
arch/mips/Kconfig
arch/mips/include/asm/bugs.h
arch/mips/kernel/Makefile
arch/mips/kernel/genex.S
arch/mips/kernel/r4k-bugs64.c [moved from arch/mips/kernel/cpu-bugs64.c with 100% similarity]

index a0bd9bd..8736bf4 100644 (file)
@@ -2554,6 +2554,10 @@ config CPU_R4000_WORKAROUNDS
 config CPU_R4400_WORKAROUNDS
        bool
 
+config CPU_R4X00_BUGS64
+       bool
+       default y if SYS_HAS_CPU_R4X00 && 64BIT && (TARGET_ISA_REV < 1)
+
 config MIPS_ASID_SHIFT
        int
        default 6 if CPU_R3000 || CPU_TX39XX
index d8ab8b7..d72dc6e 100644 (file)
@@ -26,9 +26,8 @@ extern void check_bugs64(void);
 
 static inline void check_bugs_early(void)
 {
-#ifdef CONFIG_64BIT
-       check_bugs64_early();
-#endif
+       if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
+               check_bugs64_early();
 }
 
 static inline void check_bugs(void)
@@ -37,19 +36,18 @@ static inline void check_bugs(void)
 
        cpu_data[cpu].udelay_val = loops_per_jiffy;
        check_bugs32();
-#ifdef CONFIG_64BIT
-       check_bugs64();
-#endif
+
+       if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
+               check_bugs64();
 }
 
 static inline int r4k_daddiu_bug(void)
 {
-#ifdef CONFIG_64BIT
+       if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
+               return 0;
+
        WARN_ON(daddiu_bug < 0);
        return daddiu_bug != 0;
-#else
-       return 0;
-#endif
 }
 
 #endif /* _ASM_BUGS_H */
index 89b07ea..d6e97df 100644 (file)
@@ -80,7 +80,7 @@ obj-$(CONFIG_KGDB)            += kgdb.o
 obj-$(CONFIG_PROC_FS)          += proc.o
 obj-$(CONFIG_MAGIC_SYSRQ)      += sysrq.o
 
-obj-$(CONFIG_64BIT)            += cpu-bugs64.o
+obj-$(CONFIG_CPU_R4X00_BUGS64) += r4k-bugs64.o
 
 obj-$(CONFIG_I8253)            += i8253.o
 
index efde27c..d586cda 100644 (file)
@@ -657,7 +657,7 @@ isrdhwr:
        .set    pop
        END(handle_ri_rdhwr)
 
-#ifdef CONFIG_64BIT
+#ifdef CONFIG_CPU_R4X00_BUGS64
 /* A temporary overflow handler used by check_daddi(). */
 
        __INIT