MIPS: remove asm/war.h
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 18 Feb 2022 10:04:39 +0000 (11:04 +0100)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 22 Feb 2022 08:35:49 +0000 (09:35 +0100)
The major part for workaround handling has already moved to config
options. This change replaces the remaining defines by already
available config options and gets rid of war.h

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
17 files changed:
arch/mips/Kconfig
arch/mips/include/asm/futex.h
arch/mips/include/asm/mipsmtregs.h
arch/mips/include/asm/mipsregs.h
arch/mips/include/asm/war.h [deleted file]
arch/mips/kernel/entry.S
arch/mips/kernel/genex.S
arch/mips/kernel/r4k-bugs64.c
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-n64.S
arch/mips/kernel/signal.c
arch/mips/kernel/signal_n32.c
arch/mips/lib/delay.c
arch/mips/mm/c-octeon.c
arch/mips/mm/c-r4k.c
arch/mips/mm/page.c
arch/mips/mm/tlbex.c

index c6672547ac5e580bbd4de782c3f04ce1fe07c334..f8f11542d044614ffbe846866d2c9a2cd6882a3d 100644 (file)
@@ -2521,13 +2521,51 @@ config CPU_HAS_SYNC
 #
 # CPU non-features
 #
+
+# Work around the "daddi" and "daddiu" CPU errata:
+#
+# - The `daddi' instruction fails to trap on overflow.
+#   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
+#   erratum #23
+#
+# - The `daddiu' instruction can produce an incorrect result.
+#   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
+#   erratum #41
+#   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
+#   #15
+#   "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
+#   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
 config CPU_DADDI_WORKAROUNDS
        bool
 
+# Work around certain R4000 CPU errata (as implemented by GCC):
+#
+# - A double-word or a variable shift may give an incorrect result
+#   if executed immediately after starting an integer division:
+#   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
+#   erratum #28
+#   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
+#   #19
+#
+# - A double-word or a variable shift may give an incorrect result
+#   if executed while an integer multiplication is in progress:
+#   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
+#   errata #16 & #28
+#
+# - An integer division may give an incorrect result if started in
+#   a delay slot of a taken branch or a jump:
+#   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
+#   erratum #52
 config CPU_R4000_WORKAROUNDS
        bool
        select CPU_R4400_WORKAROUNDS
 
+# Work around certain R4400 CPU errata (as implemented by GCC):
+#
+# - A double-word or a variable shift may give an incorrect result
+#   if executed immediately after starting an integer division:
+#   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
+#   "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
 config CPU_R4400_WORKAROUNDS
        bool
 
index 8612a7e42d7881d444cebb03d16d99151ecc694e..05832eb240fabd80694965260a6444a2ea6a1cc6 100644 (file)
@@ -17,7 +17,6 @@
 #include <asm/compiler.h>
 #include <asm/errno.h>
 #include <asm/sync.h>
-#include <asm/war.h>
 
 #define arch_futex_atomic_op_inuser arch_futex_atomic_op_inuser
 #define futex_atomic_cmpxchg_inatomic futex_atomic_cmpxchg_inatomic
index be4cf9d477bee8249298325f4c8041a509fada7e..a8d67c2f4f7b33b94ec9835194bf51bbe265aba0 100644 (file)
@@ -9,7 +9,6 @@
 #define _ASM_MIPSMTREGS_H
 
 #include <asm/mipsregs.h>
-#include <asm/war.h>
 
 #ifndef __ASSEMBLY__
 
index 2616353b940c7968093b9cb596211f5cd1d68ec2..305651af15b3150822ddf84cafcdc61e9c606914 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/types.h>
 #include <asm/hazards.h>
 #include <asm/isa-rev.h>
-#include <asm/war.h>
 
 /*
  * The following macros are especially useful for __asm__
diff --git a/arch/mips/include/asm/war.h b/arch/mips/include/asm/war.h
deleted file mode 100644 (file)
index 21443f0..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2002, 2004, 2007 by Ralf Baechle
- * Copyright (C) 2007  Maciej W. Rozycki
- */
-#ifndef _ASM_WAR_H
-#define _ASM_WAR_H
-
-/*
- * Work around certain R4000 CPU errata (as implemented by GCC):
- *
- * - A double-word or a variable shift may give an incorrect result
- *   if executed immediately after starting an integer division:
- *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
- *   erratum #28
- *   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
- *   #19
- *
- * - A double-word or a variable shift may give an incorrect result
- *   if executed while an integer multiplication is in progress:
- *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
- *   errata #16 & #28
- *
- * - An integer division may give an incorrect result if started in
- *   a delay slot of a taken branch or a jump:
- *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
- *   erratum #52
- */
-#ifdef CONFIG_CPU_R4000_WORKAROUNDS
-#define R4000_WAR 1
-#else
-#define R4000_WAR 0
-#endif
-
-/*
- * Work around certain R4400 CPU errata (as implemented by GCC):
- *
- * - A double-word or a variable shift may give an incorrect result
- *   if executed immediately after starting an integer division:
- *   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
- *   "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
- */
-#ifdef CONFIG_CPU_R4400_WORKAROUNDS
-#define R4400_WAR 1
-#else
-#define R4400_WAR 0
-#endif
-
-/*
- * Work around the "daddi" and "daddiu" CPU errata:
- *
- * - The `daddi' instruction fails to trap on overflow.
- *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
- *   erratum #23
- *
- * - The `daddiu' instruction can produce an incorrect result.
- *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
- *   erratum #41
- *   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
- *   #15
- *   "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
- *   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
- */
-#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
-#define DADDI_WAR 1
-#else
-#define DADDI_WAR 0
-#endif
-
-#endif /* _ASM_WAR_H */
index 4b896f5023ffa4035ba32d6729a059c603c5197f..d8ca173680f960bd2614c545a4c955f04b527396 100644 (file)
@@ -17,7 +17,6 @@
 #include <asm/stackframe.h>
 #include <asm/isadep.h>
 #include <asm/thread_info.h>
-#include <asm/war.h>
 
 #ifndef CONFIG_PREEMPTION
 #define resume_kernel  restore_all
index 743d75927b7104dbc9fc06ef23650d8e408b8e47..fc53ea2cf850388ba932507da278e806f21e9072 100644 (file)
@@ -19,7 +19,6 @@
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
 #include <asm/sync.h>
-#include <asm/war.h>
 #include <asm/thread_info.h>
 
        __INIT
index 35729c9e6cfa116cd599c0f2cb34469ca8431c23..6ffefb2c6971e252169681f9340ce1088f7e5019 100644 (file)
@@ -163,7 +163,8 @@ static __always_inline __init void check_mult_sh(void)
        }
 
        pr_cont("no.\n");
-       panic(bug64hit, !R4000_WAR ? r4kwar : nowar);
+       panic(bug64hit,
+             IS_ENABLED(CONFIG_CPU_R4000_WORKAROUNDS) ? nowar : r4kwar);
 }
 
 static volatile int daddi_ov;
@@ -239,7 +240,8 @@ static __init void check_daddi(void)
        }
 
        pr_cont("no.\n");
-       panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
+       panic(bug64hit,
+             IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) ? nowar : daddiwar);
 }
 
 int daddiu_bug = -1;
@@ -307,7 +309,8 @@ static __init void check_daddiu(void)
        }
 
        pr_cont("no.\n");
-       panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
+       panic(bug64hit,
+             IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) ? nowar : daddiwar);
 }
 
 void __init check_bugs64_early(void)
index 9bfce5f75f6011f91e971bed8c6769c9574909dd..18dc9b34505614d2bc84767479a3e9972c1ba8ad 100644 (file)
@@ -19,7 +19,6 @@
 #include <asm/sysmips.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
-#include <asm/war.h>
 #include <asm/asm-offsets.h>
 
        .align  5
index 5f6ed4b4c39937b1d13c4fe6329d2f8e66775fc4..e6264aa62e457f02b8a50df8b266a58b8361717d 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/sysmips.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
-#include <asm/war.h>
 
 #ifndef CONFIG_MIPS32_COMPAT
 /* Neither O32 nor N32, so define handle_sys here */
index 5bce782e694c554e508b5146ded0cbff670e655c..71e309be86a23b68d487249f9373f9a64b7dde74 100644 (file)
@@ -35,7 +35,6 @@
 #include <asm/sim.h>
 #include <asm/ucontext.h>
 #include <asm/cpu-features.h>
-#include <asm/war.h>
 #include <asm/dsp.h>
 #include <asm/inst.h>
 #include <asm/msa.h>
index 7bd00fad61af8f037ff3e1232a3ddccb8b135a3e..cfc77b69420a1f1278b85c1e3ad875c49925ca21 100644 (file)
@@ -24,7 +24,6 @@
 #include <asm/ucontext.h>
 #include <asm/fpu.h>
 #include <asm/cpu-features.h>
-#include <asm/war.h>
 
 #include "signal-common.h"
 
index 2e8dfc1d59c8bb2cbcbbf6c84ef0d267edb847b7..ccdb1fc1e4bf1bb0674e2ff311f3c8d0179cd989 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <asm/asm.h>
 #include <asm/compiler.h>
-#include <asm/war.h>
 
 #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
 #define GCC_DADDI_IMM_ASM() "I"
index 737870d8fd945bef06b8e7d9b1d27ba21e8704a4..c7ed589de882a3f458057517d8eae711ff495d55 100644 (file)
@@ -23,7 +23,6 @@
 #include <asm/r4kcache.h>
 #include <asm/traps.h>
 #include <asm/mmu_context.h>
-#include <asm/war.h>
 
 #include <asm/octeon/octeon.h>
 
index 50261fd8eb21c5ae9e5e356d8feaafdce1db1a61..ccb9e47322b0f74b3051750bd019bf7368b11f49 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/r4kcache.h>
 #include <asm/sections.h>
 #include <asm/mmu_context.h>
-#include <asm/war.h>
 #include <asm/cacheflush.h> /* for run_uncached() */
 #include <asm/traps.h>
 #include <asm/mips-cps.h>
index 504bc4047c4cfe7cfb432c57cd025d9001b8c093..d3b4459d0fe85edbd2767629db175bcd619a72af 100644 (file)
@@ -25,7 +25,6 @@
 #include <asm/mipsregs.h>
 #include <asm/mmu_context.h>
 #include <asm/cpu.h>
-#include <asm/war.h>
 
 #ifdef CONFIG_SIBYTE_DMA_PAGEOPS
 #include <asm/sibyte/sb1250.h>
@@ -103,7 +102,9 @@ static int cache_line_size;
 static inline void
 pg_addiu(u32 **buf, unsigned int reg1, unsigned int reg2, unsigned int off)
 {
-       if (cpu_has_64bit_gp_regs && DADDI_WAR && r4k_daddiu_bug()) {
+       if (cpu_has_64bit_gp_regs &&
+           IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) &&
+           r4k_daddiu_bug()) {
                if (off > 0x7fff) {
                        uasm_i_lui(buf, T9, uasm_rel_hi(off));
                        uasm_i_addiu(buf, T9, T9, uasm_rel_lo(off));
index b131e6a773832c0ea263ec3239854486084e87bd..d9df2c43b15c03030f4b73fd5ba5a644c47bd037 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu-type.h>
 #include <asm/mmu_context.h>
-#include <asm/war.h>
 #include <asm/uasm.h>
 #include <asm/setup.h>
 #include <asm/tlbex.h>