Commit ac85227f7637cfb0d811519b8253c454d0d0a159

Authored by Markos Chandras
Committed by Ralf Baechle
1 parent c1771216ab

MIPS: checksum: Split the 'copy_user' symbol

The 'copy_user' symbol can be used to copy from or to
userland so we will use two different symbols for these
operations. This makes no difference in the existing code,
but when the core is operating in EVA mode, different instructions
need to be used to read and write to userland address space.
The old function has also been renamed to 'copy_kernel' to denote
that it is suitable for copy data to and from kernel space.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Showing 3 changed files with 21 additions and 10 deletions Side-by-side Diff

arch/mips/include/asm/checksum.h
... ... @@ -7,6 +7,7 @@
7 7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 8 * Copyright (C) 2001 Thiemo Seufer.
9 9 * Copyright (C) 2002 Maciej W. Rozycki
  10 + * Copyright (C) 2014 Imagination Technologies Ltd.
10 11 */
11 12 #ifndef _ASM_CHECKSUM_H
12 13 #define _ASM_CHECKSUM_H
13 14  
... ... @@ -29,9 +30,14 @@
29 30 */
30 31 __wsum csum_partial(const void *buff, int len, __wsum sum);
31 32  
32   -__wsum __csum_partial_copy_user(const void *src, void *dst,
33   - int len, __wsum sum, int *err_ptr);
  33 +__wsum __csum_partial_copy_kernel(const void *src, void *dst,
  34 + int len, __wsum sum, int *err_ptr);
34 35  
  36 +__wsum __csum_partial_copy_from_user(const void *src, void *dst,
  37 + int len, __wsum sum, int *err_ptr);
  38 +__wsum __csum_partial_copy_to_user(const void *src, void *dst,
  39 + int len, __wsum sum, int *err_ptr);
  40 +
35 41 /*
36 42 * this is a new version of the above that records errors it finds in *errp,
37 43 * but continues and zeros the rest of the buffer.
... ... @@ -41,8 +47,8 @@
41 47 __wsum sum, int *err_ptr)
42 48 {
43 49 might_fault();
44   - return __csum_partial_copy_user((__force void *)src, dst,
45   - len, sum, err_ptr);
  50 + return __csum_partial_copy_from_user((__force void *)src, dst,
  51 + len, sum, err_ptr);
46 52 }
47 53  
48 54 /*
... ... @@ -55,8 +61,8 @@
55 61 {
56 62 might_fault();
57 63 if (access_ok(VERIFY_WRITE, dst, len))
58   - return __csum_partial_copy_user(src, (__force void *)dst,
59   - len, sum, err_ptr);
  64 + return __csum_partial_copy_to_user(src, (__force void *)dst,
  65 + len, sum, err_ptr);
60 66 if (len)
61 67 *err_ptr = -EFAULT;
62 68  
arch/mips/kernel/mips_ksyms.c
... ... @@ -73,7 +73,9 @@
73 73  
74 74 EXPORT_SYMBOL(csum_partial);
75 75 EXPORT_SYMBOL(csum_partial_copy_nocheck);
76   -EXPORT_SYMBOL(__csum_partial_copy_user);
  76 +EXPORT_SYMBOL(__csum_partial_copy_kernel);
  77 +EXPORT_SYMBOL(__csum_partial_copy_to_user);
  78 +EXPORT_SYMBOL(__csum_partial_copy_from_user);
77 79  
78 80 EXPORT_SYMBOL(invalid_pte_table);
79 81 #ifdef CONFIG_FUNCTION_TRACER
arch/mips/lib/csum_partial.S
... ... @@ -8,6 +8,7 @@
8 8 * Copyright (C) 1998, 1999 Ralf Baechle
9 9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 10 * Copyright (C) 2007 Maciej W. Rozycki
  11 + * Copyright (C) 2014 Imagination Technologies Ltd.
11 12 */
12 13 #include <linux/errno.h>
13 14 #include <asm/asm.h>
... ... @@ -296,7 +297,7 @@
296 297 * checksum and copy routines based on memcpy.S
297 298 *
298 299 * csum_partial_copy_nocheck(src, dst, len, sum)
299   - * __csum_partial_copy_user(src, dst, len, sum, errp)
  300 + * __csum_partial_copy_kernel(src, dst, len, sum, errp)
300 301 *
301 302 * See "Spec" in memcpy.S for details. Unlike __copy_user, all
302 303 * function in this file use the standard calling convention.
... ... @@ -396,7 +397,9 @@
396 397 .set at=v1
397 398 #endif
398 399  
399   -LEAF(__csum_partial_copy_user)
  400 +LEAF(__csum_partial_copy_kernel)
  401 +FEXPORT(__csum_partial_copy_to_user)
  402 +FEXPORT(__csum_partial_copy_from_user)
400 403 PTR_ADDU AT, src, len /* See (1) above. */
401 404 #ifdef CONFIG_64BIT
402 405 move errptr, a4
... ... @@ -757,5 +760,5 @@
757 760 jr ra
758 761 sw v1, (errptr)
759 762 .set pop
760   - END(__csum_partial_copy_user)
  763 + END(__csum_partial_copy_kernel)