summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-09-08 19:14:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 21:26:48 -0400
commit92ce4c3ea7c44e61ca2b6ef3e5682bfcea851d87 (patch)
treeee1ce57cf073012afb7915edcf2b7c4d6f2f5859
parentfd1d362600e2d2edb6262d8e05661424c1a315bf (diff)
alpha: add support for memset16
Alpha already had an optimised fill-memory-with-16-bit-quantity assembler routine called memsetw(). It has a slightly different calling convention from memset16() in that it takes a byte count, not a count of words. That's the same convention used by ARM's __memset routines, so rename Alpha's routine to match and add a memset16() wrapper around it. Then convert Alpha's scr_memsetw() to call memset16() instead of memsetw(). Link: http://lkml.kernel.org/r/20170720184539.31609-6-willy@infradead.org Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: David Miller <davem@davemloft.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Minchan Kim <minchan@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Russell King <rmk+kernel@armlinux.org.uk> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/alpha/include/asm/string.h15
-rw-r--r--arch/alpha/include/asm/vga.h2
-rw-r--r--arch/alpha/lib/memset.S10
3 files changed, 14 insertions, 13 deletions
diff --git a/arch/alpha/include/asm/string.h b/arch/alpha/include/asm/string.h
index c2911f591704..9eb9933d845f 100644
--- a/arch/alpha/include/asm/string.h
+++ b/arch/alpha/include/asm/string.h
@@ -65,13 +65,14 @@ extern void * memchr(const void *, int, size_t);
65 aligned values. The DEST and COUNT parameters must be even for 65 aligned values. The DEST and COUNT parameters must be even for
66 correct operation. */ 66 correct operation. */
67 67
68#define __HAVE_ARCH_MEMSETW 68#define __HAVE_ARCH_MEMSET16
69extern void * __memsetw(void *dest, unsigned short, size_t count); 69extern void * __memset16(void *dest, unsigned short, size_t count);
70 70static inline void *memset16(uint16_t *p, uint16_t v, size_t n)
71#define memsetw(s, c, n) \ 71{
72(__builtin_constant_p(c) \ 72 if (__builtin_constant_p(v))
73 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ 73 return __constant_c_memset(p, 0x0001000100010001UL * v, n * 2);
74 : __memsetw((s),(c),(n))) 74 return __memset16(p, v, n * 2);
75}
75 76
76#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
77 78
diff --git a/arch/alpha/include/asm/vga.h b/arch/alpha/include/asm/vga.h
index c00106bac521..3c1c2b6128e7 100644
--- a/arch/alpha/include/asm/vga.h
+++ b/arch/alpha/include/asm/vga.h
@@ -34,7 +34,7 @@ static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
34 if (__is_ioaddr(s)) 34 if (__is_ioaddr(s))
35 memsetw_io((u16 __iomem *) s, c, count); 35 memsetw_io((u16 __iomem *) s, c, count);
36 else 36 else
37 memsetw(s, c, count); 37 memset16(s, c, count / 2);
38} 38}
39 39
40/* Do not trust that the usage will be correct; analyze the arguments. */ 40/* Do not trust that the usage will be correct; analyze the arguments. */
diff --git a/arch/alpha/lib/memset.S b/arch/alpha/lib/memset.S
index 89a26f5e89de..f824969e9e77 100644
--- a/arch/alpha/lib/memset.S
+++ b/arch/alpha/lib/memset.S
@@ -20,7 +20,7 @@
20 .globl memset 20 .globl memset
21 .globl __memset 21 .globl __memset
22 .globl ___memset 22 .globl ___memset
23 .globl __memsetw 23 .globl __memset16
24 .globl __constant_c_memset 24 .globl __constant_c_memset
25 25
26 .ent ___memset 26 .ent ___memset
@@ -110,8 +110,8 @@ EXPORT_SYMBOL(___memset)
110EXPORT_SYMBOL(__constant_c_memset) 110EXPORT_SYMBOL(__constant_c_memset)
111 111
112 .align 5 112 .align 5
113 .ent __memsetw 113 .ent __memset16
114__memsetw: 114__memset16:
115 .prologue 0 115 .prologue 0
116 116
117 inswl $17,0,$1 /* E0 */ 117 inswl $17,0,$1 /* E0 */
@@ -123,8 +123,8 @@ __memsetw:
123 or $1,$4,$17 /* E0 */ 123 or $1,$4,$17 /* E0 */
124 br __constant_c_memset /* .. E1 */ 124 br __constant_c_memset /* .. E1 */
125 125
126 .end __memsetw 126 .end __memset16
127EXPORT_SYMBOL(__memsetw) 127EXPORT_SYMBOL(__memset16)
128 128
129memset = ___memset 129memset = ___memset
130__memset = ___memset 130__memset = ___memset