Skip to contentSkip to conversation

Use alternative user-copy operations for new hardware.

S390 Martin Schwidefsky 1 participant 1 message Sep 12, 2006 s390

lore
Share & tools
lore
#0 lore raw

From: Gerald Schaefer <[email protected]>

[S390] Use alternative user-copy operations for new hardware.

This introduces new user-copy operations which are optimized for copying more than 256 Bytes on new hardware.

---

 arch/s390/kernel/head64.S     |   13 +++
 arch/s390/kernel/setup.c      |    6 +
 arch/s390/lib/Makefile        |    1 
 arch/s390/lib/uaccess_mvcos.c |  156 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-s390/setup.h      |    2 
 include/asm-s390/uaccess.h    |    1 
 6 files changed, 178 insertions(+), 1 deletion(-)
arch/s390/kernel/head64.S +13 -0
diff -urpN linux-2.6/arch/s390/kernel/head64.S linux-2.6-patched/arch/s390/kernel/head64.S
@@ -250,6 +250,19 @@ startup_continue:
 	oi	7(%r12),0x80		# set IDTE flag
 0:
 
+#
+# find out if we have the MVCOS instruction
+#
+	la	%r1,0f-.LPG1(%r13)	# set program check address
+	stg	%r1,__LC_PGM_NEW_PSW+8
+	.short	0xc800			# mvcos 0(%r0),0(%r0),%r0
+	.short	0x0000
+	.short	0x0000
+0:	tm	0x8f,0x13		# special-operation exception?
+	bno	1f-.LPG1(%r13)		# if yes, MVCOS is present
+	oi	6(%r12),2		# set MVCOS flag
+1:
+
         lpswe .Lentry-.LPG1(13)         # jump to _stext in primary-space,
                                         # virtual and never return ...
         .align 16
arch/s390/kernel/setup.c +5 -1
diff -urpN linux-2.6/arch/s390/kernel/setup.c linux-2.6-patched/arch/s390/kernel/setup.c
@@ -647,7 +647,11 @@ setup_arch(char **cmdline_p)
 
 	memory_end = memory_size;
 
-	memcpy(&uaccess, &uaccess_std, sizeof(uaccess));
+	if (MACHINE_HAS_MVCOS)
+		memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess));
+	else
+		memcpy(&uaccess, &uaccess_std, sizeof(uaccess));
+
 	parse_early_param();
 
 #ifndef CONFIG_64BIT
arch/s390/lib/Makefile +1 -0
diff -urpN linux-2.6/arch/s390/lib/Makefile linux-2.6-patched/arch/s390/lib/Makefile
@@ -5,4 +5,5 @@
 EXTRA_AFLAGS := -traditional
 
 lib-y += delay.o string.o uaccess_std.o
+lib-$(CONFIG_64BIT) += uaccess_mvcos.o
 lib-$(CONFIG_SMP) += spinlock.o
arch/s390/lib/uaccess_mvcos.c +156 -0

156 lines not on this page · raw message

include/asm-s390/setup.h +2 -0
diff -urpN linux-2.6/include/asm-s390/setup.h linux-2.6-patched/include/asm-s390/setup.h
@@ -44,10 +44,12 @@ extern unsigned long machine_flags;
 #define MACHINE_HAS_IEEE	(machine_flags & 2)
 #define MACHINE_HAS_CSP		(machine_flags & 8)
 #define MACHINE_HAS_DIAG44	(1)
+#define MACHINE_HAS_MVCOS	(0)
 #else /* __s390x__ */
 #define MACHINE_HAS_IEEE	(1)
 #define MACHINE_HAS_CSP		(1)
 #define MACHINE_HAS_DIAG44	(machine_flags & 32)
+#define MACHINE_HAS_MVCOS	(machine_flags & 512)
 #endif /* __s390x__ */
 
 
include/asm-s390/uaccess.h +1 -0
diff -urpN linux-2.6/include/asm-s390/uaccess.h linux-2.6-patched/include/asm-s390/uaccess.h
@@ -100,6 +100,7 @@ struct uaccess_ops {
 
 extern struct uaccess_ops uaccess;
 extern struct uaccess_ops uaccess_std;
+extern struct uaccess_ops uaccess_mvcos;
 
 static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
 {