diff options
author | Palmer Dabbelt <palmer@sifive.com> | 2018-06-11 12:09:49 -0400 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-06-11 12:09:49 -0400 |
commit | e0e0c87c022b654bcc79224ce73633f0d274e091 (patch) | |
tree | 5ce8e15d02608f83147daae33d5ee41b164c081c | |
parent | 41611ed2c82460bce830b7f1f132a9cfff002d86 (diff) | |
parent | 86406d51d3600bfa2b6f86e1e6bfce712bec0d53 (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.h | 2 | ||||
-rw-r--r-- | arch/riscv/include/asm/tlbflush.h | 2 | ||||
-rw-r--r-- | arch/riscv/include/asm/uaccess.h | 8 | ||||
-rw-r--r-- | arch/riscv/kernel/riscv_ksyms.c | 3 | ||||
-rw-r--r-- | arch/riscv/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/riscv/lib/uaccess.S | 6 |
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) |
51 | void flush_icache_mm(struct mm_struct *mm, bool local); | 51 | void 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 | ||
395 | extern unsigned long __must_check __copy_user(void __user *to, | 395 | extern unsigned long __must_check __asm_copy_to_user(void __user *to, |
396 | const void *from, unsigned long n); | ||
397 | extern 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 | ||
398 | static inline unsigned long | 400 | static inline unsigned long |
399 | raw_copy_from_user(void *to, const void __user *from, unsigned long n) | 401 | raw_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 | ||
404 | static inline unsigned long | 406 | static inline unsigned long |
405 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) | 407 | raw_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 | ||
410 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | 412 | extern 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 | */ |
15 | EXPORT_SYMBOL(__clear_user); | 15 | EXPORT_SYMBOL(__clear_user); |
16 | EXPORT_SYMBOL(__copy_user); | 16 | EXPORT_SYMBOL(__asm_copy_to_user); |
17 | EXPORT_SYMBOL(__asm_copy_from_user); | ||
17 | EXPORT_SYMBOL(memset); | 18 | EXPORT_SYMBOL(memset); |
18 | EXPORT_SYMBOL(memcpy); | 19 | EXPORT_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 | ||
16 | ENTRY(__copy_user) | 16 | ENTRY(__asm_copy_to_user) |
17 | ENTRY(__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 |
66 | ENDPROC(__copy_user) | 67 | ENDPROC(__asm_copy_to_user) |
68 | ENDPROC(__asm_copy_from_user) | ||
67 | 69 | ||
68 | 70 | ||
69 | ENTRY(__clear_user) | 71 | ENTRY(__clear_user) |