All of lore.kernel.org
 help / color / mirror / Atom feed
* kill <asm/segment.h> and improve nommu generic uaccess helpers
@ 2019-04-23 16:38 Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 1/4] asm-generic: don't include <asm/segment.h> from <asm/uaccess.h> Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 16:38 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch

Hi Arnd,

this is a series doing two somewhat interwinded things.  It improves
the asm-generic nommu uaccess helper to optionally be entirely generic
and not require any arch helpers for the actual uaccess.  For the
generic uaccess.h to actually be generically useful I also had to kill
off the mess we made of <asm/segment.h>, which really shouldn't exist
on most architectures.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] asm-generic: don't include <asm/segment.h> from <asm/uaccess.h>
  2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
@ 2019-04-23 16:38 ` Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 2/4] arch: mostly remove <asm/segment.h> Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 16:38 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch

<asm/segment.h> is an odd x86 legacy that we shouldn't force on other
architectures.  arc used it to bring in mm_context_t, but we can do
that inside the arc code easily.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/include/asm/uaccess.h | 1 +
 include/asm-generic/uaccess.h  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index eabc3efa6c6d..526418543379 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -742,6 +742,7 @@ extern long arc_strnlen_user_noinline(const char __user *src, long n);
 
 #endif
 
+#include <asm/segment.h>
 #include <asm-generic/uaccess.h>
 
 #endif
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index b3d2241e03f8..aac336831204 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -9,8 +9,6 @@
  */
 #include <linux/string.h>
 
-#include <asm/segment.h>
-
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
 #ifndef KERNEL_DS
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] arch: mostly remove <asm/segment.h>
  2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 1/4] asm-generic: don't include <asm/segment.h> from <asm/uaccess.h> Christoph Hellwig
@ 2019-04-23 16:38 ` Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 3/4] asm-generic: provide entirely generic nommu uaccess Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 16:38 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch

A few architectures use <asm/segment.h> internally, but nothing in
common code does. Remove all the empty or almost empty versions of it,
including the asm-generic one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/segment.h   |  6 ------
 arch/alpha/kernel/smc37c669.c      |  1 -
 arch/alpha/kernel/smc37c93x.c      |  1 -
 arch/arm/include/asm/Kbuild        |  1 -
 arch/arm64/include/asm/Kbuild      |  1 -
 arch/c6x/include/asm/Kbuild        |  1 -
 arch/hexagon/include/asm/Kbuild    |  1 -
 arch/hexagon/include/asm/uaccess.h |  1 -
 arch/ia64/include/asm/segment.h    |  6 ------
 arch/mips/include/asm/Kbuild       |  1 -
 arch/nds32/include/asm/Kbuild      |  1 -
 arch/nios2/include/asm/Kbuild      |  1 -
 arch/openrisc/include/asm/Kbuild   |  1 -
 arch/openrisc/kernel/ptrace.c      |  1 -
 arch/openrisc/kernel/setup.c       |  1 -
 arch/openrisc/kernel/traps.c       |  1 -
 arch/openrisc/mm/init.c            |  1 -
 arch/openrisc/mm/tlb.c             |  1 -
 arch/parisc/include/asm/Kbuild     |  1 -
 arch/s390/include/asm/segment.h    |  5 -----
 arch/s390/kernel/ptrace.c          |  1 -
 arch/unicore32/include/asm/Kbuild  |  1 -
 arch/xtensa/include/asm/segment.h  | 16 ----------------
 include/asm-generic/segment.h      |  9 ---------
 24 files changed, 61 deletions(-)
 delete mode 100644 arch/alpha/include/asm/segment.h
 delete mode 100644 arch/ia64/include/asm/segment.h
 delete mode 100644 arch/s390/include/asm/segment.h
 delete mode 100644 arch/xtensa/include/asm/segment.h
 delete mode 100644 include/asm-generic/segment.h

diff --git a/arch/alpha/include/asm/segment.h b/arch/alpha/include/asm/segment.h
deleted file mode 100644
index 0453d97daae7..000000000000
--- a/arch/alpha/include/asm/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ALPHA_SEGMENT_H
-#define __ALPHA_SEGMENT_H
-
-/* Only here because we have some old header files that expect it.. */
-
-#endif
diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c
index 4dbd4e415041..bbbd34586de0 100644
--- a/arch/alpha/kernel/smc37c669.c
+++ b/arch/alpha/kernel/smc37c669.c
@@ -10,7 +10,6 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
-#include <asm/segment.h>
 
 #if 0
 # define DBG_DEVS(args)         printk args
diff --git a/arch/alpha/kernel/smc37c93x.c b/arch/alpha/kernel/smc37c93x.c
index 733f08966fd2..71cd7aca38ce 100644
--- a/arch/alpha/kernel/smc37c93x.c
+++ b/arch/alpha/kernel/smc37c93x.c
@@ -11,7 +11,6 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
-#include <asm/segment.h>
 
 #define SMC_DEBUG 0
 
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index a8a4eb7f6dae..1465d4609929 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -14,7 +14,6 @@ generic-y += parport.h
 generic-y += preempt.h
 generic-y += rwsem.h
 generic-y += seccomp.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += simd.h
 generic-y += sizes.h
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 1e17ea5c372b..fd9574e8f31c 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -17,7 +17,6 @@ generic-y += msi.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += rwsem.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += set_memory.h
 generic-y += sizes.h
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 249c9f6f26dc..d7147755c00c 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -29,7 +29,6 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += pgalloc.h
 generic-y += preempt.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
 generic-y += tlbflush.h
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index d046e8ccdf78..ab7c7f44416e 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -29,7 +29,6 @@ generic-y += percpu.h
 generic-y += preempt.h
 generic-y += rwsem.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
 generic-y += sizes.h
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index a30e58d5f351..7a34092e8b58 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -24,7 +24,6 @@
  * User space memory access functions
  */
 #include <linux/mm.h>
-#include <asm/segment.h>
 #include <asm/sections.h>
 
 /*
diff --git a/arch/ia64/include/asm/segment.h b/arch/ia64/include/asm/segment.h
deleted file mode 100644
index b89e2b3d648f..000000000000
--- a/arch/ia64/include/asm/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_IA64_SEGMENT_H
-#define _ASM_IA64_SEGMENT_H
-
-/* Only here because we have some old header files that expect it.. */
-
-#endif /* _ASM_IA64_SEGMENT_H */
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 87b86cdf126a..a03cd4e24f37 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -19,7 +19,6 @@ generic-y += preempt.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += trace_clock.h
 generic-y += unaligned.h
 generic-y += user.h
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 64ceff7ab99b..668d3094921f 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -36,7 +36,6 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += sizes.h
 generic-y += switch_to.h
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index 88a667d12aaa..60c9a8af9f5b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -32,7 +32,6 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += spinlock.h
 generic-y += topology.h
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 22aa97136c01..c7ab30666625 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -33,7 +33,6 @@ generic-y += qspinlock.h
 generic-y += qrwlock_types.h
 generic-y += qrwlock.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += shmparam.h
 generic-y += switch_to.h
 generic-y += topology.h
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index eb97a8e7c8aa..e8fb2a764f46 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -30,7 +30,6 @@
 #include <linux/elf.h>
 
 #include <asm/thread_info.h>
-#include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index c605bdad1746..17c00d06d91b 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -39,7 +39,6 @@
 #include <linux/device.h>
 
 #include <asm/sections.h>
-#include <asm/segment.h>
 #include <asm/pgtable.h>
 #include <asm/types.h>
 #include <asm/setup.h>
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c
index d8981cbb852a..6ed7293ef007 100644
--- a/arch/openrisc/kernel/traps.c
+++ b/arch/openrisc/kernel/traps.c
@@ -35,7 +35,6 @@
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 
-#include <asm/segment.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/unwinder.h>
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index caeb4184e8a6..e8a640c7e74c 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -32,7 +32,6 @@
 #include <linux/blkdev.h>	/* for initrd_* */
 #include <linux/pagemap.h>
 
-#include <asm/segment.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/dma.h>
diff --git a/arch/openrisc/mm/tlb.c b/arch/openrisc/mm/tlb.c
index 6c253a2e86bc..7f9f50161dfe 100644
--- a/arch/openrisc/mm/tlb.c
+++ b/arch/openrisc/mm/tlb.c
@@ -26,7 +26,6 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 
-#include <asm/segment.h>
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 9bcd0c903dbb..8bb057e2dde7 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -19,7 +19,6 @@ generic-y += mm-arch-hooks.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += seccomp.h
-generic-y += segment.h
 generic-y += trace_clock.h
 generic-y += user.h
 generic-y += vga.h
diff --git a/arch/s390/include/asm/segment.h b/arch/s390/include/asm/segment.h
deleted file mode 100644
index 97a0582b8d0f..000000000000
--- a/arch/s390/include/asm/segment.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_SEGMENT_H
-#define _ASM_SEGMENT_H
-
-#endif
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index cd3df5514552..ad71132374f0 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -24,7 +24,6 @@
 #include <linux/seccomp.h>
 #include <linux/compat.h>
 #include <trace/syscall.h>
-#include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index d77d953c04c1..372db2eef26d 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -27,7 +27,6 @@ generic-y += parport.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
 generic-y += sizes.h
diff --git a/arch/xtensa/include/asm/segment.h b/arch/xtensa/include/asm/segment.h
deleted file mode 100644
index 98964ad15ca2..000000000000
--- a/arch/xtensa/include/asm/segment.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * include/asm-xtensa/segment.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_SEGMENT_H
-#define _XTENSA_SEGMENT_H
-
-#include <linux/uaccess.h>
-
-#endif	/* _XTENSA_SEGEMENT_H */
diff --git a/include/asm-generic/segment.h b/include/asm-generic/segment.h
deleted file mode 100644
index 5580eace622c..000000000000
--- a/include/asm-generic/segment.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ASM_GENERIC_SEGMENT_H
-#define __ASM_GENERIC_SEGMENT_H
-/*
- * Only here because we have some old header files that expect it...
- *
- * New architectures probably don't want to have their own version.
- */
-
-#endif /* __ASM_GENERIC_SEGMENT_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] asm-generic: provide entirely generic nommu uaccess
  2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 1/4] asm-generic: don't include <asm/segment.h> from <asm/uaccess.h> Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 2/4] arch: mostly remove <asm/segment.h> Christoph Hellwig
@ 2019-04-23 16:38 ` Christoph Hellwig
  2019-04-23 16:38 ` [PATCH 4/4] asm-generic: optimize generic uaccess for 8-byte loads and stores Christoph Hellwig
  2019-04-23 18:27 ` kill <asm/segment.h> and improve nommu generic uaccess helpers Arnd Bergmann
  4 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 16:38 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch

Move the code to implement uaccess using memcpy or direct loads and
stores to asm-generic/uaccess.h and make it selectable kconfig option.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/h8300/Kconfig               |  1 +
 arch/h8300/include/asm/Kbuild    |  1 +
 arch/h8300/include/asm/uaccess.h | 55 --------------------------------
 include/asm-generic/uaccess.h    | 48 ++++++++++++++++++++++++++++
 lib/Kconfig                      |  4 +++
 5 files changed, 54 insertions(+), 55 deletions(-)
 delete mode 100644 arch/h8300/include/asm/uaccess.h

diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index c071da34e081..c24d36241503 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -23,6 +23,7 @@ config H8300
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_HASH
 	select CPU_NO_EFFICIENT_FFS
+	select UACCESS_MEMCPY
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index e3dead402e5f..91533fc44b69 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -47,6 +47,7 @@ generic-y += timex.h
 generic-y += tlbflush.h
 generic-y += topology.h
 generic-y += trace_clock.h
+generic-y += uaccess.h
 generic-y += unaligned.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h
deleted file mode 100644
index bc8031949d07..000000000000
--- a/arch/h8300/include/asm/uaccess.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_UACCESS_H
-#define _ASM_UACCESS_H
-
-#include <linux/string.h>
-
-static inline __must_check unsigned long
-raw_copy_from_user(void *to, const void __user * from, unsigned long n)
-{
-	if (__builtin_constant_p(n)) {
-		switch(n) {
-		case 1:
-			*(u8 *)to = *(u8 __force *)from;
-			return 0;
-		case 2:
-			*(u16 *)to = *(u16 __force *)from;
-			return 0;
-		case 4:
-			*(u32 *)to = *(u32 __force *)from;
-			return 0;
-		}
-	}
-
-	memcpy(to, (const void __force *)from, n);
-	return 0;
-}
-
-static inline __must_check unsigned long
-raw_copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-	if (__builtin_constant_p(n)) {
-		switch(n) {
-		case 1:
-			*(u8 __force *)to = *(u8 *)from;
-			return 0;
-		case 2:
-			*(u16 __force *)to = *(u16 *)from;
-			return 0;
-		case 4:
-			*(u32 __force *)to = *(u32 *)from;
-			return 0;
-		default:
-			break;
-		}
-	}
-
-	memcpy((void __force *)to, from, n);
-	return 0;
-}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
-#include <asm-generic/uaccess.h>
-
-#endif
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index aac336831204..3dcabfceb21e 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -9,6 +9,54 @@
  */
 #include <linux/string.h>
 
+#ifdef CONFIG_UACCESS_MEMCPY
+static inline __must_check unsigned long
+raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+{
+	if (__builtin_constant_p(n)) {
+		switch(n) {
+		case 1:
+			*(u8 *)to = *(u8 __force *)from;
+			return 0;
+		case 2:
+			*(u16 *)to = *(u16 __force *)from;
+			return 0;
+		case 4:
+			*(u32 *)to = *(u32 __force *)from;
+			return 0;
+		}
+	}
+
+	memcpy(to, (const void __force *)from, n);
+	return 0;
+}
+
+static inline __must_check unsigned long
+raw_copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+	if (__builtin_constant_p(n)) {
+		switch(n) {
+		case 1:
+			*(u8 __force *)to = *(u8 *)from;
+			return 0;
+		case 2:
+			*(u16 __force *)to = *(u16 *)from;
+			return 0;
+		case 4:
+			*(u32 __force *)to = *(u32 *)from;
+			return 0;
+		default:
+			break;
+		}
+	}
+
+	memcpy((void __force *)to, from, n);
+	return 0;
+}
+#define INLINE_COPY_FROM_USER
+#define INLINE_COPY_TO_USER
+#endif /* CONFIG_UACCESS_MEMCPY */
+
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
 #ifndef KERNEL_DS
diff --git a/lib/Kconfig b/lib/Kconfig
index a9e56539bd11..7a3f01ac45e8 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -591,6 +591,10 @@ config ARCH_NO_SG_CHAIN
 config ARCH_HAS_PMEM_API
 	bool
 
+# use memcpy to implement user copies for nommu architectures
+config UACCESS_MEMCPY
+	bool
+
 config ARCH_HAS_UACCESS_FLUSHCACHE
 	bool
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] asm-generic: optimize generic uaccess for 8-byte loads and stores
  2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
                   ` (2 preceding siblings ...)
  2019-04-23 16:38 ` [PATCH 3/4] asm-generic: provide entirely generic nommu uaccess Christoph Hellwig
@ 2019-04-23 16:38 ` Christoph Hellwig
  2019-04-23 18:27 ` kill <asm/segment.h> and improve nommu generic uaccess helpers Arnd Bergmann
  4 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 16:38 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch

On 64-bit architectures we can also use the direct load/store trick for
8-byte values.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/asm-generic/uaccess.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 3dcabfceb21e..e935318804f8 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -24,6 +24,11 @@ raw_copy_from_user(void *to, const void __user * from, unsigned long n)
 		case 4:
 			*(u32 *)to = *(u32 __force *)from;
 			return 0;
+#ifdef CONFIG_64BIT
+		case 8:
+			*(u64 *)to = *(u64 __force *)from;
+			return 0;
+#endif
 		}
 	}
 
@@ -45,6 +50,11 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 		case 4:
 			*(u32 __force *)to = *(u32 *)from;
 			return 0;
+#ifdef CONFIG_64BIT
+		case 8:
+			*(u64 __force *)to = *(u64 *)from;
+			return 0;
+#endif
 		default:
 			break;
 		}
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: kill <asm/segment.h> and improve nommu generic uaccess helpers
  2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
                   ` (3 preceding siblings ...)
  2019-04-23 16:38 ` [PATCH 4/4] asm-generic: optimize generic uaccess for 8-byte loads and stores Christoph Hellwig
@ 2019-04-23 18:27 ` Arnd Bergmann
  2019-04-23 18:32   ` Christoph Hellwig
  4 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2019-04-23 18:27 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-arch

On Tue, Apr 23, 2019 at 6:38 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Hi Arnd,
>
> this is a series doing two somewhat interwinded things.  It improves
> the asm-generic nommu uaccess helper to optionally be entirely generic
> and not require any arch helpers for the actual uaccess.  For the
> generic uaccess.h to actually be generically useful I also had to kill
> off the mess we made of <asm/segment.h>, which really shouldn't exist
> on most architectures.

This looks really nice, so

Acked-by: Arnd Bergmann <arnd@arndb.de>

Should I pick this up into my asm-generic tree, or do you have another tree
that this fits into? I might be on vacation during the entire merge window
this time and don't have anything else for asm-generic, so I'd prefer if someone
else could merge them.

I've also added the patches to my randconfig build tree (building x86, arm
and arm64 randconfigs at the moment). I expect it to be fine, but I'll let
you know if something breaks.

        Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kill <asm/segment.h> and improve nommu generic uaccess helpers
  2019-04-23 18:27 ` kill <asm/segment.h> and improve nommu generic uaccess helpers Arnd Bergmann
@ 2019-04-23 18:32   ` Christoph Hellwig
  2019-04-23 18:41     ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 18:32 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Christoph Hellwig, linux-arch

On Tue, Apr 23, 2019 at 08:27:29PM +0200, Arnd Bergmann wrote:
> Should I pick this up into my asm-generic tree, or do you have another tree
> that this fits into? I might be on vacation during the entire merge window
> this time and don't have anything else for asm-generic, so I'd prefer if someone
> else could merge them.

Not sure where else it would fit.  It is in support for the RISC-V
nommu port, but that isn't ready for the merge window.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kill <asm/segment.h> and improve nommu generic uaccess helpers
  2019-04-23 18:32   ` Christoph Hellwig
@ 2019-04-23 18:41     ` Arnd Bergmann
  2019-04-23 19:36       ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2019-04-23 18:41 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-arch

On Tue, Apr 23, 2019 at 8:32 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Apr 23, 2019 at 08:27:29PM +0200, Arnd Bergmann wrote:
> > Should I pick this up into my asm-generic tree, or do you have another tree
> > that this fits into? I might be on vacation during the entire merge window
> > this time and don't have anything else for asm-generic, so I'd prefer if someone
> > else could merge them.
>
> Not sure where else it would fit.  It is in support for the RISC-V
> nommu port, but that isn't ready for the merge window.

If RISC-V want it, I don't see a problem with merging those patches
as preparation through the riscv git tree with my Ack for the asm-generic
portion.

      Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kill <asm/segment.h> and improve nommu generic uaccess helpers
  2019-04-23 18:41     ` Arnd Bergmann
@ 2019-04-23 19:36       ` Christoph Hellwig
  2019-04-23 19:58         ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2019-04-23 19:36 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Christoph Hellwig, linux-arch

On Tue, Apr 23, 2019 at 08:41:02PM +0200, Arnd Bergmann wrote:
> > Not sure where else it would fit.  It is in support for the RISC-V
> > nommu port, but that isn't ready for the merge window.
> 
> If RISC-V want it, I don't see a problem with merging those patches
> as preparation through the riscv git tree with my Ack for the asm-generic
> portion.

We don't really need it this merge window and the patch stack is huge,
so anything I can dash out earlier is a plus.

I could offer you to send the asm-generic pull request to Linus if
you're off after you have prepared everything else before leaving.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kill <asm/segment.h> and improve nommu generic uaccess helpers
  2019-04-23 19:36       ` Christoph Hellwig
@ 2019-04-23 19:58         ` Arnd Bergmann
  0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2019-04-23 19:58 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-arch

On Tue, Apr 23, 2019 at 9:37 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Apr 23, 2019 at 08:41:02PM +0200, Arnd Bergmann wrote:
> > > Not sure where else it would fit.  It is in support for the RISC-V
> > > nommu port, but that isn't ready for the merge window.
> >
> > If RISC-V want it, I don't see a problem with merging those patches
> > as preparation through the riscv git tree with my Ack for the asm-generic
> > portion.
>
> We don't really need it this merge window and the patch stack is huge,
> so anything I can dash out earlier is a plus.
>
> I could offer you to send the asm-generic pull request to Linus if
> you're off after you have prepared everything else before leaving.

I can probably do it during the vacation. I've pushed the four branches
out for linux-next now and added a signed tag 'asm-generic-nommu' on my
asm-generic git tree, so sending out the pull request should be a matter
of minutes even when I'm travelling.

       Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-23 19:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 16:38 kill <asm/segment.h> and improve nommu generic uaccess helpers Christoph Hellwig
2019-04-23 16:38 ` [PATCH 1/4] asm-generic: don't include <asm/segment.h> from <asm/uaccess.h> Christoph Hellwig
2019-04-23 16:38 ` [PATCH 2/4] arch: mostly remove <asm/segment.h> Christoph Hellwig
2019-04-23 16:38 ` [PATCH 3/4] asm-generic: provide entirely generic nommu uaccess Christoph Hellwig
2019-04-23 16:38 ` [PATCH 4/4] asm-generic: optimize generic uaccess for 8-byte loads and stores Christoph Hellwig
2019-04-23 18:27 ` kill <asm/segment.h> and improve nommu generic uaccess helpers Arnd Bergmann
2019-04-23 18:32   ` Christoph Hellwig
2019-04-23 18:41     ` Arnd Bergmann
2019-04-23 19:36       ` Christoph Hellwig
2019-04-23 19:58         ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.