]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
alpha: add support for memset16
authorMatthew Wilcox <mawilcox@microsoft.com>
Fri, 8 Sep 2017 23:14:04 +0000 (16:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 Sep 2017 01:26:48 +0000 (18:26 -0700)
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>
arch/alpha/include/asm/string.h
arch/alpha/include/asm/vga.h
arch/alpha/lib/memset.S

index c2911f5917041abd49dea5f14855ac9691d1aec0..9eb9933d845fb8dc82f321e1a049641a4cd4c125 100644 (file)
@@ -65,13 +65,14 @@ extern void * memchr(const void *, int, size_t);
    aligned values.  The DEST and COUNT parameters must be even for 
    correct operation.  */
 
-#define __HAVE_ARCH_MEMSETW
-extern void * __memsetw(void *dest, unsigned short, size_t count);
-
-#define memsetw(s, c, n)                                                \
-(__builtin_constant_p(c)                                                \
- ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
- : __memsetw((s),(c),(n)))
+#define __HAVE_ARCH_MEMSET16
+extern void * __memset16(void *dest, unsigned short, size_t count);
+static inline void *memset16(uint16_t *p, uint16_t v, size_t n)
+{
+       if (__builtin_constant_p(v))
+               return __constant_c_memset(p, 0x0001000100010001UL * v, n * 2);
+       return __memset16(p, v, n * 2);
+}
 
 #endif /* __KERNEL__ */
 
index c00106bac52146745a5b128e7e05b1e1480e8400..3c1c2b6128e77f41a714649bb4dbee92205f0c38 100644 (file)
@@ -34,7 +34,7 @@ static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
        if (__is_ioaddr(s))
                memsetw_io((u16 __iomem *) s, c, count);
        else
-               memsetw(s, c, count);
+               memset16(s, c, count / 2);
 }
 
 /* Do not trust that the usage will be correct; analyze the arguments.  */
index 89a26f5e89de3db904cbfabb1ff735464d6ca3cb..f824969e9e77a61eb2750cf82c41c8da3d0e2557 100644 (file)
@@ -20,7 +20,7 @@
        .globl memset
        .globl __memset
        .globl ___memset
-       .globl __memsetw
+       .globl __memset16
        .globl __constant_c_memset
 
        .ent ___memset
@@ -110,8 +110,8 @@ EXPORT_SYMBOL(___memset)
 EXPORT_SYMBOL(__constant_c_memset)
 
        .align 5
-       .ent __memsetw
-__memsetw:
+       .ent __memset16
+__memset16:
        .prologue 0
 
        inswl $17,0,$1          /* E0 */
@@ -123,8 +123,8 @@ __memsetw:
        or $1,$4,$17            /* E0 */
        br __constant_c_memset  /* .. E1 */
 
-       .end __memsetw
-EXPORT_SYMBOL(__memsetw)
+       .end __memset16
+EXPORT_SYMBOL(__memset16)
 
 memset = ___memset
 __memset = ___memset