aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2015-03-26 05:03:16 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-03-26 05:04:28 -0400
commitdf60f57684529a1dde4461cf84354453b440806a (patch)
tree618f030f673980a4c9d6bf27c1db50459a3b99d1 /arch/powerpc/lib
parent605f30205348f1d808d98d77505149da8b047b9f (diff)
parentb921e90260cec1e04988bb3763491de885b67b51 (diff)
Merge branch 'next-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc into test
Merge miscellaneous bits from benh. Fix a minor conflict with OpalMessageType changing names to opal_msg_type.
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/copy_32.S127
-rw-r--r--arch/powerpc/lib/locks.c1
-rw-r--r--arch/powerpc/lib/ppc_ksyms.c4
3 files changed, 1 insertions, 131 deletions
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 55f19f9fd708..6813f80d1eec 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -69,54 +69,6 @@ CACHELINE_BYTES = L1_CACHE_BYTES
69LG_CACHELINE_BYTES = L1_CACHE_SHIFT 69LG_CACHELINE_BYTES = L1_CACHE_SHIFT
70CACHELINE_MASK = (L1_CACHE_BYTES-1) 70CACHELINE_MASK = (L1_CACHE_BYTES-1)
71 71
72/*
73 * Use dcbz on the complete cache lines in the destination
74 * to set them to zero. This requires that the destination
75 * area is cacheable. -- paulus
76 */
77_GLOBAL(cacheable_memzero)
78 mr r5,r4
79 li r4,0
80 addi r6,r3,-4
81 cmplwi 0,r5,4
82 blt 7f
83 stwu r4,4(r6)
84 beqlr
85 andi. r0,r6,3
86 add r5,r0,r5
87 subf r6,r0,r6
88 clrlwi r7,r6,32-LG_CACHELINE_BYTES
89 add r8,r7,r5
90 srwi r9,r8,LG_CACHELINE_BYTES
91 addic. r9,r9,-1 /* total number of complete cachelines */
92 ble 2f
93 xori r0,r7,CACHELINE_MASK & ~3
94 srwi. r0,r0,2
95 beq 3f
96 mtctr r0
974: stwu r4,4(r6)
98 bdnz 4b
993: mtctr r9
100 li r7,4
10110: dcbz r7,r6
102 addi r6,r6,CACHELINE_BYTES
103 bdnz 10b
104 clrlwi r5,r8,32-LG_CACHELINE_BYTES
105 addi r5,r5,4
1062: srwi r0,r5,2
107 mtctr r0
108 bdz 6f
1091: stwu r4,4(r6)
110 bdnz 1b
1116: andi. r5,r5,3
1127: cmpwi 0,r5,0
113 beqlr
114 mtctr r5
115 addi r6,r6,3
1168: stbu r4,1(r6)
117 bdnz 8b
118 blr
119
120_GLOBAL(memset) 72_GLOBAL(memset)
121 rlwimi r4,r4,8,16,23 73 rlwimi r4,r4,8,16,23
122 rlwimi r4,r4,16,0,15 74 rlwimi r4,r4,16,0,15
@@ -142,85 +94,6 @@ _GLOBAL(memset)
142 bdnz 8b 94 bdnz 8b
143 blr 95 blr
144 96
145/*
146 * This version uses dcbz on the complete cache lines in the
147 * destination area to reduce memory traffic. This requires that
148 * the destination area is cacheable.
149 * We only use this version if the source and dest don't overlap.
150 * -- paulus.
151 */
152_GLOBAL(cacheable_memcpy)
153 add r7,r3,r5 /* test if the src & dst overlap */
154 add r8,r4,r5
155 cmplw 0,r4,r7
156 cmplw 1,r3,r8
157 crand 0,0,4 /* cr0.lt &= cr1.lt */
158 blt memcpy /* if regions overlap */
159
160 addi r4,r4,-4
161 addi r6,r3,-4
162 neg r0,r3
163 andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
164 beq 58f
165
166 cmplw 0,r5,r0 /* is this more than total to do? */
167 blt 63f /* if not much to do */
168 andi. r8,r0,3 /* get it word-aligned first */
169 subf r5,r0,r5
170 mtctr r8
171 beq+ 61f
17270: lbz r9,4(r4) /* do some bytes */
173 stb r9,4(r6)
174 addi r4,r4,1
175 addi r6,r6,1
176 bdnz 70b
17761: srwi. r0,r0,2
178 mtctr r0
179 beq 58f
18072: lwzu r9,4(r4) /* do some words */
181 stwu r9,4(r6)
182 bdnz 72b
183
18458: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
185 clrlwi r5,r5,32-LG_CACHELINE_BYTES
186 li r11,4
187 mtctr r0
188 beq 63f
18953:
190 dcbz r11,r6
191 COPY_16_BYTES
192#if L1_CACHE_BYTES >= 32
193 COPY_16_BYTES
194#if L1_CACHE_BYTES >= 64
195 COPY_16_BYTES
196 COPY_16_BYTES
197#if L1_CACHE_BYTES >= 128
198 COPY_16_BYTES
199 COPY_16_BYTES
200 COPY_16_BYTES
201 COPY_16_BYTES
202#endif
203#endif
204#endif
205 bdnz 53b
206
20763: srwi. r0,r5,2
208 mtctr r0
209 beq 64f
21030: lwzu r0,4(r4)
211 stwu r0,4(r6)
212 bdnz 30b
213
21464: andi. r0,r5,3
215 mtctr r0
216 beq+ 65f
21740: lbz r0,4(r4)
218 stb r0,4(r6)
219 addi r4,r4,1
220 addi r6,r6,1
221 bdnz 40b
22265: blr
223
224_GLOBAL(memmove) 97_GLOBAL(memmove)
225 cmplw 0,r3,r4 98 cmplw 0,r3,r4
226 bgt backwards_memcpy 99 bgt backwards_memcpy
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 170a0346f756..f7deebdf3365 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -41,6 +41,7 @@ void __spin_yield(arch_spinlock_t *lock)
41 plpar_hcall_norets(H_CONFER, 41 plpar_hcall_norets(H_CONFER,
42 get_hard_smp_processor_id(holder_cpu), yield_count); 42 get_hard_smp_processor_id(holder_cpu), yield_count);
43} 43}
44EXPORT_SYMBOL_GPL(__spin_yield);
44 45
45/* 46/*
46 * Waiting for a read lock or a write lock on a rwlock... 47 * Waiting for a read lock or a write lock on a rwlock...
diff --git a/arch/powerpc/lib/ppc_ksyms.c b/arch/powerpc/lib/ppc_ksyms.c
index f993959647b5..c7f8e9586316 100644
--- a/arch/powerpc/lib/ppc_ksyms.c
+++ b/arch/powerpc/lib/ppc_ksyms.c
@@ -8,10 +8,6 @@ EXPORT_SYMBOL(memset);
8EXPORT_SYMBOL(memmove); 8EXPORT_SYMBOL(memmove);
9EXPORT_SYMBOL(memcmp); 9EXPORT_SYMBOL(memcmp);
10EXPORT_SYMBOL(memchr); 10EXPORT_SYMBOL(memchr);
11#ifdef CONFIG_PPC32
12EXPORT_SYMBOL(cacheable_memcpy);
13EXPORT_SYMBOL(cacheable_memzero);
14#endif
15 11
16EXPORT_SYMBOL(strcpy); 12EXPORT_SYMBOL(strcpy);
17EXPORT_SYMBOL(strncpy); 13EXPORT_SYMBOL(strncpy);