Skip to content

Commit 11129e8

Browse files
Christoph Hellwigpalmer-dabbelt
authored andcommitted
riscv: use memcpy based uaccess for nommu again
This reverts commit adccfb1. Now that the generic uaccess by mempcy code handles unaligned addresses the generic code can be used for all RISC-V CPUs. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parent 3c57fa1 commit 11129e8

3 files changed

Lines changed: 20 additions & 19 deletions

File tree

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ config RISCV
8888
select SYSCTL_EXCEPTION_TRACE
8989
select THREAD_INFO_IN_TASK
9090
select SET_FS
91+
select UACCESS_MEMCPY if !MMU
9192

9293
config ARCH_MMAP_RND_BITS_MIN
9394
default 18 if 64BIT

arch/riscv/include/asm/uaccess.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@
1313
/*
1414
* User space memory access functions
1515
*/
16-
17-
extern unsigned long __must_check __asm_copy_to_user(void __user *to,
18-
const void *from, unsigned long n);
19-
extern unsigned long __must_check __asm_copy_from_user(void *to,
20-
const void __user *from, unsigned long n);
21-
22-
static inline unsigned long
23-
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
24-
{
25-
return __asm_copy_from_user(to, from, n);
26-
}
27-
28-
static inline unsigned long
29-
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
30-
{
31-
return __asm_copy_to_user(to, from, n);
32-
}
33-
3416
#ifdef CONFIG_MMU
3517
#include <linux/errno.h>
3618
#include <linux/compiler.h>
@@ -385,6 +367,24 @@ do { \
385367
-EFAULT; \
386368
})
387369

370+
371+
unsigned long __must_check __asm_copy_to_user(void __user *to,
372+
const void *from, unsigned long n);
373+
unsigned long __must_check __asm_copy_from_user(void *to,
374+
const void __user *from, unsigned long n);
375+
376+
static inline unsigned long
377+
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
378+
{
379+
return __asm_copy_from_user(to, from, n);
380+
}
381+
382+
static inline unsigned long
383+
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
384+
{
385+
return __asm_copy_to_user(to, from, n);
386+
}
387+
388388
extern long strncpy_from_user(char *dest, const char __user *src, long count);
389389

390390
extern long __must_check strlen_user(const char __user *str);

arch/riscv/lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
lib-y += delay.o
33
lib-y += memcpy.o
44
lib-y += memset.o
5-
lib-y += uaccess.o
5+
lib-$(CONFIG_MMU) += uaccess.o
66
lib-$(CONFIG_64BIT) += tishift.o

0 commit comments

Comments
 (0)