1 --- a/arch/mips/lib/memset.S
2 +++ b/arch/mips/lib/memset.S
9 #define EX(insn,reg,addr,handler) \
11 .section __ex_table,"a"; \
12 @@ -75,6 +77,8 @@ FEXPORT(__bzero)
13 bnez t0, .Lsmall_memset
14 andi t0, a0, LONGMASK /* aligned? */
16 + prefetch_store a0, a2, t2, t3, t4
18 #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
20 PTR_SUBU t0, LONGSIZE /* alignment in bytes */
21 --- a/arch/mips/include/asm/processor.h
22 +++ b/arch/mips/include/asm/processor.h
23 @@ -354,7 +354,7 @@ unsigned long get_wchan(struct task_stru
24 #define prefetch(x) __builtin_prefetch((x), 0, 1)
26 #define ARCH_HAS_PREFETCHW
27 -#define prefetchw(x) __builtin_prefetch((x), 1, 1)
28 +#define prefetchw(x) do {} while (0)
33 +++ b/arch/mips/lib/prefetch.h
36 + * This file is subject to the terms and conditions of the GNU General Public
37 + * License. See the file "COPYING" in the main directory of this archive
40 + * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
43 +.macro prefetch_store dst, size, temp1, temp2, temp3
44 +#ifdef CONFIG_CPU_MIPS32
45 + li \temp1, ((1 << CONFIG_MIPS_L1_CACHE_SHIFT) - 1)
46 + nor \temp1, \temp1, \temp1
48 + and \temp2, \size, \temp1
53 + PTR_ADDIU \temp2, ((1 << CONFIG_MIPS_L1_CACHE_SHIFT) - 1)
54 + and \temp2, \temp2, \temp1
57 + PTR_ADDU \temp3, \size
58 + and \temp3, \temp3, \temp1
60 +1: beq \temp2, \temp3, 2f
66 + PTR_ADDIU \temp2, (1 << CONFIG_MIPS_L1_CACHE_SHIFT)
70 --- a/arch/mips/lib/memcpy.S
71 +++ b/arch/mips/lib/memcpy.S
76 +#include "prefetch.h"
79 * A combined memcpy/__copy_user
80 * __copy_user sets len to 0 for success; else to an upper bound of
81 @@ -199,6 +201,8 @@ FEXPORT(__copy_user)
85 + prefetch_store a0, a2, t0, t1, t2
89 * The "issue break"s below are very approximate.
90 --- a/arch/mips/lib/memcpy-inatomic.S
91 +++ b/arch/mips/lib/memcpy-inatomic.S
96 +#include "prefetch.h"
99 * A combined memcpy/__copy_user
100 * __copy_user sets len to 0 for success; else to an upper bound of
101 @@ -196,6 +198,8 @@ LEAF(__copy_user_inatomic)
105 + prefetch_store dst, len, t0, t1, t2
108 * The "issue break"s below are very approximate.
109 * Issue delays for dcache fills will perturb the schedule, as will