Skip to contentSkip to conversation

s390 update (1/9): s390 arch fixes.

PATCH In review Martin Schwidefsky 2 participants 2 messages Mar 26, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 update (1/9): s390 arch fixes.

* Initialize timing related variables first and then enable the timer interrupt.
* Normalize nano seconds to micro seconds in do_gettimeofday.
* Add types for __kernel_timer_t and __kernel_clockid_t.
* Fix ugly bug in switch_to: set prev to the return value of resume, otherwise prev still contains the previous process at the time resume was called and not the previous process at the time resume returned. They differ...
* Add missing include to get the kernel compiled.
* Get a closer match with the i386 termios.h file.
* Cope with INITIAL_JIFFIES.
* Define cpu_relax to do a cpu yield on VM and LPAR.
* Don't reenable interrupts in program check handler.
* Add pte_file definitions.
* Console initialization fixes for 3215 and sclp.

diffstat:

 arch/s390/defconfig             |   76 ++++++++++++++++++++++++--------------
 arch/s390/kernel/entry.S        |    4 --
 arch/s390/kernel/ptrace.c       |   21 ++++++----
 arch/s390/kernel/time.c         |   16 ++++----
 arch/s390/mm/ioremap.c          |    2 -
 arch/s390x/defconfig            |   80 +++++++++++++++++++++++++---------------
 arch/s390x/kernel/entry.S       |    4 --
 arch/s390x/kernel/ptrace.c      |   27 ++++++++++---
 arch/s390x/kernel/time.c        |   20 +++++-----
 arch/s390x/mm/ioremap.c         |    2 -
 drivers/s390/char/con3215.c     |    9 ++--
 drivers/s390/char/sclp_tty.c    |    3 -
 include/asm-s390/pgtable.h      |   69 +++++++++++++++++++++++-----------
 include/asm-s390/posix_types.h  |    2 +
 include/asm-s390/processor.h    |    5 ++
 include/asm-s390/signal.h       |    1 
 include/asm-s390/system.h       |    2 -
 include/asm-s390/termios.h      |   25 ++++++------
 include/asm-s390x/pgtable.h     |   57 +++++++++++++++++++---------
 include/asm-s390x/posix_types.h |    2 +
 include/asm-s390x/processor.h   |    6 ++-
 include/asm-s390x/signal.h      |    1 
 include/asm-s390x/system.h      |    2 -
 include/asm-s390x/termios.h     |   27 ++++++-------
 24 files changed, 290 insertions(+), 173 deletions(-)
arch/s390/defconfig +48 -28
diff -urN linux-2.5.66/arch/s390/defconfig linux-2.5.66-s390/arch/s390/defconfig
@@ -2,7 +2,6 @@
 # Automatically generated make config: don't edit
 #
 CONFIG_MMU=y
-CONFIG_SWAP=y
 CONFIG_UID16=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_S390=y
@@ -15,6 +14,7 @@
 #
 # General setup
 #
+CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
@@ -158,6 +158,9 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_XFRM_USER is not set
 CONFIG_IPV6=m
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
@@ -252,48 +255,63 @@
 #
 # File systems
 #
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
-# CONFIG_REISERFS_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+# CONFIG_DEVFS_FS is not set
+CONFIG_DEVPTS_FS=y
+# CONFIG_TMPFS is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-CONFIG_EXT3_FS=y
-CONFIG_EXT3_FS_XATTR=y
-# CONFIG_EXT3_FS_POSIX_ACL is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_MINIX_FS is not set
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
 # CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_XFS_FS is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V4 is not set
@@ -301,16 +319,17 @@
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V4 is not set
 # CONFIG_NFSD_TCP is not set
-CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
-# CONFIG_CIFS is not set
+CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_GSS is not set
 # CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
-CONFIG_FS_MBCACHE=y
 
 #
 # Partition Types
@@ -324,6 +343,7 @@
 # CONFIG_MAC_PARTITION is not set
 # CONFIG_MSDOS_PARTITION is not set
 # CONFIG_LDM_PARTITION is not set
+# CONFIG_NEC98_PARTITION is not set
 # CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
 # CONFIG_SUN_PARTITION is not set
arch/s390/kernel/entry.S +1 -3
diff -urN linux-2.5.66/arch/s390/kernel/entry.S linux-2.5.66-s390/arch/s390/kernel/entry.S
@@ -644,13 +644,12 @@
         tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
         bnz     BASED(pgm_per)           # got per exception -> special case
 	SAVE_ALL __LC_PGM_OLD_PSW,1
-	la	%r8,0x7f
         l       %r3,__LC_PGM_ILC         # load program interruption code
+	la	%r8,0x7f
         l       %r7,BASED(.Ljump_table)
 	nr	%r8,%r3
         sll     %r8,2
 	GET_THREAD_INFO
-        stosm   24(%r15),0x03            # reenable interrupts
         l       %r7,0(%r8,%r7)		 # load address of handler routine
         la      %r2,SP_PTREGS(%r15)	 # address of register-save area
 	la      %r14,BASED(sysc_return)
@@ -677,7 +676,6 @@
 	GET_THREAD_INFO
 	la	%r4,0x7f
 	l	%r3,__LC_PGM_ILC	 # load program interruption code
-        stosm   24(%r15),0x03            # reenable interrupts
         nr      %r4,%r3                  # clear per-event-bit and ilc
         be      BASED(pgm_per_only)      # only per or per+check ?
         l       %r1,BASED(.Ljump_table)
arch/s390/kernel/ptrace.c +13 -8
diff -urN linux-2.5.66/arch/s390/kernel/ptrace.c linux-2.5.66-s390/arch/s390/kernel/ptrace.c
@@ -207,21 +207,24 @@
 		return ptrace_attach(child);
 
 	/*
-	 * I added child != current line so we can get the
-	 * ieee_instruction_pointer from the user structure DJB
+	 * Special cases to get/store the ieee instructions pointer.
 	 */
-	if (child != current) {
-		ret = ptrace_check_attach(child, request == PTRACE_KILL);
-		if (ret < 0)
-			return ret;
+	if (child == current) {
+		if (request == PTRACE_PEEKUSR && addr == PT_IEEE_IP)
+			return peek_user(child, addr, data);
+		if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
+			return poke_user(child, addr, data);
 	}
 
-	/* Remove high order bit from address. */
-	addr &= PSW_ADDR_INSN;
+	ret = ptrace_check_attach(child, request == PTRACE_KILL);
+	if (ret < 0)
+		return ret;
 
 	switch (request) {
 	case PTRACE_PEEKTEXT:
 	case PTRACE_PEEKDATA:
+		/* Remove high order bit from address. */
+		addr &= PSW_ADDR_INSN;
 		/* read word at location addr. */
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
@@ -234,6 +237,8 @@
 
 	case PTRACE_POKETEXT:
 	case PTRACE_POKEDATA:
+		/* Remove high order bit from address. */
+		addr &= PSW_ADDR_INSN;
 		/* write the word at location addr. */
 		copied = access_process_vm(child, addr, &data, sizeof(data),1);
 		if (copied != sizeof(data))
arch/s390/kernel/time.c +9 -7
diff -urN linux-2.5.66/arch/s390/kernel/time.c linux-2.5.66-s390/arch/s390/kernel/time.c
@@ -49,8 +49,9 @@
 u64 jiffies_64 = INITIAL_JIFFIES;
 
 static ext_int_info_t ext_int_info_timer;
-static uint64_t xtime_cc;
-static uint64_t init_timer_cc;
+static u64 init_timer_cc;
+static u64 jiffies_timer_cc;
+static u64 xtime_cc;
 
 extern unsigned long wall_jiffies;
 
@@ -70,7 +71,7 @@
 	__u64 now;
 
 	asm volatile ("STCK 0(%0)" : : "a" (&now) : "memory", "cc");
-        now = (now - init_timer_cc) >> 12;
+        now = (now - jiffies_timer_cc) >> 12;
 	/* We require the offset from the latest update of xtime */
 	now -= (__u64) wall_jiffies*USECS_PER_JIFFY;
 	return (unsigned long) now;
@@ -202,14 +203,14 @@
 	unsigned long cr0;
 	__u64 timer;
 
+	timer = jiffies_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
+	S390_lowcore.jiffy_timer = timer;
+	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
+	asm volatile ("SCKC %0" : : "m" (timer));
         /* allow clock comparator timer interrupt */
         asm volatile ("STCTL 0,0,%0" : "=m" (cr0) : : "memory");
         cr0 |= 0x800;
         asm volatile ("LCTL 0,0,%0" : : "m" (cr0) : "memory");
-	timer = init_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
-	S390_lowcore.jiffy_timer = timer;
-	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
-	asm volatile ("SCKC %0" : : "m" (timer));
 }
 
 /*
@@ -239,6 +240,7 @@
                 printk("time_init: TOD clock stopped/non-operational\n");
                 break;
         }
+	jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY;
 
 	/* set xtime */
 	xtime_cc = init_timer_cc;
arch/s390/mm/ioremap.c +1 -1
diff -urN linux-2.5.66/arch/s390/mm/ioremap.c linux-2.5.66-s390/arch/s390/mm/ioremap.c
@@ -38,7 +38,7 @@
                         printk("remap_area_pte: page already exists\n");
 			BUG();
 		}
-                set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | flags)));
+                set_pte(pte, pfn_pte(pfn, __pgprot(flags)));
                 address += PAGE_SIZE;
                 pfn++;
                 pte++;
arch/s390x/defconfig +51 -29

150 lines not on this page · raw message

arch/s390x/kernel/entry.S +1 -3
diff -urN linux-2.5.66/arch/s390x/kernel/entry.S linux-2.5.66-s390/arch/s390x/kernel/entry.S
@@ -677,12 +677,11 @@
         tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
         jnz     pgm_per                  # got per exception -> special case
 	SAVE_ALL __LC_PGM_OLD_PSW,1
-	lghi	%r8,0x7f
 	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
+	lghi	%r8,0x7f
 	ngr	%r8,%r3
         sll     %r8,3
 	GET_THREAD_INFO
-	stosm   48(%r15),0x03            # reenable interrupts
         larl    %r1,pgm_check_table
         lg      %r1,0(%r8,%r1)		 # load address of handler routine
         la      %r2,SP_PTREGS(%r15)	 # address of register-save area
@@ -709,7 +708,6 @@
 	GET_THREAD_INFO
 	lghi    %r4,0x7f
 	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
-	stosm   48(%r15),0x03            # reenable interrupts
         nr      %r4,%r3			 # clear per-event-bit and ilc
         je      pgm_per_only		 # only per of per+check ?
         sll     %r4,3
arch/s390x/kernel/ptrace.c +21 -6
diff -urN linux-2.5.66/arch/s390x/kernel/ptrace.c linux-2.5.66-s390/arch/s390x/kernel/ptrace.c
@@ -473,6 +473,8 @@
 }
 #endif
 
+#define PT32_IEEE_IP 0x13c
+
 static int
 do_ptrace(struct task_struct *child, long request, long addr, long data)
 {
@@ -481,16 +483,29 @@
 	if (request == PTRACE_ATTACH)
 		return ptrace_attach(child);
 
+
 	/*
-	 * I added child != current line so we can get the
-	 * ieee_instruction_pointer from the user structure DJB
+	 * Special cases to get/store the ieee instructions pointer.
 	 */
-	if (child != current) {
-		ret = ptrace_check_attach(child, request == PTRACE_KILL);
-		if (ret < 0)
-			return ret;
+	if (child == current) {
+		if (request == PTRACE_PEEKUSR &&
+		    addr == PT_IEEE_IP && !test_thread_flag(TIF_31BIT))
+			return peek_user(child, addr, data);
+		if (request == PTRACE_PEEKUSR &&
+		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
+			return peek_user_emu31(child, addr, data);
+		if (request == PTRACE_POKEUSR &&
+		    addr == PT_IEEE_IP && !test_thread_flag(TIF_31BIT))
+			return poke_user(child, addr, data);
+		if (request == PTRACE_POKEUSR &&
+		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
+			return poke_user_emu31(child, addr, data);
 	}
 
+	ret = ptrace_check_attach(child, request == PTRACE_KILL);
+	if (ret < 0)
+		return ret;
+
 	switch (request) {
 	/* First the common request for 31/64 bit */
 	case PTRACE_SYSCALL:
arch/s390x/kernel/time.c +11 -9
diff -urN linux-2.5.66/arch/s390x/kernel/time.c linux-2.5.66-s390/arch/s390x/kernel/time.c
@@ -48,8 +48,9 @@
 u64 jiffies_64 = INITIAL_JIFFIES;
 
 static ext_int_info_t ext_int_info_timer;
-static uint64_t xtime_cc;
-static uint64_t init_timer_cc;
+static u64 init_timer_cc;
+static u64 jiffies_timer_cc;
+static u64 xtime_cc;
 
 extern unsigned long wall_jiffies;
 
@@ -65,7 +66,7 @@
 	__u64 now;
 
 	asm volatile ("STCK 0(%0)" : : "a" (&now) : "memory", "cc");
-        now = (now - init_timer_cc) >> 12;
+        now = (now - jiffies_timer_cc) >> 12;
 	/* We require the offset from the latest update of xtime */
 	now -= (__u64) wall_jiffies*USECS_PER_JIFFY;
 	return (unsigned long) now;
@@ -83,7 +84,7 @@
 	do {
 		seq = read_seqbegin_irqsave(&xtime_lock, flags);
 		sec = xtime.tv_sec;
-		usec = xtime.tv_nsec + do_gettimeoffset();
+		usec = xtime.tv_nsec / 1000 + do_gettimeoffset();
 	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
 
 	while (usec >= 1000000) {
@@ -99,7 +100,7 @@
 {
 
 	write_seqlock_irq(&xtime_lock);
-	/* This is revolting. We need to set the xtime.tv_usec
+	/* This is revolting. We need to set the xtime.tv_nsec
 	 * correctly. However, the value in this location is
 	 * is value at the last tick.
 	 * Discover what correction gettimeofday
@@ -187,14 +188,14 @@
 	unsigned long cr0;
 	__u64 timer;
 
+	timer = jiffies_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
+	S390_lowcore.jiffy_timer = timer;
+	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
+	asm volatile ("SCKC %0" : : "m" (timer));
         /* allow clock comparator timer interrupt */
         asm volatile ("STCTG 0,0,%0" : "=m" (cr0) : : "memory");
         cr0 |= 0x800;
         asm volatile ("LCTLG 0,0,%0" : : "m" (cr0) : "memory");
-	timer = init_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
-	S390_lowcore.jiffy_timer = timer;
-	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
-	asm volatile ("SCKC %0" : : "m" (timer));
 }
 
 /*
@@ -224,6 +225,7 @@
                 printk("time_init: TOD clock stopped/non-operational\n");
                 break;
         }
+	jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY;
 
 	/* set xtime */
 	xtime_cc = init_timer_cc;
arch/s390x/mm/ioremap.c +1 -1
diff -urN linux-2.5.66/arch/s390x/mm/ioremap.c linux-2.5.66-s390/arch/s390x/mm/ioremap.c
@@ -38,7 +38,7 @@
                         printk("remap_area_pte: page already exists\n");
 			BUG();
 		}
-                set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | flags)));
+                set_pte(pte, pfn_pte(pfn, __pgprot(flags)));
                 address += PAGE_SIZE;
                 pfn++;
                 pte++;
drivers/s390/char/con3215.c +5 -4
diff -urN linux-2.5.66/drivers/s390/char/con3215.c linux-2.5.66-s390/drivers/s390/char/con3215.c
@@ -884,7 +884,7 @@
  * 3215 console initialization code called from console_init().
  * NOTE: This is called before kmalloc is available.
  */
-static void __init
+static int __init
 con3215_init(void)
 {
 	struct ccw_device *cdev;
@@ -894,7 +894,7 @@
 
 	/* Check if 3215 is to be the console */
 	if (!CONSOLE_IS_3215)
-		return;
+		return -ENODEV;
 
 	/* Set the console mode for VM */
 	if (MACHINE_IS_VM) {
@@ -913,7 +913,7 @@
 
 	cdev = ccw_device_probe_console();
 	if (!cdev)
-		return;
+		return -ENODEV;
 
 	raw3215[0] = raw = (struct raw3215_info *)
 		alloc_bootmem_low(sizeof(struct raw3215_info));
@@ -938,9 +938,10 @@
 		free_bootmem((unsigned long) raw, sizeof(struct raw3215_info));
 		raw3215[0] = NULL;
 		printk("Couldn't find a 3215 console device\n");
-		return;
+		return -ENODEV;
 	}
 	register_console(&con3215);
+	return 0;
 }
 #endif
 
drivers/s390/char/sclp_tty.c +0 -3
diff -urN linux-2.5.66/drivers/s390/char/sclp_tty.c linux-2.5.66-s390/drivers/s390/char/sclp_tty.c
@@ -797,6 +797,3 @@
 	if (tty_register_driver(&sclp_tty_driver))
 		panic("Couldn't register sclp_tty driver\n");
 }
-
-console_initcall(sclp_tty_init);
-
include/asm-s390/pgtable.h +47 -22

120 lines not on this page · raw message

include/asm-s390/posix_types.h +2 -0
diff -urN linux-2.5.66/include/asm-s390/posix_types.h linux-2.5.66-s390/include/asm-s390/posix_types.h
@@ -30,6 +30,8 @@
 typedef long            __kernel_time_t;
 typedef long            __kernel_suseconds_t;
 typedef long            __kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int             __kernel_daddr_t;
 typedef char *          __kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;
include/asm-s390/processor.h +4 -1
diff -urN linux-2.5.66/include/asm-s390/processor.h linux-2.5.66-s390/include/asm-s390/processor.h
@@ -133,7 +133,10 @@
 #define KSTK_EIP(tsk)	(__KSTK_PTREGS(tsk)->psw.addr)
 #define KSTK_ESP(tsk)	(__KSTK_PTREGS(tsk)->gprs[15])
 
-#define cpu_relax()	barrier()
+/*
+ * Give up the time slice of the virtual PU.
+ */
+#define cpu_relax()	asm volatile ("diag 0,0,68" : : : "memory")
 
 /*
  * Set PSW mask to specified value, while leaving the
include/asm-s390/signal.h +1 -0
diff -urN linux-2.5.66/include/asm-s390/signal.h linux-2.5.66-s390/include/asm-s390/signal.h
@@ -10,6 +10,7 @@
 #define _ASMS390_SIGNAL_H
 
 #include <linux/types.h>
+#include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
include/asm-s390/system.h +1 -1
diff -urN linux-2.5.66/include/asm-s390/system.h linux-2.5.66-s390/include/asm-s390/system.h
@@ -82,7 +82,7 @@
 		break;							     \
 	save_fp_regs(&prev->thread.fp_regs);				     \
 	restore_fp_regs(&next->thread.fp_regs);				     \
-	resume(prev,next);						     \
+	prev = resume(prev,next);					     \
 } while (0)
 
 #define nop() __asm__ __volatile__ ("nop")
include/asm-s390/termios.h +12 -13
diff -urN linux-2.5.66/include/asm-s390/termios.h linux-2.5.66-s390/include/asm-s390/termios.h
@@ -12,7 +12,6 @@
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
 
-
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
@@ -44,7 +43,7 @@
 #define TIOCM_RI	TIOCM_RNG
 #define TIOCM_OUT1	0x2000
 #define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP      0x8000
+#define TIOCM_LOOP	0x8000
 
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 
@@ -62,7 +61,8 @@
 #define N_PROFIBUS_FDL	10	/* Reserved for Profibus <[email protected]> */
 #define N_IRDA		11	/* Linux IR - http://irda.sourceforge.net/ */
 #define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC         13	/* synchronous HDLC */
+#define N_HDLC		13	/* synchronous HDLC */
+#define N_SYNC_PPP	14	/* synchronous PPP */
 #define N_HCI		15  /* Bluetooth HCI UART */
 
 #ifdef __KERNEL__
@@ -78,19 +78,18 @@
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+	unsigned short __tmp; \
+	get_user(__tmp,&(termio)->x); \
+	(termios)->x = (0xffff0000 & ((termios)->x)) | __tmp; \
+}
 
 #define user_termio_to_kernel_termios(termios, termio) \
 ({ \
-        unsigned short tmp; \
-        get_user(tmp, &(termio)->c_iflag); \
-        (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
-        get_user(tmp, &(termio)->c_oflag); \
-        (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
-        get_user(tmp, &(termio)->c_cflag); \
-        (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
-        get_user(tmp, &(termio)->c_lflag); \
-        (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
-        get_user((termios)->c_line, &(termio)->c_line); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
 	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
 })
 
include/asm-s390x/pgtable.h +39 -18

95 lines not on this page · raw message

include/asm-s390x/posix_types.h +2 -0
diff -urN linux-2.5.66/include/asm-s390x/posix_types.h linux-2.5.66-s390/include/asm-s390x/posix_types.h
@@ -31,6 +31,8 @@
 typedef long            __kernel_time_t;
 typedef long            __kernel_suseconds_t;
 typedef long            __kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int             __kernel_daddr_t;
 typedef char *          __kernel_caddr_t;
 typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */
include/asm-s390x/processor.h +5 -1
diff -urN linux-2.5.66/include/asm-s390x/processor.h linux-2.5.66-s390/include/asm-s390x/processor.h
@@ -148,7 +148,11 @@
 #define KSTK_EIP(tsk)	(__KSTK_PTREGS(tsk)->psw.addr)
 #define KSTK_ESP(tsk)	(__KSTK_PTREGS(tsk)->gprs[15])
 
-#define cpu_relax()	barrier()
+/*
+ * Give up the time slice of the virtual PU.
+ */
+#define cpu_relax() \
+	asm volatile ("ex 0,%0" : : "i" (__LC_DIAG44_OPCODE) : "memory")
 
 /*
  * Set PSW mask to specified value, while leaving the
include/asm-s390x/signal.h +1 -0
diff -urN linux-2.5.66/include/asm-s390x/signal.h linux-2.5.66-s390/include/asm-s390x/signal.h
@@ -10,6 +10,7 @@
 #define _ASMS390_SIGNAL_H
 
 #include <linux/types.h>
+#include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
include/asm-s390x/system.h +1 -1
diff -urN linux-2.5.66/include/asm-s390x/system.h linux-2.5.66-s390/include/asm-s390x/system.h
@@ -74,7 +74,7 @@
 		break;							     \
 	save_fp_regs(&prev->thread.fp_regs);				     \
 	restore_fp_regs(&next->thread.fp_regs);				     \
-	resume(prev,next);						     \
+	prev = resume(prev,next);					     \
 } while (0)
 
 #define nop() __asm__ __volatile__ ("nop")
include/asm-s390x/termios.h +13 -14
diff -urN linux-2.5.66/include/asm-s390x/termios.h linux-2.5.66-s390/include/asm-s390x/termios.h
@@ -12,7 +12,6 @@
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
 
-
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
@@ -44,7 +43,7 @@
 #define TIOCM_RI	TIOCM_RNG
 #define TIOCM_OUT1	0x2000
 #define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP      0x8000
+#define TIOCM_LOOP	0x8000
 
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 
@@ -62,8 +61,9 @@
 #define N_PROFIBUS_FDL	10	/* Reserved for Profibus <[email protected]> */
 #define N_IRDA		11	/* Linux IR - http://irda.sourceforge.net/ */
 #define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC         13	/* synchronous HDLC */
-#define N_HCI		15	/* Bluetooth HCI UART */
+#define N_HDLC		13	/* synchronous HDLC */
+#define N_SYNC_PPP	14	/* synchronous PPP */
+#define N_HCI		15  /* Bluetooth HCI UART */
 
 #ifdef __KERNEL__
 
@@ -78,19 +78,18 @@
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+	unsigned short __tmp; \
+	get_user(__tmp,&(termio)->x); \
+	(termios)->x = (0xffff0000 & ((termios)->x)) | __tmp; \
+}
 
 #define user_termio_to_kernel_termios(termios, termio) \
 ({ \
-        unsigned short tmp; \
-        get_user(tmp, &(termio)->c_iflag); \
-        (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
-        get_user(tmp, &(termio)->c_oflag); \
-        (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
-        get_user(tmp, &(termio)->c_cflag); \
-        (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
-        get_user(tmp, &(termio)->c_lflag); \
-        (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
-        get_user((termios)->c_line, &(termio)->c_line); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
 	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
 })
 
#1 lore raw

It looks you do exactly the same changes to both s390 and s390x. A closer look at the arch directories shows that about 95% of the code is exactly the same. Can you remove the s390x dir and abstract out the few differences into a config option?