Skip to content

Commit b56d1ca

Browse files
committed
MIPS: remove asm/war.h
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>
1 parent c47c7ab commit b56d1ca

17 files changed

+47
-91
lines changed

arch/mips/Kconfig

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,13 +2521,51 @@ config CPU_HAS_SYNC
25212521
#
25222522
# CPU non-features
25232523
#
2524+
2525+
# Work around the "daddi" and "daddiu" CPU errata:
2526+
#
2527+
# - The `daddi' instruction fails to trap on overflow.
2528+
# "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
2529+
# erratum #23
2530+
#
2531+
# - The `daddiu' instruction can produce an incorrect result.
2532+
# "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
2533+
# erratum #41
2534+
# "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
2535+
# #15
2536+
# "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
2537+
# "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
25242538
config CPU_DADDI_WORKAROUNDS
25252539
bool
25262540

2541+
# Work around certain R4000 CPU errata (as implemented by GCC):
2542+
#
2543+
# - A double-word or a variable shift may give an incorrect result
2544+
# if executed immediately after starting an integer division:
2545+
# "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
2546+
# erratum #28
2547+
# "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
2548+
# #19
2549+
#
2550+
# - A double-word or a variable shift may give an incorrect result
2551+
# if executed while an integer multiplication is in progress:
2552+
# "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
2553+
# errata #16 & #28
2554+
#
2555+
# - An integer division may give an incorrect result if started in
2556+
# a delay slot of a taken branch or a jump:
2557+
# "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
2558+
# erratum #52
25272559
config CPU_R4000_WORKAROUNDS
25282560
bool
25292561
select CPU_R4400_WORKAROUNDS
25302562

2563+
# Work around certain R4400 CPU errata (as implemented by GCC):
2564+
#
2565+
# - A double-word or a variable shift may give an incorrect result
2566+
# if executed immediately after starting an integer division:
2567+
# "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
2568+
# "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
25312569
config CPU_R4400_WORKAROUNDS
25322570
bool
25332571

arch/mips/include/asm/futex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <asm/compiler.h>
1818
#include <asm/errno.h>
1919
#include <asm/sync.h>
20-
#include <asm/war.h>
2120

2221
#define arch_futex_atomic_op_inuser arch_futex_atomic_op_inuser
2322
#define futex_atomic_cmpxchg_inatomic futex_atomic_cmpxchg_inatomic

arch/mips/include/asm/mipsmtregs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#define _ASM_MIPSMTREGS_H
1010

1111
#include <asm/mipsregs.h>
12-
#include <asm/war.h>
1312

1413
#ifndef __ASSEMBLY__
1514

arch/mips/include/asm/mipsregs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/types.h>
1818
#include <asm/hazards.h>
1919
#include <asm/isa-rev.h>
20-
#include <asm/war.h>
2120

2221
/*
2322
* The following macros are especially useful for __asm__

arch/mips/include/asm/war.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

arch/mips/kernel/entry.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <asm/stackframe.h>
1818
#include <asm/isadep.h>
1919
#include <asm/thread_info.h>
20-
#include <asm/war.h>
2120

2221
#ifndef CONFIG_PREEMPTION
2322
#define resume_kernel restore_all

arch/mips/kernel/genex.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <asm/mipsregs.h>
2020
#include <asm/stackframe.h>
2121
#include <asm/sync.h>
22-
#include <asm/war.h>
2322
#include <asm/thread_info.h>
2423

2524
__INIT

arch/mips/kernel/r4k-bugs64.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ static __always_inline __init void check_mult_sh(void)
163163
}
164164

165165
pr_cont("no.\n");
166-
panic(bug64hit, !R4000_WAR ? r4kwar : nowar);
166+
panic(bug64hit,
167+
IS_ENABLED(CONFIG_CPU_R4000_WORKAROUNDS) ? nowar : r4kwar);
167168
}
168169

169170
static volatile int daddi_ov;
@@ -239,7 +240,8 @@ static __init void check_daddi(void)
239240
}
240241

241242
pr_cont("no.\n");
242-
panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
243+
panic(bug64hit,
244+
IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) ? nowar : daddiwar);
243245
}
244246

245247
int daddiu_bug = -1;
@@ -307,7 +309,8 @@ static __init void check_daddiu(void)
307309
}
308310

309311
pr_cont("no.\n");
310-
panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
312+
panic(bug64hit,
313+
IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) ? nowar : daddiwar);
311314
}
312315

313316
void __init check_bugs64_early(void)

arch/mips/kernel/scall32-o32.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <asm/sysmips.h>
2020
#include <asm/thread_info.h>
2121
#include <asm/unistd.h>
22-
#include <asm/war.h>
2322
#include <asm/asm-offsets.h>
2423

2524
.align 5

arch/mips/kernel/scall64-n64.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <asm/sysmips.h>
1919
#include <asm/thread_info.h>
2020
#include <asm/unistd.h>
21-
#include <asm/war.h>
2221

2322
#ifndef CONFIG_MIPS32_COMPAT
2423
/* Neither O32 nor N32, so define handle_sys here */

arch/mips/kernel/signal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <asm/sim.h>
3636
#include <asm/ucontext.h>
3737
#include <asm/cpu-features.h>
38-
#include <asm/war.h>
3938
#include <asm/dsp.h>
4039
#include <asm/inst.h>
4140
#include <asm/msa.h>

arch/mips/kernel/signal_n32.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <asm/ucontext.h>
2525
#include <asm/fpu.h>
2626
#include <asm/cpu-features.h>
27-
#include <asm/war.h>
2827

2928
#include "signal-common.h"
3029

arch/mips/lib/delay.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <asm/asm.h>
1818
#include <asm/compiler.h>
19-
#include <asm/war.h>
2019

2120
#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
2221
#define GCC_DADDI_IMM_ASM() "I"

arch/mips/mm/c-octeon.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <asm/r4kcache.h>
2424
#include <asm/traps.h>
2525
#include <asm/mmu_context.h>
26-
#include <asm/war.h>
2726

2827
#include <asm/octeon/octeon.h>
2928

arch/mips/mm/c-r4k.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <asm/r4kcache.h>
3434
#include <asm/sections.h>
3535
#include <asm/mmu_context.h>
36-
#include <asm/war.h>
3736
#include <asm/cacheflush.h> /* for run_uncached() */
3837
#include <asm/traps.h>
3938
#include <asm/mips-cps.h>

arch/mips/mm/page.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <asm/mipsregs.h>
2626
#include <asm/mmu_context.h>
2727
#include <asm/cpu.h>
28-
#include <asm/war.h>
2928

3029
#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
3130
#include <asm/sibyte/sb1250.h>
@@ -103,7 +102,9 @@ static int cache_line_size;
103102
static inline void
104103
pg_addiu(u32 **buf, unsigned int reg1, unsigned int reg2, unsigned int off)
105104
{
106-
if (cpu_has_64bit_gp_regs && DADDI_WAR && r4k_daddiu_bug()) {
105+
if (cpu_has_64bit_gp_regs &&
106+
IS_ENABLED(CONFIG_CPU_DADDI_WORKAROUNDS) &&
107+
r4k_daddiu_bug()) {
107108
if (off > 0x7fff) {
108109
uasm_i_lui(buf, T9, uasm_rel_hi(off));
109110
uasm_i_addiu(buf, T9, T9, uasm_rel_lo(off));

arch/mips/mm/tlbex.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <asm/cacheflush.h>
3434
#include <asm/cpu-type.h>
3535
#include <asm/mmu_context.h>
36-
#include <asm/war.h>
3736
#include <asm/uasm.h>
3837
#include <asm/setup.h>
3938
#include <asm/tlbex.h>

0 commit comments

Comments
 (0)