aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390')
-rw-r--r--include/asm-s390/bitops.h42
-rw-r--r--include/asm-s390/cio.h2
-rw-r--r--include/asm-s390/cmb.h4
-rw-r--r--include/asm-s390/dasd.h8
-rw-r--r--include/asm-s390/futex.h15
-rw-r--r--include/asm-s390/io.h5
-rw-r--r--include/asm-s390/irq.h4
-rw-r--r--include/asm-s390/irqflags.h50
-rw-r--r--include/asm-s390/lowcore.h4
-rw-r--r--include/asm-s390/percpu.h3
-rw-r--r--include/asm-s390/pgtable.h7
-rw-r--r--include/asm-s390/rwsem.h31
-rw-r--r--include/asm-s390/semaphore.h3
-rw-r--r--include/asm-s390/signal.h2
-rw-r--r--include/asm-s390/socket.h1
-rw-r--r--include/asm-s390/system.h32
-rw-r--r--include/asm-s390/thread_info.h1
-rw-r--r--include/asm-s390/unistd.h4
18 files changed, 113 insertions, 105 deletions
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 4d2b126ba159..0ddcdba79e4a 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -12,6 +12,9 @@
12 * Copyright (C) 1992, Linus Torvalds 12 * Copyright (C) 1992, Linus Torvalds
13 * 13 *
14 */ 14 */
15
16#ifdef __KERNEL__
17
15#include <linux/compiler.h> 18#include <linux/compiler.h>
16 19
17/* 20/*
@@ -50,19 +53,6 @@
50 * with operation of the form "set_bit(bitnr, flags)". 53 * with operation of the form "set_bit(bitnr, flags)".
51 */ 54 */
52 55
53/* set ALIGN_CS to 1 if the SMP safe bit operations should
54 * align the address to 4 byte boundary. It seems to work
55 * without the alignment.
56 */
57#ifdef __KERNEL__
58#define ALIGN_CS 0
59#else
60#define ALIGN_CS 1
61#ifndef CONFIG_SMP
62#error "bitops won't work without CONFIG_SMP"
63#endif
64#endif
65
66/* bitmap tables from arch/S390/kernel/bitmap.S */ 56/* bitmap tables from arch/S390/kernel/bitmap.S */
67extern const char _oi_bitmap[]; 57extern const char _oi_bitmap[];
68extern const char _ni_bitmap[]; 58extern const char _ni_bitmap[];
@@ -121,10 +111,6 @@ static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
121 unsigned long addr, old, new, mask; 111 unsigned long addr, old, new, mask;
122 112
123 addr = (unsigned long) ptr; 113 addr = (unsigned long) ptr;
124#if ALIGN_CS == 1
125 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
126 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
127#endif
128 /* calculate address for CS */ 114 /* calculate address for CS */
129 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 115 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
130 /* make OR mask */ 116 /* make OR mask */
@@ -141,10 +127,6 @@ static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
141 unsigned long addr, old, new, mask; 127 unsigned long addr, old, new, mask;
142 128
143 addr = (unsigned long) ptr; 129 addr = (unsigned long) ptr;
144#if ALIGN_CS == 1
145 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
146 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
147#endif
148 /* calculate address for CS */ 130 /* calculate address for CS */
149 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 131 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
150 /* make AND mask */ 132 /* make AND mask */
@@ -161,10 +143,6 @@ static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
161 unsigned long addr, old, new, mask; 143 unsigned long addr, old, new, mask;
162 144
163 addr = (unsigned long) ptr; 145 addr = (unsigned long) ptr;
164#if ALIGN_CS == 1
165 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
166 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
167#endif
168 /* calculate address for CS */ 146 /* calculate address for CS */
169 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 147 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
170 /* make XOR mask */ 148 /* make XOR mask */
@@ -182,10 +160,6 @@ test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
182 unsigned long addr, old, new, mask; 160 unsigned long addr, old, new, mask;
183 161
184 addr = (unsigned long) ptr; 162 addr = (unsigned long) ptr;
185#if ALIGN_CS == 1
186 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
187 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
188#endif
189 /* calculate address for CS */ 163 /* calculate address for CS */
190 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 164 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
191 /* make OR/test mask */ 165 /* make OR/test mask */
@@ -205,10 +179,6 @@ test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
205 unsigned long addr, old, new, mask; 179 unsigned long addr, old, new, mask;
206 180
207 addr = (unsigned long) ptr; 181 addr = (unsigned long) ptr;
208#if ALIGN_CS == 1
209 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
210 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
211#endif
212 /* calculate address for CS */ 182 /* calculate address for CS */
213 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 183 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
214 /* make AND/test mask */ 184 /* make AND/test mask */
@@ -228,10 +198,6 @@ test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
228 unsigned long addr, old, new, mask; 198 unsigned long addr, old, new, mask;
229 199
230 addr = (unsigned long) ptr; 200 addr = (unsigned long) ptr;
231#if ALIGN_CS == 1
232 nr += (addr & __BITOPS_ALIGN) << 3; /* add alignment to bit number */
233 addr ^= addr & __BITOPS_ALIGN; /* align address to 8 */
234#endif
235 /* calculate address for CS */ 201 /* calculate address for CS */
236 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 202 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
237 /* make XOR/test mask */ 203 /* make XOR/test mask */
@@ -834,8 +800,6 @@ static inline int sched_find_first_bit(unsigned long *b)
834 800
835#include <asm-generic/bitops/hweight.h> 801#include <asm-generic/bitops/hweight.h>
836 802
837#ifdef __KERNEL__
838
839/* 803/*
840 * ATTENTION: intel byte ordering convention for ext2 and minix !! 804 * ATTENTION: intel byte ordering convention for ext2 and minix !!
841 * bit 0 is the LSB of addr; bit 31 is the MSB of addr; 805 * bit 0 is the LSB of addr; bit 31 is the MSB of addr;
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index 089cf567c317..2b1619306351 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -276,6 +276,8 @@ extern void wait_cons_dev(void);
276 276
277extern void clear_all_subchannels(void); 277extern void clear_all_subchannels(void);
278 278
279extern void css_schedule_reprobe(void);
280
279#endif 281#endif
280 282
281#endif 283#endif
diff --git a/include/asm-s390/cmb.h b/include/asm-s390/cmb.h
index 2d09950a9c11..241756f80df3 100644
--- a/include/asm-s390/cmb.h
+++ b/include/asm-s390/cmb.h
@@ -44,10 +44,6 @@ struct cmbdata {
44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER,32) 44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER,32)
45/* enable channel measurement */ 45/* enable channel measurement */
46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER,33) 46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER,33)
47/* reset channel measurement block */
48#define BIODASDRESETCMB _IO(DASD_IOCTL_LETTER,34)
49/* read channel measurement data */
50#define BIODASDREADCMB _IOWR(DASD_IOCTL_LETTER,32,__u64)
51/* read channel measurement data */ 47/* read channel measurement data */
52#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER,33,struct cmbdata) 48#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER,33,struct cmbdata)
53 49
diff --git a/include/asm-s390/dasd.h b/include/asm-s390/dasd.h
index 1630c26e8f45..c042f9578081 100644
--- a/include/asm-s390/dasd.h
+++ b/include/asm-s390/dasd.h
@@ -68,10 +68,12 @@ typedef struct dasd_information2_t {
68 * 0x00: default features 68 * 0x00: default features
69 * 0x01: readonly (ro) 69 * 0x01: readonly (ro)
70 * 0x02: use diag discipline (diag) 70 * 0x02: use diag discipline (diag)
71 * 0x04: set the device initially online (internal use only)
71 */ 72 */
72#define DASD_FEATURE_DEFAULT 0 73#define DASD_FEATURE_DEFAULT 0x00
73#define DASD_FEATURE_READONLY 1 74#define DASD_FEATURE_READONLY 0x01
74#define DASD_FEATURE_USEDIAG 2 75#define DASD_FEATURE_USEDIAG 0x02
76#define DASD_FEATURE_INITIAL_ONLINE 0x04
75 77
76#define DASD_PARTN_BITS 2 78#define DASD_PARTN_BITS 2
77 79
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index 40c25e166a9b..1802775568b9 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -11,23 +11,24 @@
11#define __futex_atomic_fixup \ 11#define __futex_atomic_fixup \
12 ".section __ex_table,\"a\"\n" \ 12 ".section __ex_table,\"a\"\n" \
13 " .align 4\n" \ 13 " .align 4\n" \
14 " .long 0b,2b,1b,2b\n" \ 14 " .long 0b,4b,2b,4b,3b,4b\n" \
15 ".previous" 15 ".previous"
16#else /* __s390x__ */ 16#else /* __s390x__ */
17#define __futex_atomic_fixup \ 17#define __futex_atomic_fixup \
18 ".section __ex_table,\"a\"\n" \ 18 ".section __ex_table,\"a\"\n" \
19 " .align 8\n" \ 19 " .align 8\n" \
20 " .quad 0b,2b,1b,2b\n" \ 20 " .quad 0b,4b,2b,4b,3b,4b\n" \
21 ".previous" 21 ".previous"
22#endif /* __s390x__ */ 22#endif /* __s390x__ */
23 23
24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ 24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
25 asm volatile(" l %1,0(%6)\n" \ 25 asm volatile(" sacf 256\n" \
26 "0: " insn \ 26 "0: l %1,0(%6)\n" \
27 " cs %1,%2,0(%6)\n" \ 27 "1: " insn \
28 "1: jl 0b\n" \ 28 "2: cs %1,%2,0(%6)\n" \
29 "3: jl 1b\n" \
29 " lhi %0,0\n" \ 30 " lhi %0,0\n" \
30 "2:\n" \ 31 "4: sacf 0\n" \
31 __futex_atomic_fixup \ 32 __futex_atomic_fixup \
32 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ 33 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
33 "=m" (*uaddr) \ 34 "=m" (*uaddr) \
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index b05825dd16d7..d4614b35f423 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -86,20 +86,25 @@ extern void iounmap(void *addr);
86#define readb(addr) (*(volatile unsigned char *) __io_virt(addr)) 86#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
87#define readw(addr) (*(volatile unsigned short *) __io_virt(addr)) 87#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
88#define readl(addr) (*(volatile unsigned int *) __io_virt(addr)) 88#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
89#define readq(addr) (*(volatile unsigned long long *) __io_virt(addr))
89 90
90#define readb_relaxed(addr) readb(addr) 91#define readb_relaxed(addr) readb(addr)
91#define readw_relaxed(addr) readw(addr) 92#define readw_relaxed(addr) readw(addr)
92#define readl_relaxed(addr) readl(addr) 93#define readl_relaxed(addr) readl(addr)
94#define readq_relaxed(addr) readq(addr)
93#define __raw_readb readb 95#define __raw_readb readb
94#define __raw_readw readw 96#define __raw_readw readw
95#define __raw_readl readl 97#define __raw_readl readl
98#define __raw_readq readq
96 99
97#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b)) 100#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
98#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b)) 101#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
99#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b)) 102#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
103#define writeq(b,addr) (*(volatile unsigned long long *) __io_virt(addr) = (b))
100#define __raw_writeb writeb 104#define __raw_writeb writeb
101#define __raw_writew writew 105#define __raw_writew writew
102#define __raw_writel writel 106#define __raw_writel writel
107#define __raw_writeq writeq
103 108
104#define memset_io(a,b,c) memset(__io_virt(a),(b),(c)) 109#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
105#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c)) 110#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h
index 916a1aa0b073..bd1a721f7aa2 100644
--- a/include/asm-s390/irq.h
+++ b/include/asm-s390/irq.h
@@ -21,10 +21,6 @@ enum interruption_class {
21 21
22#define touch_nmi_watchdog() do { } while(0) 22#define touch_nmi_watchdog() do { } while(0)
23 23
24struct irqaction;
25struct pt_regs;
26int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
27
28#endif /* __KERNEL__ */ 24#endif /* __KERNEL__ */
29#endif 25#endif
30 26
diff --git a/include/asm-s390/irqflags.h b/include/asm-s390/irqflags.h
new file mode 100644
index 000000000000..65f4db627e7a
--- /dev/null
+++ b/include/asm-s390/irqflags.h
@@ -0,0 +1,50 @@
1/*
2 * include/asm-s390/irqflags.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H
10
11#ifdef __KERNEL__
12
13/* interrupt control.. */
14#define raw_local_irq_enable() ({ \
15 unsigned long __dummy; \
16 __asm__ __volatile__ ( \
17 "stosm 0(%1),0x03" \
18 : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \
19 })
20
21#define raw_local_irq_disable() ({ \
22 unsigned long __flags; \
23 __asm__ __volatile__ ( \
24 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
25 __flags; \
26 })
27
28#define raw_local_save_flags(x) \
29 __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) )
30
31#define raw_local_irq_restore(x) \
32 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory")
33
34#define raw_irqs_disabled() \
35({ \
36 unsigned long flags; \
37 local_save_flags(flags); \
38 !((flags >> __FLAG_SHIFT) & 3); \
39})
40
41static inline int raw_irqs_disabled_flags(unsigned long flags)
42{
43 return !((flags >> __FLAG_SHIFT) & 3);
44}
45
46/* For spinlocks etc */
47#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
48
49#endif /* __KERNEL__ */
50#endif /* __ASM_IRQFLAGS_H */
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index e17d181b98a9..596c8b172104 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -98,8 +98,8 @@
98#define __LC_KERNEL_ASCE 0xD58 98#define __LC_KERNEL_ASCE 0xD58
99#define __LC_USER_ASCE 0xD60 99#define __LC_USER_ASCE 0xD60
100#define __LC_PANIC_STACK 0xD68 100#define __LC_PANIC_STACK 0xD68
101#define __LC_CPUID 0xD90 101#define __LC_CPUID 0xD80
102#define __LC_CPUADDR 0xD98 102#define __LC_CPUADDR 0xD88
103#define __LC_IPLDEV 0xDB8 103#define __LC_IPLDEV 0xDB8
104#define __LC_JIFFY_TIMER 0xDC0 104#define __LC_JIFFY_TIMER 0xDC0
105#define __LC_CURRENT 0xDD8 105#define __LC_CURRENT 0xDD8
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 436d216601e5..28b3517e787c 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -40,7 +40,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
40 __typeof__(type) per_cpu__##name 40 __typeof__(type) per_cpu__##name
41 41
42#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) 42#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
43#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
43#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) 44#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
45#define per_cpu_offset(x) (__per_cpu_offset[x])
44 46
45/* A macro to avoid #include hell... */ 47/* A macro to avoid #include hell... */
46#define percpu_modcopy(pcpudst, src, size) \ 48#define percpu_modcopy(pcpudst, src, size) \
@@ -57,6 +59,7 @@ do { \
57 __typeof__(type) per_cpu__##name 59 __typeof__(type) per_cpu__##name
58 60
59#define __get_cpu_var(var) __reloc_hide(var,0) 61#define __get_cpu_var(var) __reloc_hide(var,0)
62#define __raw_get_cpu_var(var) __reloc_hide(var,0)
60#define per_cpu(var,cpu) __reloc_hide(var,0) 63#define per_cpu(var,cpu) __reloc_hide(var,0)
61 64
62#endif /* SMP */ 65#endif /* SMP */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 859b5e969826..24312387fa24 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -657,13 +657,6 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
657 __pte; \ 657 __pte; \
658}) 658})
659 659
660#define SetPageUptodate(_page) \
661 do { \
662 struct page *__page = (_page); \
663 if (!test_and_set_bit(PG_uptodate, &__page->flags)) \
664 page_test_and_clear_dirty(_page); \
665 } while (0)
666
667#ifdef __s390x__ 660#ifdef __s390x__
668 661
669#define pfn_pmd(pfn, pgprot) \ 662#define pfn_pmd(pfn, pgprot) \
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h
index 0422a085dd56..13ec16965150 100644
--- a/include/asm-s390/rwsem.h
+++ b/include/asm-s390/rwsem.h
@@ -61,6 +61,9 @@ struct rw_semaphore {
61 signed long count; 61 signed long count;
62 spinlock_t wait_lock; 62 spinlock_t wait_lock;
63 struct list_head wait_list; 63 struct list_head wait_list;
64#ifdef CONFIG_DEBUG_LOCK_ALLOC
65 struct lockdep_map dep_map;
66#endif
64}; 67};
65 68
66#ifndef __s390x__ 69#ifndef __s390x__
@@ -80,8 +83,16 @@ struct rw_semaphore {
80/* 83/*
81 * initialisation 84 * initialisation
82 */ 85 */
86
87#ifdef CONFIG_DEBUG_LOCK_ALLOC
88# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
89#else
90# define __RWSEM_DEP_MAP_INIT(lockname)
91#endif
92
83#define __RWSEM_INITIALIZER(name) \ 93#define __RWSEM_INITIALIZER(name) \
84{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } 94{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
95 __RWSEM_DEP_MAP_INIT(name) }
85 96
86#define DECLARE_RWSEM(name) \ 97#define DECLARE_RWSEM(name) \
87 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 98 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -93,6 +104,17 @@ static inline void init_rwsem(struct rw_semaphore *sem)
93 INIT_LIST_HEAD(&sem->wait_list); 104 INIT_LIST_HEAD(&sem->wait_list);
94} 105}
95 106
107extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
108 struct lock_class_key *key);
109
110#define init_rwsem(sem) \
111do { \
112 static struct lock_class_key __key; \
113 \
114 __init_rwsem((sem), #sem, &__key); \
115} while (0)
116
117
96/* 118/*
97 * lock for reading 119 * lock for reading
98 */ 120 */
@@ -155,7 +177,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
155/* 177/*
156 * lock for writing 178 * lock for writing
157 */ 179 */
158static inline void __down_write(struct rw_semaphore *sem) 180static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
159{ 181{
160 signed long old, new, tmp; 182 signed long old, new, tmp;
161 183
@@ -181,6 +203,11 @@ static inline void __down_write(struct rw_semaphore *sem)
181 rwsem_down_write_failed(sem); 203 rwsem_down_write_failed(sem);
182} 204}
183 205
206static inline void __down_write(struct rw_semaphore *sem)
207{
208 __down_write_nested(sem, 0);
209}
210
184/* 211/*
185 * trylock for writing -- returns 1 if successful, 0 if contention 212 * trylock for writing -- returns 1 if successful, 0 if contention
186 */ 213 */
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h
index 702cf436698c..32cdc69f39f4 100644
--- a/include/asm-s390/semaphore.h
+++ b/include/asm-s390/semaphore.h
@@ -37,7 +37,8 @@ struct semaphore {
37 37
38static inline void sema_init (struct semaphore *sem, int val) 38static inline void sema_init (struct semaphore *sem, int val)
39{ 39{
40 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val); 40 atomic_set(&sem->count, val);
41 init_waitqueue_head(&sem->wait);
41} 42}
42 43
43static inline void init_MUTEX (struct semaphore *sem) 44static inline void init_MUTEX (struct semaphore *sem)
diff --git a/include/asm-s390/signal.h b/include/asm-s390/signal.h
index 7084626de215..f6cfddb278cb 100644
--- a/include/asm-s390/signal.h
+++ b/include/asm-s390/signal.h
@@ -84,7 +84,6 @@ typedef unsigned long sigset_t;
84 * SA_FLAGS values: 84 * SA_FLAGS values:
85 * 85 *
86 * SA_ONSTACK indicates that a registered stack_t will be used. 86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
88 * SA_RESTART flag to get restarting signals (which were the default long ago) 87 * SA_RESTART flag to get restarting signals (which were the default long ago)
89 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. 88 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
90 * SA_RESETHAND clears the handler when the signal is delivered. 89 * SA_RESETHAND clears the handler when the signal is delivered.
@@ -104,7 +103,6 @@ typedef unsigned long sigset_t;
104 103
105#define SA_NOMASK SA_NODEFER 104#define SA_NOMASK SA_NODEFER
106#define SA_ONESHOT SA_RESETHAND 105#define SA_ONESHOT SA_RESETHAND
107#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
108 106
109#define SA_RESTORER 0x04000000 107#define SA_RESTORER 0x04000000
110 108
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 15a5298c8744..1778a49a74c5 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -56,5 +56,6 @@
56#define SO_ACCEPTCONN 30 56#define SO_ACCEPTCONN 30
57 57
58#define SO_PEERSEC 31 58#define SO_PEERSEC 31
59#define SO_PASSSEC 34
59 60
60#endif /* _ASM_SOCKET_H */ 61#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 71a0732cd518..9ab186ffde23 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -301,34 +301,6 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
301#define set_mb(var, value) do { var = value; mb(); } while (0) 301#define set_mb(var, value) do { var = value; mb(); } while (0)
302#define set_wmb(var, value) do { var = value; wmb(); } while (0) 302#define set_wmb(var, value) do { var = value; wmb(); } while (0)
303 303
304/* interrupt control.. */
305#define local_irq_enable() ({ \
306 unsigned long __dummy; \
307 __asm__ __volatile__ ( \
308 "stosm 0(%1),0x03" \
309 : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \
310 })
311
312#define local_irq_disable() ({ \
313 unsigned long __flags; \
314 __asm__ __volatile__ ( \
315 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
316 __flags; \
317 })
318
319#define local_save_flags(x) \
320 __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) )
321
322#define local_irq_restore(x) \
323 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory")
324
325#define irqs_disabled() \
326({ \
327 unsigned long flags; \
328 local_save_flags(flags); \
329 !((flags >> __FLAG_SHIFT) & 3); \
330})
331
332#ifdef __s390x__ 304#ifdef __s390x__
333 305
334#define __ctl_load(array, low, high) ({ \ 306#define __ctl_load(array, low, high) ({ \
@@ -442,8 +414,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
442 }) 414 })
443#endif /* __s390x__ */ 415#endif /* __s390x__ */
444 416
445/* For spinlocks etc */ 417#include <linux/irqflags.h>
446#define local_irq_save(x) ((x) = local_irq_disable())
447 418
448/* 419/*
449 * Use to set psw mask except for the first byte which 420 * Use to set psw mask except for the first byte which
@@ -482,4 +453,3 @@ extern void (*_machine_power_off)(void);
482#endif /* __KERNEL__ */ 453#endif /* __KERNEL__ */
483 454
484#endif 455#endif
485
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h
index 8e0c7ed73d03..0a518915bf90 100644
--- a/include/asm-s390/thread_info.h
+++ b/include/asm-s390/thread_info.h
@@ -63,6 +63,7 @@ struct thread_info {
63 .exec_domain = &default_exec_domain, \ 63 .exec_domain = &default_exec_domain, \
64 .flags = 0, \ 64 .flags = 0, \
65 .cpu = 0, \ 65 .cpu = 0, \
66 .preempt_count = 1, \
66 .restart_block = { \ 67 .restart_block = { \
67 .fn = do_no_restart_syscall, \ 68 .fn = do_no_restart_syscall, \
68 }, \ 69 }, \
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index e21443d3ea1d..aa7a243862e1 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -394,11 +394,9 @@
394 394
395#ifdef __KERNEL__ 395#ifdef __KERNEL__
396 396
397/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
398
399#define __syscall_return(type, res) \ 397#define __syscall_return(type, res) \
400do { \ 398do { \
401 if ((unsigned long)(res) >= (unsigned long)(-125)) { \ 399 if ((unsigned long)(res) >= (unsigned long)(-4095)) {\
402 errno = -(res); \ 400 errno = -(res); \
403 res = -1; \ 401 res = -1; \
404 } \ 402 } \