aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@sifive.com>2018-06-11 12:09:49 -0400
committerPalmer Dabbelt <palmer@sifive.com>2018-06-11 12:09:49 -0400
commite0e0c87c022b654bcc79224ce73633f0d274e091 (patch)
tree5ce8e15d02608f83147daae33d5ee41b164c081c
parent41611ed2c82460bce830b7f1f132a9cfff002d86 (diff)
parent86406d51d3600bfa2b6f86e1e6bfce712bec0d53 (diff)
RISC-V: Make our port sparse-clean
This patch set contains a handful of fixes that clean up the sparse results for the RISC-V port. These patches shouldn't have any functional difference. The patches: * Use NULL instead of 0. * Clean up __user annotations. * Split __copy_user into two functions, to make the __user annotations valid. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
-rw-r--r--arch/riscv/include/asm/cacheflush.h2
-rw-r--r--arch/riscv/include/asm/tlbflush.h2
-rw-r--r--arch/riscv/include/asm/uaccess.h8
-rw-r--r--arch/riscv/kernel/riscv_ksyms.c3
-rw-r--r--arch/riscv/kernel/traps.c2
-rw-r--r--arch/riscv/lib/uaccess.S6
6 files changed, 14 insertions, 9 deletions
diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h
index efd89a88d2d0..8f13074413a7 100644
--- a/arch/riscv/include/asm/cacheflush.h
+++ b/arch/riscv/include/asm/cacheflush.h
@@ -47,7 +47,7 @@ static inline void flush_dcache_page(struct page *page)
47 47
48#else /* CONFIG_SMP */ 48#else /* CONFIG_SMP */
49 49
50#define flush_icache_all() sbi_remote_fence_i(0) 50#define flush_icache_all() sbi_remote_fence_i(NULL)
51void flush_icache_mm(struct mm_struct *mm, bool local); 51void flush_icache_mm(struct mm_struct *mm, bool local);
52 52
53#endif /* CONFIG_SMP */ 53#endif /* CONFIG_SMP */
diff --git a/arch/riscv/include/asm/tlbflush.h b/arch/riscv/include/asm/tlbflush.h
index 7b209aec355d..85c2d8bae957 100644
--- a/arch/riscv/include/asm/tlbflush.h
+++ b/arch/riscv/include/asm/tlbflush.h
@@ -49,7 +49,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
49 49
50#include <asm/sbi.h> 50#include <asm/sbi.h>
51 51
52#define flush_tlb_all() sbi_remote_sfence_vma(0, 0, -1) 52#define flush_tlb_all() sbi_remote_sfence_vma(NULL, 0, -1)
53#define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0) 53#define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0)
54#define flush_tlb_range(vma, start, end) \ 54#define flush_tlb_range(vma, start, end) \
55 sbi_remote_sfence_vma(mm_cpumask((vma)->vm_mm)->bits, \ 55 sbi_remote_sfence_vma(mm_cpumask((vma)->vm_mm)->bits, \
diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index 14b0b22fb578..473cfc84e412 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -392,19 +392,21 @@ do { \
392}) 392})
393 393
394 394
395extern unsigned long __must_check __copy_user(void __user *to, 395extern unsigned long __must_check __asm_copy_to_user(void __user *to,
396 const void *from, unsigned long n);
397extern unsigned long __must_check __asm_copy_from_user(void *to,
396 const void __user *from, unsigned long n); 398 const void __user *from, unsigned long n);
397 399
398static inline unsigned long 400static inline unsigned long
399raw_copy_from_user(void *to, const void __user *from, unsigned long n) 401raw_copy_from_user(void *to, const void __user *from, unsigned long n)
400{ 402{
401 return __copy_user(to, from, n); 403 return __asm_copy_to_user(to, from, n);
402} 404}
403 405
404static inline unsigned long 406static inline unsigned long
405raw_copy_to_user(void __user *to, const void *from, unsigned long n) 407raw_copy_to_user(void __user *to, const void *from, unsigned long n)
406{ 408{
407 return __copy_user(to, from, n); 409 return __asm_copy_from_user(to, from, n);
408} 410}
409 411
410extern long strncpy_from_user(char *dest, const char __user *src, long count); 412extern long strncpy_from_user(char *dest, const char __user *src, long count);
diff --git a/arch/riscv/kernel/riscv_ksyms.c b/arch/riscv/kernel/riscv_ksyms.c
index 551734248748..f247d6d2137c 100644
--- a/arch/riscv/kernel/riscv_ksyms.c
+++ b/arch/riscv/kernel/riscv_ksyms.c
@@ -13,6 +13,7 @@
13 * Assembly functions that may be used (directly or indirectly) by modules 13 * Assembly functions that may be used (directly or indirectly) by modules
14 */ 14 */
15EXPORT_SYMBOL(__clear_user); 15EXPORT_SYMBOL(__clear_user);
16EXPORT_SYMBOL(__copy_user); 16EXPORT_SYMBOL(__asm_copy_to_user);
17EXPORT_SYMBOL(__asm_copy_from_user);
17EXPORT_SYMBOL(memset); 18EXPORT_SYMBOL(memset);
18EXPORT_SYMBOL(memcpy); 19EXPORT_SYMBOL(memcpy);
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index 93132cb59184..4c92e5af86d3 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -160,7 +160,7 @@ int is_valid_bugaddr(unsigned long pc)
160 160
161 if (pc < PAGE_OFFSET) 161 if (pc < PAGE_OFFSET)
162 return 0; 162 return 0;
163 if (probe_kernel_address((bug_insn_t __user *)pc, insn)) 163 if (probe_kernel_address((bug_insn_t *)pc, insn))
164 return 0; 164 return 0;
165 return (insn == __BUG_INSN); 165 return (insn == __BUG_INSN);
166} 166}
diff --git a/arch/riscv/lib/uaccess.S b/arch/riscv/lib/uaccess.S
index 0173ea296baa..399e6f0c2d98 100644
--- a/arch/riscv/lib/uaccess.S
+++ b/arch/riscv/lib/uaccess.S
@@ -13,7 +13,8 @@ _epc:
13 .previous 13 .previous
14 .endm 14 .endm
15 15
16ENTRY(__copy_user) 16ENTRY(__asm_copy_to_user)
17ENTRY(__asm_copy_from_user)
17 18
18 /* Enable access to user memory */ 19 /* Enable access to user memory */
19 li t6, SR_SUM 20 li t6, SR_SUM
@@ -63,7 +64,8 @@ ENTRY(__copy_user)
63 addi a0, a0, 1 64 addi a0, a0, 1
64 bltu a1, a3, 5b 65 bltu a1, a3, 5b
65 j 3b 66 j 3b
66ENDPROC(__copy_user) 67ENDPROC(__asm_copy_to_user)
68ENDPROC(__asm_copy_from_user)
67 69
68 70
69ENTRY(__clear_user) 71ENTRY(__clear_user)