aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/s390
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig50
-rw-r--r--arch/s390/Kconfig.debug13
-rw-r--r--arch/s390/Makefile13
-rw-r--r--arch/s390/appldata/appldata_base.c6
-rw-r--r--arch/s390/appldata/appldata_mem.c1
-rw-r--r--arch/s390/appldata/appldata_net_sum.c9
-rw-r--r--arch/s390/boot/Makefile8
-rw-r--r--arch/s390/boot/compressed/Makefile60
-rw-r--r--arch/s390/boot/compressed/head31.S51
-rw-r--r--arch/s390/boot/compressed/head64.S48
-rw-r--r--arch/s390/boot/compressed/misc.c158
-rw-r--r--arch/s390/boot/compressed/vmlinux.lds.S55
-rw-r--r--arch/s390/boot/compressed/vmlinux.scr10
-rw-r--r--arch/s390/crypto/aes_s390.c8
-rw-r--r--arch/s390/crypto/prng.c3
-rw-r--r--arch/s390/crypto/sha_common.c2
-rw-r--r--arch/s390/defconfig130
-rw-r--r--arch/s390/hypfs/hypfs_diag.c9
-rw-r--r--arch/s390/hypfs/hypfs_vm.c2
-rw-r--r--arch/s390/hypfs/inode.c44
-rw-r--r--arch/s390/include/asm/asm-offsets.h1
-rw-r--r--arch/s390/include/asm/atomic.h90
-rw-r--r--arch/s390/include/asm/bitops.h83
-rw-r--r--arch/s390/include/asm/bug.h16
-rw-r--r--arch/s390/include/asm/cacheflush.h1
-rw-r--r--arch/s390/include/asm/ccwdev.h4
-rw-r--r--arch/s390/include/asm/cio.h2
-rw-r--r--arch/s390/include/asm/compat.h3
-rw-r--r--arch/s390/include/asm/cputime.h8
-rw-r--r--arch/s390/include/asm/crw.h1
-rw-r--r--arch/s390/include/asm/elf.h1
-rw-r--r--arch/s390/include/asm/etr.h12
-rw-r--r--arch/s390/include/asm/irqflags.h45
-rw-r--r--arch/s390/include/asm/kvm.h3
-rw-r--r--arch/s390/include/asm/lowcore.h254
-rw-r--r--arch/s390/include/asm/mmu_context.h4
-rw-r--r--arch/s390/include/asm/page.h3
-rw-r--r--arch/s390/include/asm/param.h28
-rw-r--r--arch/s390/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/pgtable.h12
-rw-r--r--arch/s390/include/asm/processor.h18
-rw-r--r--arch/s390/include/asm/ptrace.h16
-rw-r--r--arch/s390/include/asm/qdio.h10
-rw-r--r--arch/s390/include/asm/rwsem.h147
-rw-r--r--arch/s390/include/asm/setup.h24
-rw-r--r--arch/s390/include/asm/sigp.h150
-rw-r--r--arch/s390/include/asm/smp.h90
-rw-r--r--arch/s390/include/asm/socket.h2
-rw-r--r--arch/s390/include/asm/sockios.h21
-rw-r--r--arch/s390/include/asm/spinlock.h113
-rw-r--r--arch/s390/include/asm/spinlock_types.h8
-rw-r--r--arch/s390/include/asm/swab.h16
-rw-r--r--arch/s390/include/asm/syscall.h7
-rw-r--r--arch/s390/include/asm/sysinfo.h3
-rw-r--r--arch/s390/include/asm/system.h177
-rw-r--r--arch/s390/include/asm/termbits.h206
-rw-r--r--arch/s390/include/asm/thread_info.h14
-rw-r--r--arch/s390/include/asm/timex.h22
-rw-r--r--arch/s390/include/asm/todclk.h23
-rw-r--r--arch/s390/include/asm/uaccess.h14
-rw-r--r--arch/s390/include/asm/unistd.h4
-rw-r--r--arch/s390/include/asm/vdso.h3
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/asm-offsets.c100
-rw-r--r--arch/s390/kernel/base.S2
-rw-r--r--arch/s390/kernel/compat_linux.c133
-rw-r--r--arch/s390/kernel/compat_linux.h6
-rw-r--r--arch/s390/kernel/compat_wrapper.S8
-rw-r--r--arch/s390/kernel/debug.c16
-rw-r--r--arch/s390/kernel/dis.c369
-rw-r--r--arch/s390/kernel/early.c25
-rw-r--r--arch/s390/kernel/entry.S10
-rw-r--r--arch/s390/kernel/entry.h10
-rw-r--r--arch/s390/kernel/entry64.S11
-rw-r--r--arch/s390/kernel/ftrace.c75
-rw-r--r--arch/s390/kernel/head.S63
-rw-r--r--arch/s390/kernel/head31.S18
-rw-r--r--arch/s390/kernel/head64.S93
-rw-r--r--arch/s390/kernel/ipl.c48
-rw-r--r--arch/s390/kernel/kprobes.c1
-rw-r--r--arch/s390/kernel/machine_kexec.c10
-rw-r--r--arch/s390/kernel/process.c5
-rw-r--r--arch/s390/kernel/ptrace.c73
-rw-r--r--arch/s390/kernel/reipl.S2
-rw-r--r--arch/s390/kernel/reipl64.S2
-rw-r--r--arch/s390/kernel/s390_ext.c2
-rw-r--r--arch/s390/kernel/sclp.S38
-rw-r--r--arch/s390/kernel/setup.c58
-rw-r--r--arch/s390/kernel/signal.c12
-rw-r--r--arch/s390/kernel/smp.c132
-rw-r--r--arch/s390/kernel/switch_cpu.S58
-rw-r--r--arch/s390/kernel/switch_cpu64.S51
-rw-r--r--arch/s390/kernel/swsusp_asm64.S5
-rw-r--r--arch/s390/kernel/sys_s390.c71
-rw-r--r--arch/s390/kernel/syscalls.S6
-rw-r--r--arch/s390/kernel/sysinfo.c1
-rw-r--r--arch/s390/kernel/time.c76
-rw-r--r--arch/s390/kernel/topology.c5
-rw-r--r--arch/s390/kernel/traps.c6
-rw-r--r--arch/s390/kernel/vdso.c10
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S12
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S6
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S4
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S2
-rw-r--r--arch/s390/kernel/vtime.c2
-rw-r--r--arch/s390/kvm/Kconfig2
-rw-r--r--arch/s390/kvm/diag.c4
-rw-r--r--arch/s390/kvm/intercept.c22
-rw-r--r--arch/s390/kvm/interrupt.c13
-rw-r--r--arch/s390/kvm/kvm-s390.c79
-rw-r--r--arch/s390/kvm/kvm-s390.h10
-rw-r--r--arch/s390/kvm/priv.c3
-rw-r--r--arch/s390/kvm/sigp.c11
-rw-r--r--arch/s390/lib/Makefile1
-rw-r--r--arch/s390/lib/spinlock.c97
-rw-r--r--arch/s390/lib/uaccess_mvcos.c4
-rw-r--r--arch/s390/lib/uaccess_pt.c147
-rw-r--r--arch/s390/lib/usercopy.c8
-rw-r--r--arch/s390/math-emu/math.c4
-rw-r--r--arch/s390/mm/cmm.c75
-rw-r--r--arch/s390/mm/extmem.c12
-rw-r--r--arch/s390/mm/fault.c379
-rw-r--r--arch/s390/mm/init.c34
-rw-r--r--arch/s390/mm/maccess.c26
-rw-r--r--arch/s390/mm/mmap.c4
-rw-r--r--arch/s390/mm/page-states.c1
-rw-r--r--arch/s390/mm/pgtable.c4
-rw-r--r--arch/s390/mm/vmem.c1
128 files changed, 2613 insertions, 2311 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 43c0acad7160..0d8cd9bbe101 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -54,6 +54,9 @@ config GENERIC_BUG
54 depends on BUG 54 depends on BUG
55 default y 55 default y
56 56
57config GENERIC_BUG_RELATIVE_POINTERS
58 def_bool y
59
57config NO_IOMEM 60config NO_IOMEM
58 def_bool y 61 def_bool y
59 62
@@ -87,6 +90,7 @@ config S390
87 select HAVE_SYSCALL_TRACEPOINTS 90 select HAVE_SYSCALL_TRACEPOINTS
88 select HAVE_DYNAMIC_FTRACE 91 select HAVE_DYNAMIC_FTRACE
89 select HAVE_FUNCTION_GRAPH_TRACER 92 select HAVE_FUNCTION_GRAPH_TRACER
93 select HAVE_REGS_AND_STACK_ACCESS_API
90 select HAVE_DEFAULT_NO_SPIN_MUTEXES 94 select HAVE_DEFAULT_NO_SPIN_MUTEXES
91 select HAVE_OPROFILE 95 select HAVE_OPROFILE
92 select HAVE_KPROBES 96 select HAVE_KPROBES
@@ -95,6 +99,37 @@ config S390
95 select HAVE_ARCH_TRACEHOOK 99 select HAVE_ARCH_TRACEHOOK
96 select INIT_ALL_POSSIBLE 100 select INIT_ALL_POSSIBLE
97 select HAVE_PERF_EVENTS 101 select HAVE_PERF_EVENTS
102 select HAVE_KERNEL_GZIP
103 select HAVE_KERNEL_BZIP2
104 select HAVE_KERNEL_LZMA
105 select ARCH_INLINE_SPIN_TRYLOCK
106 select ARCH_INLINE_SPIN_TRYLOCK_BH
107 select ARCH_INLINE_SPIN_LOCK
108 select ARCH_INLINE_SPIN_LOCK_BH
109 select ARCH_INLINE_SPIN_LOCK_IRQ
110 select ARCH_INLINE_SPIN_LOCK_IRQSAVE
111 select ARCH_INLINE_SPIN_UNLOCK
112 select ARCH_INLINE_SPIN_UNLOCK_BH
113 select ARCH_INLINE_SPIN_UNLOCK_IRQ
114 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE
115 select ARCH_INLINE_READ_TRYLOCK
116 select ARCH_INLINE_READ_LOCK
117 select ARCH_INLINE_READ_LOCK_BH
118 select ARCH_INLINE_READ_LOCK_IRQ
119 select ARCH_INLINE_READ_LOCK_IRQSAVE
120 select ARCH_INLINE_READ_UNLOCK
121 select ARCH_INLINE_READ_UNLOCK_BH
122 select ARCH_INLINE_READ_UNLOCK_IRQ
123 select ARCH_INLINE_READ_UNLOCK_IRQRESTORE
124 select ARCH_INLINE_WRITE_TRYLOCK
125 select ARCH_INLINE_WRITE_LOCK
126 select ARCH_INLINE_WRITE_LOCK_BH
127 select ARCH_INLINE_WRITE_LOCK_IRQ
128 select ARCH_INLINE_WRITE_LOCK_IRQSAVE
129 select ARCH_INLINE_WRITE_UNLOCK
130 select ARCH_INLINE_WRITE_UNLOCK_BH
131 select ARCH_INLINE_WRITE_UNLOCK_IRQ
132 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
98 133
99config SCHED_OMIT_FRAME_POINTER 134config SCHED_OMIT_FRAME_POINTER
100 bool 135 bool
@@ -192,23 +227,8 @@ config AUDIT_ARCH
192 bool 227 bool
193 default y 228 default y
194 229
195config S390_SWITCH_AMODE
196 bool "Switch kernel/user addressing modes"
197 help
198 This option allows to switch the addressing modes of kernel and user
199 space. The kernel parameter switch_amode=on will enable this feature,
200 default is disabled. Enabling this (via kernel parameter) on machines
201 earlier than IBM System z9-109 EC/BC will reduce system performance.
202
203 Note that this option will also be selected by selecting the execute
204 protection option below. Enabling the execute protection via the
205 noexec kernel parameter will also switch the addressing modes,
206 independent of the switch_amode kernel parameter.
207
208
209config S390_EXEC_PROTECT 230config S390_EXEC_PROTECT
210 bool "Data execute protection" 231 bool "Data execute protection"
211 select S390_SWITCH_AMODE
212 help 232 help
213 This option allows to enable a buffer overflow protection for user 233 This option allows to enable a buffer overflow protection for user
214 space programs and it also selects the addressing mode option above. 234 space programs and it also selects the addressing mode option above.
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index 2283933a9a93..45e0c6199f36 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -6,4 +6,17 @@ config TRACE_IRQFLAGS_SUPPORT
6 6
7source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
8 8
9config DEBUG_STRICT_USER_COPY_CHECKS
10 bool "Strict user copy size checks"
11 ---help---
12 Enabling this option turns a certain set of sanity checks for user
13 copy operations into compile time warnings.
14
15 The copy_from_user() etc checks are there to help test if there
16 are sufficient security checks on the length argument of
17 the copy operation, by having gcc prove that the argument is
18 within bounds.
19
20 If unsure, or if you run an older (pre 4.4) gcc, say N.
21
9endmenu 22endmenu
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index fc8fb20e7fc0..0da10746e0e5 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -14,6 +14,7 @@
14# 14#
15 15
16ifndef CONFIG_64BIT 16ifndef CONFIG_64BIT
17LD_BFD := elf32-s390
17LDFLAGS := -m elf_s390 18LDFLAGS := -m elf_s390
18KBUILD_CFLAGS += -m31 19KBUILD_CFLAGS += -m31
19KBUILD_AFLAGS += -m31 20KBUILD_AFLAGS += -m31
@@ -21,6 +22,7 @@ UTS_MACHINE := s390
21STACK_SIZE := 8192 22STACK_SIZE := 8192
22CHECKFLAGS += -D__s390__ -msize-long 23CHECKFLAGS += -D__s390__ -msize-long
23else 24else
25LD_BFD := elf64-s390
24LDFLAGS := -m elf64_s390 26LDFLAGS := -m elf64_s390
25MODFLAGS += -fpic -D__PIC__ 27MODFLAGS += -fpic -D__PIC__
26KBUILD_CFLAGS += -m64 28KBUILD_CFLAGS += -m64
@@ -30,6 +32,8 @@ STACK_SIZE := 16384
30CHECKFLAGS += -D__s390__ -D__s390x__ 32CHECKFLAGS += -D__s390__ -D__s390x__
31endif 33endif
32 34
35export LD_BFD
36
33cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5) 37cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5)
34cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900) 38cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
35cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990) 39cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
@@ -85,7 +89,9 @@ KBUILD_AFLAGS += $(aflags-y)
85OBJCOPYFLAGS := -O binary 89OBJCOPYFLAGS := -O binary
86LDFLAGS_vmlinux := -e start 90LDFLAGS_vmlinux := -e start
87 91
88head-y := arch/s390/kernel/head.o arch/s390/kernel/init_task.o 92head-y := arch/s390/kernel/head.o
93head-y += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o)
94head-y += arch/s390/kernel/init_task.o
89 95
90core-y += arch/s390/mm/ arch/s390/kernel/ arch/s390/crypto/ \ 96core-y += arch/s390/mm/ arch/s390/kernel/ arch/s390/crypto/ \
91 arch/s390/appldata/ arch/s390/hypfs/ arch/s390/kvm/ 97 arch/s390/appldata/ arch/s390/hypfs/ arch/s390/kvm/
@@ -99,12 +105,12 @@ drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
99 105
100boot := arch/s390/boot 106boot := arch/s390/boot
101 107
102all: image 108all: image bzImage
103 109
104install: vmlinux 110install: vmlinux
105 $(Q)$(MAKE) $(build)=$(boot) $@ 111 $(Q)$(MAKE) $(build)=$(boot) $@
106 112
107image: vmlinux 113image bzImage: vmlinux
108 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 114 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
109 115
110zfcpdump: 116zfcpdump:
@@ -116,4 +122,5 @@ archclean:
116# Don't use tabs in echo arguments 122# Don't use tabs in echo arguments
117define archhelp 123define archhelp
118 echo '* image - Kernel image for IPL ($(boot)/image)' 124 echo '* image - Kernel image for IPL ($(boot)/image)'
125 echo '* bzImage - Compressed kernel image for IPL ($(boot)/bzImage)'
119endef 126endef
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index b55fd7ed1c31..5c91995b74e4 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -61,12 +61,12 @@ static struct ctl_table appldata_table[] = {
61 { 61 {
62 .procname = "timer", 62 .procname = "timer",
63 .mode = S_IRUGO | S_IWUSR, 63 .mode = S_IRUGO | S_IWUSR,
64 .proc_handler = &appldata_timer_handler, 64 .proc_handler = appldata_timer_handler,
65 }, 65 },
66 { 66 {
67 .procname = "interval", 67 .procname = "interval",
68 .mode = S_IRUGO | S_IWUSR, 68 .mode = S_IRUGO | S_IWUSR,
69 .proc_handler = &appldata_interval_handler, 69 .proc_handler = appldata_interval_handler,
70 }, 70 },
71 { }, 71 { },
72}; 72};
@@ -551,7 +551,7 @@ static int appldata_thaw(struct device *dev)
551 return appldata_restore(dev); 551 return appldata_restore(dev);
552} 552}
553 553
554static struct dev_pm_ops appldata_pm_ops = { 554static const struct dev_pm_ops appldata_pm_ops = {
555 .freeze = appldata_freeze, 555 .freeze = appldata_freeze,
556 .thaw = appldata_thaw, 556 .thaw = appldata_thaw,
557 .restore = appldata_restore, 557 .restore = appldata_restore,
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 4188cbe63a54..e43fe7537031 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/slab.h>
15#include <linux/errno.h> 14#include <linux/errno.h>
16#include <linux/kernel_stat.h> 15#include <linux/kernel_stat.h>
17#include <linux/pagemap.h> 16#include <linux/pagemap.h>
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index fa741f84c5b9..9a9586f4103f 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/slab.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/kernel_stat.h> 16#include <linux/kernel_stat.h>
18#include <linux/netdevice.h> 17#include <linux/netdevice.h>
@@ -83,8 +82,9 @@ static void appldata_get_net_sum_data(void *data)
83 rx_dropped = 0; 82 rx_dropped = 0;
84 tx_dropped = 0; 83 tx_dropped = 0;
85 collisions = 0; 84 collisions = 0;
86 read_lock(&dev_base_lock); 85
87 for_each_netdev(&init_net, dev) { 86 rcu_read_lock();
87 for_each_netdev_rcu(&init_net, dev) {
88 const struct net_device_stats *stats = dev_get_stats(dev); 88 const struct net_device_stats *stats = dev_get_stats(dev);
89 89
90 rx_packets += stats->rx_packets; 90 rx_packets += stats->rx_packets;
@@ -98,7 +98,8 @@ static void appldata_get_net_sum_data(void *data)
98 collisions += stats->collisions; 98 collisions += stats->collisions;
99 i++; 99 i++;
100 } 100 }
101 read_unlock(&dev_base_lock); 101 rcu_read_unlock();
102
102 net_data->nr_interfaces = i; 103 net_data->nr_interfaces = i;
103 net_data->rx_packets = rx_packets; 104 net_data->rx_packets = rx_packets;
104 net_data->tx_packets = tx_packets; 105 net_data->tx_packets = tx_packets;
diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index 4d97eef36b8d..8800cf090694 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -9,10 +9,18 @@ COMPILE_VERSION := __linux_compile_version_id__`hostname | \
9EXTRA_CFLAGS := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I. 9EXTRA_CFLAGS := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I.
10 10
11targets := image 11targets := image
12targets += bzImage
13subdir- := compressed
12 14
13$(obj)/image: vmlinux FORCE 15$(obj)/image: vmlinux FORCE
14 $(call if_changed,objcopy) 16 $(call if_changed,objcopy)
15 17
18$(obj)/bzImage: $(obj)/compressed/vmlinux FORCE
19 $(call if_changed,objcopy)
20
21$(obj)/compressed/vmlinux: FORCE
22 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
23
16install: $(CONFIGURE) $(obj)/image 24install: $(CONFIGURE) $(obj)/image
17 sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/image \ 25 sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/image \
18 System.map Kerntypes "$(INSTALL_PATH)" 26 System.map Kerntypes "$(INSTALL_PATH)"
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
new file mode 100644
index 000000000000..6e4a67ad07e1
--- /dev/null
+++ b/arch/s390/boot/compressed/Makefile
@@ -0,0 +1,60 @@
1#
2# linux/arch/s390/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7BITS := $(if $(CONFIG_64BIT),64,31)
8
9targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
10 vmlinux.bin.lzma misc.o piggy.o sizes.h head$(BITS).o
11
12KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
13KBUILD_CFLAGS += $(cflags-y)
14KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
15KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
16
17GCOV_PROFILE := n
18
19OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o)
20OBJECTS += $(obj)/head$(BITS).o $(obj)/misc.o $(obj)/piggy.o
21
22LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
23$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
24 $(call if_changed,ld)
25 @:
26
27sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 0x\1/p'
28
29quiet_cmd_sizes = GEN $@
30 cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
31
32$(obj)/sizes.h: vmlinux
33 $(call if_changed,sizes)
34
35AFLAGS_head$(BITS).o += -I$(obj)
36$(obj)/head$(BITS).o: $(obj)/sizes.h
37
38CFLAGS_misc.o += -I$(obj)
39$(obj)/misc.o: $(obj)/sizes.h
40
41OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
42$(obj)/vmlinux.bin: vmlinux
43 $(call if_changed,objcopy)
44
45vmlinux.bin.all-y := $(obj)/vmlinux.bin
46
47suffix-$(CONFIG_KERNEL_GZIP) := gz
48suffix-$(CONFIG_KERNEL_BZIP2) := bz2
49suffix-$(CONFIG_KERNEL_LZMA) := lzma
50
51$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
52 $(call if_changed,gzip)
53$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
54 $(call if_changed,bzip2)
55$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
56 $(call if_changed,lzma)
57
58LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
59$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
60 $(call if_changed,ld)
diff --git a/arch/s390/boot/compressed/head31.S b/arch/s390/boot/compressed/head31.S
new file mode 100644
index 000000000000..2a5523a32bcc
--- /dev/null
+++ b/arch/s390/boot/compressed/head31.S
@@ -0,0 +1,51 @@
1/*
2 * Startup glue code to uncompress the kernel
3 *
4 * Copyright IBM Corp. 2010
5 *
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#include <linux/init.h>
10#include <asm/asm-offsets.h>
11#include <asm/thread_info.h>
12#include <asm/page.h>
13#include "sizes.h"
14
15__HEAD
16 .globl startup_continue
17startup_continue:
18 basr %r13,0 # get base
19.LPG1:
20 # setup stack
21 l %r15,.Lstack-.LPG1(%r13)
22 ahi %r15,-96
23 l %r1,.Ldecompress-.LPG1(%r13)
24 basr %r14,%r1
25 # setup registers for memory mover & branch to target
26 lr %r4,%r2
27 l %r2,.Loffset-.LPG1(%r13)
28 la %r4,0(%r2,%r4)
29 l %r3,.Lmvsize-.LPG1(%r13)
30 lr %r5,%r3
31 # move the memory mover someplace safe
32 la %r1,0x200
33 mvc 0(mover_end-mover,%r1),mover-.LPG1(%r13)
34 # decompress image is started at 0x11000
35 lr %r6,%r2
36 br %r1
37mover:
38 mvcle %r2,%r4,0
39 jo mover
40 br %r6
41mover_end:
42
43 .align 8
44.Lstack:
45 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
46.Ldecompress:
47 .long decompress_kernel
48.Loffset:
49 .long 0x11000
50.Lmvsize:
51 .long SZ__bss_start
diff --git a/arch/s390/boot/compressed/head64.S b/arch/s390/boot/compressed/head64.S
new file mode 100644
index 000000000000..2982cb140550
--- /dev/null
+++ b/arch/s390/boot/compressed/head64.S
@@ -0,0 +1,48 @@
1/*
2 * Startup glue code to uncompress the kernel
3 *
4 * Copyright IBM Corp. 2010
5 *
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#include <linux/init.h>
10#include <asm/asm-offsets.h>
11#include <asm/thread_info.h>
12#include <asm/page.h>
13#include "sizes.h"
14
15__HEAD
16 .globl startup_continue
17startup_continue:
18 basr %r13,0 # get base
19.LPG1:
20 # setup stack
21 lg %r15,.Lstack-.LPG1(%r13)
22 aghi %r15,-160
23 brasl %r14,decompress_kernel
24 # setup registers for memory mover & branch to target
25 lgr %r4,%r2
26 lg %r2,.Loffset-.LPG1(%r13)
27 la %r4,0(%r2,%r4)
28 lg %r3,.Lmvsize-.LPG1(%r13)
29 lgr %r5,%r3
30 # move the memory mover someplace safe
31 la %r1,0x200
32 mvc 0(mover_end-mover,%r1),mover-.LPG1(%r13)
33 # decompress image is started at 0x11000
34 lgr %r6,%r2
35 br %r1
36mover:
37 mvcle %r2,%r4,0
38 jo mover
39 br %r6
40mover_end:
41
42 .align 8
43.Lstack:
44 .quad 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
45.Loffset:
46 .quad 0x11000
47.Lmvsize:
48 .quad SZ__bss_start
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
new file mode 100644
index 000000000000..14e0479d3888
--- /dev/null
+++ b/arch/s390/boot/compressed/misc.c
@@ -0,0 +1,158 @@
1/*
2 * Definitions and wrapper functions for kernel decompressor
3 *
4 * Copyright IBM Corp. 2010
5 *
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#include <asm/uaccess.h>
10#include <asm/page.h>
11#include <asm/ipl.h>
12#include "sizes.h"
13
14/*
15 * gzip declarations
16 */
17#define STATIC static
18
19#undef memset
20#undef memcpy
21#undef memmove
22#define memzero(s, n) memset((s), 0, (n))
23
24/* Symbols defined by linker scripts */
25extern char input_data[];
26extern int input_len;
27extern char _text, _end;
28extern char _bss, _ebss;
29
30static void error(char *m);
31
32static unsigned long free_mem_ptr;
33static unsigned long free_mem_end_ptr;
34
35#ifdef CONFIG_HAVE_KERNEL_BZIP2
36#define HEAP_SIZE 0x400000
37#else
38#define HEAP_SIZE 0x10000
39#endif
40
41#ifdef CONFIG_KERNEL_GZIP
42#include "../../../../lib/decompress_inflate.c"
43#endif
44
45#ifdef CONFIG_KERNEL_BZIP2
46#include "../../../../lib/decompress_bunzip2.c"
47#endif
48
49#ifdef CONFIG_KERNEL_LZMA
50#include "../../../../lib/decompress_unlzma.c"
51#endif
52
53extern _sclp_print_early(const char *);
54
55int puts(const char *s)
56{
57 _sclp_print_early(s);
58 return 0;
59}
60
61void *memset(void *s, int c, size_t n)
62{
63 char *xs;
64
65 if (c == 0)
66 return __builtin_memset(s, 0, n);
67
68 xs = (char *) s;
69 if (n > 0)
70 do {
71 *xs++ = c;
72 } while (--n > 0);
73 return s;
74}
75
76void *memcpy(void *__dest, __const void *__src, size_t __n)
77{
78 return __builtin_memcpy(__dest, __src, __n);
79}
80
81void *memmove(void *__dest, __const void *__src, size_t __n)
82{
83 char *d;
84 const char *s;
85
86 if (__dest <= __src)
87 return __builtin_memcpy(__dest, __src, __n);
88 d = __dest + __n;
89 s = __src + __n;
90 while (__n--)
91 *--d = *--s;
92 return __dest;
93}
94
95static void error(char *x)
96{
97 unsigned long long psw = 0x000a0000deadbeefULL;
98
99 puts("\n\n");
100 puts(x);
101 puts("\n\n -- System halted");
102
103 asm volatile("lpsw %0" : : "Q" (psw));
104}
105
106/*
107 * Safe guard the ipl parameter block against a memory area that will be
108 * overwritten. The validity check for the ipl parameter block is complex
109 * (see cio_get_iplinfo and ipl_save_parameters) but if the pointer to
110 * the ipl parameter block intersects with the passed memory area we can
111 * safely assume that we can read from that memory. In that case just copy
112 * the memory to IPL_PARMBLOCK_ORIGIN even if there is no ipl parameter
113 * block.
114 */
115static void check_ipl_parmblock(void *start, unsigned long size)
116{
117 void *src, *dst;
118
119 src = (void *)(unsigned long) S390_lowcore.ipl_parmblock_ptr;
120 if (src + PAGE_SIZE <= start || src >= start + size)
121 return;
122 dst = (void *) IPL_PARMBLOCK_ORIGIN;
123 memmove(dst, src, PAGE_SIZE);
124 S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
125}
126
127unsigned long decompress_kernel(void)
128{
129 unsigned long output_addr;
130 unsigned char *output;
131
132 check_ipl_parmblock((void *) 0, (unsigned long) output + SZ__bss_start);
133 memset(&_bss, 0, &_ebss - &_bss);
134 free_mem_ptr = (unsigned long)&_end;
135 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
136 output = (unsigned char *) ((free_mem_end_ptr + 4095UL) & -4096UL);
137
138#ifdef CONFIG_BLK_DEV_INITRD
139 /*
140 * Move the initrd right behind the end of the decompressed
141 * kernel image.
142 */
143 if (INITRD_START && INITRD_SIZE &&
144 INITRD_START < (unsigned long) output + SZ__bss_start) {
145 check_ipl_parmblock(output + SZ__bss_start,
146 INITRD_START + INITRD_SIZE);
147 memmove(output + SZ__bss_start,
148 (void *) INITRD_START, INITRD_SIZE);
149 INITRD_START = (unsigned long) output + SZ__bss_start;
150 }
151#endif
152
153 puts("Uncompressing Linux... ");
154 decompress(input_data, input_len, NULL, NULL, output, NULL, error);
155 puts("Ok, booting the kernel.\n");
156 return (unsigned long) output;
157}
158
diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S
new file mode 100644
index 000000000000..d80f79d8dd9c
--- /dev/null
+++ b/arch/s390/boot/compressed/vmlinux.lds.S
@@ -0,0 +1,55 @@
1#include <asm-generic/vmlinux.lds.h>
2
3#ifdef CONFIG_64BIT
4OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
5OUTPUT_ARCH(s390:64-bit)
6#else
7OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
8OUTPUT_ARCH(s390)
9#endif
10
11ENTRY(startup)
12
13SECTIONS
14{
15 /* Be careful parts of head_64.S assume startup_32 is at
16 * address 0.
17 */
18 . = 0;
19 .head.text : {
20 _head = . ;
21 HEAD_TEXT
22 _ehead = . ;
23 }
24 .rodata.compressed : {
25 *(.rodata.compressed)
26 }
27 .text : {
28 _text = .; /* Text */
29 *(.text)
30 *(.text.*)
31 _etext = . ;
32 }
33 .rodata : {
34 _rodata = . ;
35 *(.rodata) /* read-only data */
36 *(.rodata.*)
37 _erodata = . ;
38 }
39 .data : {
40 _data = . ;
41 *(.data)
42 *(.data.*)
43 _edata = . ;
44 }
45 . = ALIGN(256);
46 .bss : {
47 _bss = . ;
48 *(.bss)
49 *(.bss.*)
50 *(COMMON)
51 . = ALIGN(8); /* For convenience during zeroing */
52 _ebss = .;
53 }
54 _end = .;
55}
diff --git a/arch/s390/boot/compressed/vmlinux.scr b/arch/s390/boot/compressed/vmlinux.scr
new file mode 100644
index 000000000000..f02382ae5c48
--- /dev/null
+++ b/arch/s390/boot/compressed/vmlinux.scr
@@ -0,0 +1,10 @@
1SECTIONS
2{
3 .rodata.compressed : {
4 input_len = .;
5 LONG(input_data_end - input_data) input_data = .;
6 *(.data)
7 output_len = . - 4;
8 input_data_end = .;
9 }
10}
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 6118890c946d..58f46734465f 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -78,14 +78,14 @@ static int setkey_fallback_cip(struct crypto_tfm *tfm, const u8 *in_key,
78 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); 78 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
79 int ret; 79 int ret;
80 80
81 sctx->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; 81 sctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
82 sctx->fallback.blk->base.crt_flags |= (tfm->crt_flags & 82 sctx->fallback.cip->base.crt_flags |= (tfm->crt_flags &
83 CRYPTO_TFM_REQ_MASK); 83 CRYPTO_TFM_REQ_MASK);
84 84
85 ret = crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len); 85 ret = crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len);
86 if (ret) { 86 if (ret) {
87 tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; 87 tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK;
88 tfm->crt_flags |= (sctx->fallback.blk->base.crt_flags & 88 tfm->crt_flags |= (sctx->fallback.cip->base.crt_flags &
89 CRYPTO_TFM_RES_MASK); 89 CRYPTO_TFM_RES_MASK);
90 } 90 }
91 return ret; 91 return ret;
@@ -174,7 +174,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
174 if (IS_ERR(sctx->fallback.cip)) { 174 if (IS_ERR(sctx->fallback.cip)) {
175 pr_err("Allocating AES fallback algorithm %s failed\n", 175 pr_err("Allocating AES fallback algorithm %s failed\n",
176 name); 176 name);
177 return PTR_ERR(sctx->fallback.blk); 177 return PTR_ERR(sctx->fallback.cip);
178 } 178 }
179 179
180 return 0; 180 return 0;
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index b49c00ce65e9..aa819dac2360 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -6,11 +6,11 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/smp_lock.h>
10#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
11#include <linux/module.h> 10#include <linux/module.h>
12#include <linux/moduleparam.h> 11#include <linux/moduleparam.h>
13#include <linux/random.h> 12#include <linux/random.h>
13#include <linux/slab.h>
14#include <asm/debug.h> 14#include <asm/debug.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16 16
@@ -49,7 +49,6 @@ static unsigned char parm_block[32] = {
49 49
50static int prng_open(struct inode *inode, struct file *file) 50static int prng_open(struct inode *inode, struct file *file)
51{ 51{
52 cycle_kernel_lock();
53 return nonseekable_open(inode, file); 52 return nonseekable_open(inode, file);
54} 53}
55 54
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c
index 7903ec47e6b9..f42dbabc0d30 100644
--- a/arch/s390/crypto/sha_common.c
+++ b/arch/s390/crypto/sha_common.c
@@ -79,7 +79,7 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)
79 memset(ctx->buf + index, 0x00, end - index - 8); 79 memset(ctx->buf + index, 0x00, end - index - 8);
80 80
81 /* 81 /*
82 * Append message length. Well, SHA-512 wants a 128 bit lenght value, 82 * Append message length. Well, SHA-512 wants a 128 bit length value,
83 * nevertheless we use u64, should be enough for now... 83 * nevertheless we use u64, should be enough for now...
84 */ 84 */
85 bits = ctx->count * 8; 85 bits = ctx->count * 8;
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index ab4464486b7a..bcd6884985ad 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31 3# Linux kernel version: 2.6.34-rc3
4# Tue Sep 22 17:43:13 2009 4# Fri Apr 9 09:57:10 2010
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -17,6 +17,7 @@ CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_TIME_VSYSCALL=y 17CONFIG_GENERIC_TIME_VSYSCALL=y
18CONFIG_GENERIC_CLOCKEVENTS=y 18CONFIG_GENERIC_CLOCKEVENTS=y
19CONFIG_GENERIC_BUG=y 19CONFIG_GENERIC_BUG=y
20CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
20CONFIG_NO_IOMEM=y 21CONFIG_NO_IOMEM=y
21CONFIG_NO_DMA=y 22CONFIG_NO_DMA=y
22CONFIG_GENERIC_LOCKBREAK=y 23CONFIG_GENERIC_LOCKBREAK=y
@@ -36,6 +37,13 @@ CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32 37CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION="" 38CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y 39CONFIG_LOCALVERSION_AUTO=y
40CONFIG_HAVE_KERNEL_GZIP=y
41CONFIG_HAVE_KERNEL_BZIP2=y
42CONFIG_HAVE_KERNEL_LZMA=y
43CONFIG_KERNEL_GZIP=y
44# CONFIG_KERNEL_BZIP2 is not set
45# CONFIG_KERNEL_LZMA is not set
46# CONFIG_KERNEL_LZO is not set
39CONFIG_SWAP=y 47CONFIG_SWAP=y
40CONFIG_SYSVIPC=y 48CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y 49CONFIG_SYSVIPC_SYSCTL=y
@@ -51,18 +59,15 @@ CONFIG_AUDIT=y
51# 59#
52CONFIG_TREE_RCU=y 60CONFIG_TREE_RCU=y
53# CONFIG_TREE_PREEMPT_RCU is not set 61# CONFIG_TREE_PREEMPT_RCU is not set
62# CONFIG_TINY_RCU is not set
54# CONFIG_RCU_TRACE is not set 63# CONFIG_RCU_TRACE is not set
55CONFIG_RCU_FANOUT=64 64CONFIG_RCU_FANOUT=64
56# CONFIG_RCU_FANOUT_EXACT is not set 65# CONFIG_RCU_FANOUT_EXACT is not set
66# CONFIG_RCU_FAST_NO_HZ is not set
57# CONFIG_TREE_RCU_TRACE is not set 67# CONFIG_TREE_RCU_TRACE is not set
58CONFIG_IKCONFIG=y 68CONFIG_IKCONFIG=y
59CONFIG_IKCONFIG_PROC=y 69CONFIG_IKCONFIG_PROC=y
60CONFIG_LOG_BUF_SHIFT=17 70CONFIG_LOG_BUF_SHIFT=17
61CONFIG_GROUP_SCHED=y
62CONFIG_FAIR_GROUP_SCHED=y
63# CONFIG_RT_GROUP_SCHED is not set
64CONFIG_USER_SCHED=y
65# CONFIG_CGROUP_SCHED is not set
66CONFIG_CGROUPS=y 71CONFIG_CGROUPS=y
67# CONFIG_CGROUP_DEBUG is not set 72# CONFIG_CGROUP_DEBUG is not set
68CONFIG_CGROUP_NS=y 73CONFIG_CGROUP_NS=y
@@ -71,6 +76,7 @@ CONFIG_CGROUP_NS=y
71# CONFIG_CPUSETS is not set 76# CONFIG_CPUSETS is not set
72# CONFIG_CGROUP_CPUACCT is not set 77# CONFIG_CGROUP_CPUACCT is not set
73# CONFIG_RESOURCE_COUNTERS is not set 78# CONFIG_RESOURCE_COUNTERS is not set
79# CONFIG_CGROUP_SCHED is not set
74CONFIG_SYSFS_DEPRECATED=y 80CONFIG_SYSFS_DEPRECATED=y
75CONFIG_SYSFS_DEPRECATED_V2=y 81CONFIG_SYSFS_DEPRECATED_V2=y
76# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
@@ -85,6 +91,7 @@ CONFIG_INITRAMFS_SOURCE=""
85CONFIG_RD_GZIP=y 91CONFIG_RD_GZIP=y
86CONFIG_RD_BZIP2=y 92CONFIG_RD_BZIP2=y
87CONFIG_RD_LZMA=y 93CONFIG_RD_LZMA=y
94CONFIG_RD_LZO=y
88# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 95# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
89CONFIG_SYSCTL=y 96CONFIG_SYSCTL=y
90CONFIG_ANON_INODES=y 97CONFIG_ANON_INODES=y
@@ -113,12 +120,12 @@ CONFIG_HAVE_PERF_EVENTS=y
113# CONFIG_PERF_EVENTS is not set 120# CONFIG_PERF_EVENTS is not set
114# CONFIG_PERF_COUNTERS is not set 121# CONFIG_PERF_COUNTERS is not set
115CONFIG_VM_EVENT_COUNTERS=y 122CONFIG_VM_EVENT_COUNTERS=y
116# CONFIG_STRIP_ASM_SYMS is not set
117# CONFIG_COMPAT_BRK is not set 123# CONFIG_COMPAT_BRK is not set
118CONFIG_SLAB=y 124CONFIG_SLAB=y
119# CONFIG_SLUB is not set 125# CONFIG_SLUB is not set
120# CONFIG_SLOB is not set 126# CONFIG_SLOB is not set
121# CONFIG_PROFILING is not set 127# CONFIG_PROFILING is not set
128CONFIG_TRACEPOINTS=y
122CONFIG_HAVE_OPROFILE=y 129CONFIG_HAVE_OPROFILE=y
123CONFIG_KPROBES=y 130CONFIG_KPROBES=y
124CONFIG_HAVE_SYSCALL_WRAPPERS=y 131CONFIG_HAVE_SYSCALL_WRAPPERS=y
@@ -127,6 +134,7 @@ CONFIG_HAVE_KPROBES=y
127CONFIG_HAVE_KRETPROBES=y 134CONFIG_HAVE_KRETPROBES=y
128CONFIG_HAVE_ARCH_TRACEHOOK=y 135CONFIG_HAVE_ARCH_TRACEHOOK=y
129CONFIG_USE_GENERIC_SMP_HELPERS=y 136CONFIG_USE_GENERIC_SMP_HELPERS=y
137CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
130CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES=y 138CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES=y
131 139
132# 140#
@@ -149,21 +157,78 @@ CONFIG_STOP_MACHINE=y
149CONFIG_BLOCK=y 157CONFIG_BLOCK=y
150CONFIG_BLK_DEV_BSG=y 158CONFIG_BLK_DEV_BSG=y
151# CONFIG_BLK_DEV_INTEGRITY is not set 159# CONFIG_BLK_DEV_INTEGRITY is not set
160# CONFIG_BLK_CGROUP is not set
152CONFIG_BLOCK_COMPAT=y 161CONFIG_BLOCK_COMPAT=y
153 162
154# 163#
155# IO Schedulers 164# IO Schedulers
156# 165#
157CONFIG_IOSCHED_NOOP=y 166CONFIG_IOSCHED_NOOP=y
158CONFIG_IOSCHED_AS=y
159CONFIG_IOSCHED_DEADLINE=y 167CONFIG_IOSCHED_DEADLINE=y
160CONFIG_IOSCHED_CFQ=y 168CONFIG_IOSCHED_CFQ=y
161# CONFIG_DEFAULT_AS is not set 169# CONFIG_CFQ_GROUP_IOSCHED is not set
162CONFIG_DEFAULT_DEADLINE=y 170CONFIG_DEFAULT_DEADLINE=y
163# CONFIG_DEFAULT_CFQ is not set 171# CONFIG_DEFAULT_CFQ is not set
164# CONFIG_DEFAULT_NOOP is not set 172# CONFIG_DEFAULT_NOOP is not set
165CONFIG_DEFAULT_IOSCHED="deadline" 173CONFIG_DEFAULT_IOSCHED="deadline"
166CONFIG_PREEMPT_NOTIFIERS=y 174CONFIG_PREEMPT_NOTIFIERS=y
175CONFIG_ARCH_INLINE_SPIN_TRYLOCK=y
176CONFIG_ARCH_INLINE_SPIN_TRYLOCK_BH=y
177CONFIG_ARCH_INLINE_SPIN_LOCK=y
178CONFIG_ARCH_INLINE_SPIN_LOCK_BH=y
179CONFIG_ARCH_INLINE_SPIN_LOCK_IRQ=y
180CONFIG_ARCH_INLINE_SPIN_LOCK_IRQSAVE=y
181CONFIG_ARCH_INLINE_SPIN_UNLOCK=y
182CONFIG_ARCH_INLINE_SPIN_UNLOCK_BH=y
183CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQ=y
184CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE=y
185CONFIG_ARCH_INLINE_READ_TRYLOCK=y
186CONFIG_ARCH_INLINE_READ_LOCK=y
187CONFIG_ARCH_INLINE_READ_LOCK_BH=y
188CONFIG_ARCH_INLINE_READ_LOCK_IRQ=y
189CONFIG_ARCH_INLINE_READ_LOCK_IRQSAVE=y
190CONFIG_ARCH_INLINE_READ_UNLOCK=y
191CONFIG_ARCH_INLINE_READ_UNLOCK_BH=y
192CONFIG_ARCH_INLINE_READ_UNLOCK_IRQ=y
193CONFIG_ARCH_INLINE_READ_UNLOCK_IRQRESTORE=y
194CONFIG_ARCH_INLINE_WRITE_TRYLOCK=y
195CONFIG_ARCH_INLINE_WRITE_LOCK=y
196CONFIG_ARCH_INLINE_WRITE_LOCK_BH=y
197CONFIG_ARCH_INLINE_WRITE_LOCK_IRQ=y
198CONFIG_ARCH_INLINE_WRITE_LOCK_IRQSAVE=y
199CONFIG_ARCH_INLINE_WRITE_UNLOCK=y
200CONFIG_ARCH_INLINE_WRITE_UNLOCK_BH=y
201CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQ=y
202CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE=y
203# CONFIG_INLINE_SPIN_TRYLOCK is not set
204# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
205# CONFIG_INLINE_SPIN_LOCK is not set
206# CONFIG_INLINE_SPIN_LOCK_BH is not set
207# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
208# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
209# CONFIG_INLINE_SPIN_UNLOCK is not set
210# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
211# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
212# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
213# CONFIG_INLINE_READ_TRYLOCK is not set
214# CONFIG_INLINE_READ_LOCK is not set
215# CONFIG_INLINE_READ_LOCK_BH is not set
216# CONFIG_INLINE_READ_LOCK_IRQ is not set
217# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
218# CONFIG_INLINE_READ_UNLOCK is not set
219# CONFIG_INLINE_READ_UNLOCK_BH is not set
220# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
221# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
222# CONFIG_INLINE_WRITE_TRYLOCK is not set
223# CONFIG_INLINE_WRITE_LOCK is not set
224# CONFIG_INLINE_WRITE_LOCK_BH is not set
225# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
226# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
227# CONFIG_INLINE_WRITE_UNLOCK is not set
228# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
229# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
230# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
231# CONFIG_MUTEX_SPIN_ON_OWNER is not set
167CONFIG_FREEZER=y 232CONFIG_FREEZER=y
168 233
169# 234#
@@ -182,10 +247,10 @@ CONFIG_64BIT=y
182CONFIG_SMP=y 247CONFIG_SMP=y
183CONFIG_NR_CPUS=32 248CONFIG_NR_CPUS=32
184CONFIG_HOTPLUG_CPU=y 249CONFIG_HOTPLUG_CPU=y
250# CONFIG_SCHED_BOOK is not set
185CONFIG_COMPAT=y 251CONFIG_COMPAT=y
186CONFIG_SYSVIPC_COMPAT=y 252CONFIG_SYSVIPC_COMPAT=y
187CONFIG_AUDIT_ARCH=y 253CONFIG_AUDIT_ARCH=y
188CONFIG_S390_SWITCH_AMODE=y
189CONFIG_S390_EXEC_PROTECT=y 254CONFIG_S390_EXEC_PROTECT=y
190 255
191# 256#
@@ -228,14 +293,13 @@ CONFIG_MEMORY_HOTPLUG=y
228CONFIG_MEMORY_HOTPLUG_SPARSE=y 293CONFIG_MEMORY_HOTPLUG_SPARSE=y
229CONFIG_MEMORY_HOTREMOVE=y 294CONFIG_MEMORY_HOTREMOVE=y
230CONFIG_PAGEFLAGS_EXTENDED=y 295CONFIG_PAGEFLAGS_EXTENDED=y
231CONFIG_SPLIT_PTLOCK_CPUS=4 296CONFIG_SPLIT_PTLOCK_CPUS=999999
232CONFIG_MIGRATION=y 297CONFIG_MIGRATION=y
233CONFIG_PHYS_ADDR_T_64BIT=y 298CONFIG_PHYS_ADDR_T_64BIT=y
234CONFIG_ZONE_DMA_FLAG=1 299CONFIG_ZONE_DMA_FLAG=1
235CONFIG_BOUNCE=y 300CONFIG_BOUNCE=y
236CONFIG_VIRT_TO_BUS=y 301CONFIG_VIRT_TO_BUS=y
237CONFIG_HAVE_MLOCK=y 302# CONFIG_KSM is not set
238CONFIG_HAVE_MLOCKED_PAGE_BIT=y
239CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 303CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
240 304
241# 305#
@@ -283,13 +347,13 @@ CONFIG_PM_SLEEP=y
283CONFIG_HIBERNATION=y 347CONFIG_HIBERNATION=y
284CONFIG_PM_STD_PARTITION="" 348CONFIG_PM_STD_PARTITION=""
285# CONFIG_PM_RUNTIME is not set 349# CONFIG_PM_RUNTIME is not set
350CONFIG_PM_OPS=y
286CONFIG_NET=y 351CONFIG_NET=y
287 352
288# 353#
289# Networking options 354# Networking options
290# 355#
291CONFIG_PACKET=y 356CONFIG_PACKET=y
292# CONFIG_PACKET_MMAP is not set
293CONFIG_UNIX=y 357CONFIG_UNIX=y
294CONFIG_XFRM=y 358CONFIG_XFRM=y
295# CONFIG_XFRM_USER is not set 359# CONFIG_XFRM_USER is not set
@@ -340,6 +404,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
340CONFIG_INET6_XFRM_MODE_BEET=y 404CONFIG_INET6_XFRM_MODE_BEET=y
341# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 405# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
342CONFIG_IPV6_SIT=y 406CONFIG_IPV6_SIT=y
407# CONFIG_IPV6_SIT_6RD is not set
343CONFIG_IPV6_NDISC_NODETYPE=y 408CONFIG_IPV6_NDISC_NODETYPE=y
344# CONFIG_IPV6_TUNNEL is not set 409# CONFIG_IPV6_TUNNEL is not set
345# CONFIG_IPV6_MULTIPLE_TABLES is not set 410# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -466,6 +531,7 @@ CONFIG_NET_SCH_FIFO=y
466# 531#
467# CONFIG_NET_PKTGEN is not set 532# CONFIG_NET_PKTGEN is not set
468# CONFIG_NET_TCPPROBE is not set 533# CONFIG_NET_TCPPROBE is not set
534# CONFIG_NET_DROP_MONITOR is not set
469CONFIG_CAN=m 535CONFIG_CAN=m
470CONFIG_CAN_RAW=m 536CONFIG_CAN_RAW=m
471CONFIG_CAN_BCM=m 537CONFIG_CAN_BCM=m
@@ -505,6 +571,10 @@ CONFIG_BLK_DEV=y
505# CONFIG_BLK_DEV_COW_COMMON is not set 571# CONFIG_BLK_DEV_COW_COMMON is not set
506CONFIG_BLK_DEV_LOOP=m 572CONFIG_BLK_DEV_LOOP=m
507# CONFIG_BLK_DEV_CRYPTOLOOP is not set 573# CONFIG_BLK_DEV_CRYPTOLOOP is not set
574
575#
576# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
577#
508CONFIG_BLK_DEV_NBD=m 578CONFIG_BLK_DEV_NBD=m
509# CONFIG_BLK_DEV_OSD is not set 579# CONFIG_BLK_DEV_OSD is not set
510CONFIG_BLK_DEV_RAM=y 580CONFIG_BLK_DEV_RAM=y
@@ -538,6 +608,7 @@ CONFIG_MISC_DEVICES=y
538# 608#
539# SCSI device support 609# SCSI device support
540# 610#
611CONFIG_SCSI_MOD=y
541# CONFIG_RAID_ATTRS is not set 612# CONFIG_RAID_ATTRS is not set
542CONFIG_SCSI=y 613CONFIG_SCSI=y
543# CONFIG_SCSI_DMA is not set 614# CONFIG_SCSI_DMA is not set
@@ -711,7 +782,6 @@ CONFIG_S390_VMUR=m
711# CONFIG_PPS is not set 782# CONFIG_PPS is not set
712# CONFIG_POWER_SUPPLY is not set 783# CONFIG_POWER_SUPPLY is not set
713# CONFIG_THERMAL is not set 784# CONFIG_THERMAL is not set
714# CONFIG_THERMAL_HWMON is not set
715# CONFIG_WATCHDOG is not set 785# CONFIG_WATCHDOG is not set
716# CONFIG_REGULATOR is not set 786# CONFIG_REGULATOR is not set
717# CONFIG_MEMSTICK is not set 787# CONFIG_MEMSTICK is not set
@@ -797,6 +867,7 @@ CONFIG_MISC_FILESYSTEMS=y
797# CONFIG_BEFS_FS is not set 867# CONFIG_BEFS_FS is not set
798# CONFIG_BFS_FS is not set 868# CONFIG_BFS_FS is not set
799# CONFIG_EFS_FS is not set 869# CONFIG_EFS_FS is not set
870# CONFIG_LOGFS is not set
800# CONFIG_CRAMFS is not set 871# CONFIG_CRAMFS is not set
801# CONFIG_SQUASHFS is not set 872# CONFIG_SQUASHFS is not set
802# CONFIG_VXFS_FS is not set 873# CONFIG_VXFS_FS is not set
@@ -825,6 +896,7 @@ CONFIG_SUNRPC=y
825# CONFIG_RPCSEC_GSS_KRB5 is not set 896# CONFIG_RPCSEC_GSS_KRB5 is not set
826# CONFIG_RPCSEC_GSS_SPKM3 is not set 897# CONFIG_RPCSEC_GSS_SPKM3 is not set
827# CONFIG_SMB_FS is not set 898# CONFIG_SMB_FS is not set
899# CONFIG_CEPH_FS is not set
828# CONFIG_CIFS is not set 900# CONFIG_CIFS is not set
829# CONFIG_NCP_FS is not set 901# CONFIG_NCP_FS is not set
830# CONFIG_CODA_FS is not set 902# CONFIG_CODA_FS is not set
@@ -865,6 +937,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
865CONFIG_ENABLE_MUST_CHECK=y 937CONFIG_ENABLE_MUST_CHECK=y
866CONFIG_FRAME_WARN=2048 938CONFIG_FRAME_WARN=2048
867CONFIG_MAGIC_SYSRQ=y 939CONFIG_MAGIC_SYSRQ=y
940# CONFIG_STRIP_ASM_SYMS is not set
868# CONFIG_UNUSED_SYMBOLS is not set 941# CONFIG_UNUSED_SYMBOLS is not set
869CONFIG_DEBUG_FS=y 942CONFIG_DEBUG_FS=y
870# CONFIG_HEADERS_CHECK is not set 943# CONFIG_HEADERS_CHECK is not set
@@ -885,6 +958,7 @@ CONFIG_DEBUG_MUTEXES=y
885# CONFIG_LOCK_STAT is not set 958# CONFIG_LOCK_STAT is not set
886CONFIG_DEBUG_SPINLOCK_SLEEP=y 959CONFIG_DEBUG_SPINLOCK_SLEEP=y
887# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 960# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
961CONFIG_STACKTRACE=y
888# CONFIG_DEBUG_KOBJECT is not set 962# CONFIG_DEBUG_KOBJECT is not set
889CONFIG_DEBUG_BUGVERBOSE=y 963CONFIG_DEBUG_BUGVERBOSE=y
890# CONFIG_DEBUG_INFO is not set 964# CONFIG_DEBUG_INFO is not set
@@ -906,12 +980,17 @@ CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
906# CONFIG_LATENCYTOP is not set 980# CONFIG_LATENCYTOP is not set
907CONFIG_SYSCTL_SYSCALL_CHECK=y 981CONFIG_SYSCTL_SYSCALL_CHECK=y
908# CONFIG_DEBUG_PAGEALLOC is not set 982# CONFIG_DEBUG_PAGEALLOC is not set
983CONFIG_NOP_TRACER=y
909CONFIG_HAVE_FUNCTION_TRACER=y 984CONFIG_HAVE_FUNCTION_TRACER=y
910CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 985CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
911CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 986CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
912CONFIG_HAVE_DYNAMIC_FTRACE=y 987CONFIG_HAVE_DYNAMIC_FTRACE=y
913CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 988CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
914CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 989CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
990CONFIG_RING_BUFFER=y
991CONFIG_EVENT_TRACING=y
992CONFIG_CONTEXT_SWITCH_TRACER=y
993CONFIG_TRACING=y
915CONFIG_TRACING_SUPPORT=y 994CONFIG_TRACING_SUPPORT=y
916CONFIG_FTRACE=y 995CONFIG_FTRACE=y
917# CONFIG_FUNCTION_TRACER is not set 996# CONFIG_FUNCTION_TRACER is not set
@@ -928,11 +1007,15 @@ CONFIG_BRANCH_PROFILE_NONE=y
928# CONFIG_KMEMTRACE is not set 1007# CONFIG_KMEMTRACE is not set
929# CONFIG_WORKQUEUE_TRACER is not set 1008# CONFIG_WORKQUEUE_TRACER is not set
930# CONFIG_BLK_DEV_IO_TRACE is not set 1009# CONFIG_BLK_DEV_IO_TRACE is not set
1010CONFIG_KPROBE_EVENT=y
1011# CONFIG_RING_BUFFER_BENCHMARK is not set
931# CONFIG_DYNAMIC_DEBUG is not set 1012# CONFIG_DYNAMIC_DEBUG is not set
932CONFIG_SAMPLES=y 1013CONFIG_SAMPLES=y
1014# CONFIG_SAMPLE_TRACEPOINTS is not set
1015# CONFIG_SAMPLE_TRACE_EVENTS is not set
933# CONFIG_SAMPLE_KOBJECT is not set 1016# CONFIG_SAMPLE_KOBJECT is not set
934# CONFIG_SAMPLE_KPROBES is not set 1017# CONFIG_SAMPLE_KPROBES is not set
935# CONFIG_KMEMCHECK is not set 1018# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
936 1019
937# 1020#
938# Security options 1021# Security options
@@ -940,7 +1023,11 @@ CONFIG_SAMPLES=y
940# CONFIG_KEYS is not set 1023# CONFIG_KEYS is not set
941# CONFIG_SECURITY is not set 1024# CONFIG_SECURITY is not set
942# CONFIG_SECURITYFS is not set 1025# CONFIG_SECURITYFS is not set
943# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1026# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1027# CONFIG_DEFAULT_SECURITY_SMACK is not set
1028# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1029CONFIG_DEFAULT_SECURITY_DAC=y
1030CONFIG_DEFAULT_SECURITY=""
944CONFIG_CRYPTO=y 1031CONFIG_CRYPTO=y
945 1032
946# 1033#
@@ -962,6 +1049,7 @@ CONFIG_CRYPTO_MANAGER=y
962CONFIG_CRYPTO_MANAGER2=y 1049CONFIG_CRYPTO_MANAGER2=y
963CONFIG_CRYPTO_GF128MUL=m 1050CONFIG_CRYPTO_GF128MUL=m
964# CONFIG_CRYPTO_NULL is not set 1051# CONFIG_CRYPTO_NULL is not set
1052# CONFIG_CRYPTO_PCRYPT is not set
965CONFIG_CRYPTO_WORKQUEUE=y 1053CONFIG_CRYPTO_WORKQUEUE=y
966# CONFIG_CRYPTO_CRYPTD is not set 1054# CONFIG_CRYPTO_CRYPTD is not set
967CONFIG_CRYPTO_AUTHENC=m 1055CONFIG_CRYPTO_AUTHENC=m
@@ -1049,7 +1137,7 @@ CONFIG_CRYPTO_SHA512_S390=m
1049# CONFIG_CRYPTO_DES_S390 is not set 1137# CONFIG_CRYPTO_DES_S390 is not set
1050# CONFIG_CRYPTO_AES_S390 is not set 1138# CONFIG_CRYPTO_AES_S390 is not set
1051CONFIG_S390_PRNG=m 1139CONFIG_S390_PRNG=m
1052# CONFIG_BINARY_PRINTF is not set 1140CONFIG_BINARY_PRINTF=y
1053 1141
1054# 1142#
1055# Library routines 1143# Library routines
@@ -1066,14 +1154,16 @@ CONFIG_LIBCRC32C=m
1066CONFIG_ZLIB_INFLATE=y 1154CONFIG_ZLIB_INFLATE=y
1067CONFIG_ZLIB_DEFLATE=m 1155CONFIG_ZLIB_DEFLATE=m
1068CONFIG_LZO_COMPRESS=m 1156CONFIG_LZO_COMPRESS=m
1069CONFIG_LZO_DECOMPRESS=m 1157CONFIG_LZO_DECOMPRESS=y
1070CONFIG_DECOMPRESS_GZIP=y 1158CONFIG_DECOMPRESS_GZIP=y
1071CONFIG_DECOMPRESS_BZIP2=y 1159CONFIG_DECOMPRESS_BZIP2=y
1072CONFIG_DECOMPRESS_LZMA=y 1160CONFIG_DECOMPRESS_LZMA=y
1161CONFIG_DECOMPRESS_LZO=y
1073CONFIG_NLATTR=y 1162CONFIG_NLATTR=y
1074CONFIG_HAVE_KVM=y 1163CONFIG_HAVE_KVM=y
1075CONFIG_VIRTUALIZATION=y 1164CONFIG_VIRTUALIZATION=y
1076CONFIG_KVM=m 1165CONFIG_KVM=m
1166# CONFIG_VHOST_NET is not set
1077CONFIG_VIRTIO=y 1167CONFIG_VIRTIO=y
1078CONFIG_VIRTIO_RING=y 1168CONFIG_VIRTIO_RING=y
1079CONFIG_VIRTIO_BALLOON=m 1169CONFIG_VIRTIO_BALLOON=m
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 77df726180ba..5b1acdba6495 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/gfp.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/vmalloc.h> 17#include <linux/vmalloc.h>
@@ -164,7 +163,7 @@ static inline void part_hdr__part_name(enum diag204_format type, void *hdr,
164 LPAR_NAME_LEN); 163 LPAR_NAME_LEN);
165 EBCASC(name, LPAR_NAME_LEN); 164 EBCASC(name, LPAR_NAME_LEN);
166 name[LPAR_NAME_LEN] = 0; 165 name[LPAR_NAME_LEN] = 0;
167 strstrip(name); 166 strim(name);
168} 167}
169 168
170struct cpu_info { 169struct cpu_info {
@@ -488,7 +487,7 @@ out:
488 487
489static int diag224(void *ptr) 488static int diag224(void *ptr)
490{ 489{
491 int rc = -ENOTSUPP; 490 int rc = -EOPNOTSUPP;
492 491
493 asm volatile( 492 asm volatile(
494 " diag %1,%2,0x224\n" 493 " diag %1,%2,0x224\n"
@@ -507,7 +506,7 @@ static int diag224_get_name_table(void)
507 return -ENOMEM; 506 return -ENOMEM;
508 if (diag224(diag224_cpu_names)) { 507 if (diag224(diag224_cpu_names)) {
509 kfree(diag224_cpu_names); 508 kfree(diag224_cpu_names);
510 return -ENOTSUPP; 509 return -EOPNOTSUPP;
511 } 510 }
512 EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); 511 EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
513 return 0; 512 return 0;
@@ -523,7 +522,7 @@ static int diag224_idx2name(int index, char *name)
523 memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN), 522 memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN),
524 CPU_NAME_LEN); 523 CPU_NAME_LEN);
525 name[CPU_NAME_LEN] = 0; 524 name[CPU_NAME_LEN] = 0;
526 strstrip(name); 525 strim(name);
527 return 0; 526 return 0;
528} 527}
529 528
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index d01fc8f799f0..f0b0d31f0b48 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -124,7 +124,7 @@ static int hpyfs_vm_create_guest(struct super_block *sb,
124 /* guest dir */ 124 /* guest dir */
125 memcpy(guest_name, data->guest_name, NAME_LEN); 125 memcpy(guest_name, data->guest_name, NAME_LEN);
126 EBCASC(guest_name, NAME_LEN); 126 EBCASC(guest_name, NAME_LEN);
127 strstrip(guest_name); 127 strim(guest_name);
128 guest_dir = hypfs_mkdir(sb, systems_dir, guest_name); 128 guest_dir = hypfs_mkdir(sb, systems_dir, guest_name);
129 if (IS_ERR(guest_dir)) 129 if (IS_ERR(guest_dir))
130 return PTR_ERR(guest_dir); 130 return PTR_ERR(guest_dir);
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 341aff2687a5..c53f8ac825ca 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -14,8 +14,8 @@
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/namei.h> 15#include <linux/namei.h>
16#include <linux/vfs.h> 16#include <linux/vfs.h>
17#include <linux/slab.h>
17#include <linux/pagemap.h> 18#include <linux/pagemap.h>
18#include <linux/gfp.h>
19#include <linux/time.h> 19#include <linux/time.h>
20#include <linux/parser.h> 20#include <linux/parser.h>
21#include <linux/sysfs.h> 21#include <linux/sysfs.h>
@@ -288,46 +288,30 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
288 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 288 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
289 sb->s_magic = HYPFS_MAGIC; 289 sb->s_magic = HYPFS_MAGIC;
290 sb->s_op = &hypfs_s_ops; 290 sb->s_op = &hypfs_s_ops;
291 if (hypfs_parse_options(data, sb)) { 291 if (hypfs_parse_options(data, sb))
292 rc = -EINVAL; 292 return -EINVAL;
293 goto err_alloc;
294 }
295 root_inode = hypfs_make_inode(sb, S_IFDIR | 0755); 293 root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
296 if (!root_inode) { 294 if (!root_inode)
297 rc = -ENOMEM; 295 return -ENOMEM;
298 goto err_alloc;
299 }
300 root_inode->i_op = &simple_dir_inode_operations; 296 root_inode->i_op = &simple_dir_inode_operations;
301 root_inode->i_fop = &simple_dir_operations; 297 root_inode->i_fop = &simple_dir_operations;
302 root_dentry = d_alloc_root(root_inode); 298 sb->s_root = root_dentry = d_alloc_root(root_inode);
303 if (!root_dentry) { 299 if (!root_dentry) {
304 iput(root_inode); 300 iput(root_inode);
305 rc = -ENOMEM; 301 return -ENOMEM;
306 goto err_alloc;
307 } 302 }
308 if (MACHINE_IS_VM) 303 if (MACHINE_IS_VM)
309 rc = hypfs_vm_create_files(sb, root_dentry); 304 rc = hypfs_vm_create_files(sb, root_dentry);
310 else 305 else
311 rc = hypfs_diag_create_files(sb, root_dentry); 306 rc = hypfs_diag_create_files(sb, root_dentry);
312 if (rc) 307 if (rc)
313 goto err_tree; 308 return rc;
314 sbi->update_file = hypfs_create_update_file(sb, root_dentry); 309 sbi->update_file = hypfs_create_update_file(sb, root_dentry);
315 if (IS_ERR(sbi->update_file)) { 310 if (IS_ERR(sbi->update_file))
316 rc = PTR_ERR(sbi->update_file); 311 return PTR_ERR(sbi->update_file);
317 goto err_tree;
318 }
319 hypfs_update_update(sb); 312 hypfs_update_update(sb);
320 sb->s_root = root_dentry;
321 pr_info("Hypervisor filesystem mounted\n"); 313 pr_info("Hypervisor filesystem mounted\n");
322 return 0; 314 return 0;
323
324err_tree:
325 hypfs_delete_tree(root_dentry);
326 d_genocide(root_dentry);
327 dput(root_dentry);
328err_alloc:
329 kfree(sbi);
330 return rc;
331} 315}
332 316
333static int hypfs_get_super(struct file_system_type *fst, int flags, 317static int hypfs_get_super(struct file_system_type *fst, int flags,
@@ -340,12 +324,12 @@ static void hypfs_kill_super(struct super_block *sb)
340{ 324{
341 struct hypfs_sb_info *sb_info = sb->s_fs_info; 325 struct hypfs_sb_info *sb_info = sb->s_fs_info;
342 326
343 if (sb->s_root) { 327 if (sb->s_root)
344 hypfs_delete_tree(sb->s_root); 328 hypfs_delete_tree(sb->s_root);
329 if (sb_info->update_file)
345 hypfs_remove(sb_info->update_file); 330 hypfs_remove(sb_info->update_file);
346 kfree(sb->s_fs_info); 331 kfree(sb->s_fs_info);
347 sb->s_fs_info = NULL; 332 sb->s_fs_info = NULL;
348 }
349 kill_litter_super(sb); 333 kill_litter_super(sb);
350} 334}
351 335
diff --git a/arch/s390/include/asm/asm-offsets.h b/arch/s390/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/s390/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index ae7c8f9f94a5..451bfbb9db3d 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -18,10 +18,8 @@
18 18
19#define ATOMIC_INIT(i) { (i) } 19#define ATOMIC_INIT(i) { (i) }
20 20
21#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
22
23#define __CS_LOOP(ptr, op_val, op_string) ({ \ 21#define __CS_LOOP(ptr, op_val, op_string) ({ \
24 typeof(ptr->counter) old_val, new_val; \ 22 int old_val, new_val; \
25 asm volatile( \ 23 asm volatile( \
26 " l %0,%2\n" \ 24 " l %0,%2\n" \
27 "0: lr %1,%0\n" \ 25 "0: lr %1,%0\n" \
@@ -35,26 +33,6 @@
35 new_val; \ 33 new_val; \
36}) 34})
37 35
38#else /* __GNUC__ */
39
40#define __CS_LOOP(ptr, op_val, op_string) ({ \
41 typeof(ptr->counter) old_val, new_val; \
42 asm volatile( \
43 " l %0,0(%3)\n" \
44 "0: lr %1,%0\n" \
45 op_string " %1,%4\n" \
46 " cs %0,%1,0(%3)\n" \
47 " jl 0b" \
48 : "=&d" (old_val), "=&d" (new_val), \
49 "=m" (((atomic_t *)(ptr))->counter) \
50 : "a" (ptr), "d" (op_val), \
51 "m" (((atomic_t *)(ptr))->counter) \
52 : "cc", "memory"); \
53 new_val; \
54})
55
56#endif /* __GNUC__ */
57
58static inline int atomic_read(const atomic_t *v) 36static inline int atomic_read(const atomic_t *v)
59{ 37{
60 barrier(); 38 barrier();
@@ -101,19 +79,11 @@ static inline void atomic_set_mask(unsigned long mask, atomic_t *v)
101 79
102static inline int atomic_cmpxchg(atomic_t *v, int old, int new) 80static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
103{ 81{
104#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
105 asm volatile( 82 asm volatile(
106 " cs %0,%2,%1" 83 " cs %0,%2,%1"
107 : "+d" (old), "=Q" (v->counter) 84 : "+d" (old), "=Q" (v->counter)
108 : "d" (new), "Q" (v->counter) 85 : "d" (new), "Q" (v->counter)
109 : "cc", "memory"); 86 : "cc", "memory");
110#else /* __GNUC__ */
111 asm volatile(
112 " cs %0,%3,0(%2)"
113 : "+d" (old), "=m" (v->counter)
114 : "a" (v), "d" (new), "m" (v->counter)
115 : "cc", "memory");
116#endif /* __GNUC__ */
117 return old; 87 return old;
118} 88}
119 89
@@ -140,10 +110,8 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
140 110
141#ifdef CONFIG_64BIT 111#ifdef CONFIG_64BIT
142 112
143#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
144
145#define __CSG_LOOP(ptr, op_val, op_string) ({ \ 113#define __CSG_LOOP(ptr, op_val, op_string) ({ \
146 typeof(ptr->counter) old_val, new_val; \ 114 long long old_val, new_val; \
147 asm volatile( \ 115 asm volatile( \
148 " lg %0,%2\n" \ 116 " lg %0,%2\n" \
149 "0: lgr %1,%0\n" \ 117 "0: lgr %1,%0\n" \
@@ -157,26 +125,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
157 new_val; \ 125 new_val; \
158}) 126})
159 127
160#else /* __GNUC__ */
161
162#define __CSG_LOOP(ptr, op_val, op_string) ({ \
163 typeof(ptr->counter) old_val, new_val; \
164 asm volatile( \
165 " lg %0,0(%3)\n" \
166 "0: lgr %1,%0\n" \
167 op_string " %1,%4\n" \
168 " csg %0,%1,0(%3)\n" \
169 " jl 0b" \
170 : "=&d" (old_val), "=&d" (new_val), \
171 "=m" (((atomic_t *)(ptr))->counter) \
172 : "a" (ptr), "d" (op_val), \
173 "m" (((atomic_t *)(ptr))->counter) \
174 : "cc", "memory"); \
175 new_val; \
176})
177
178#endif /* __GNUC__ */
179
180static inline long long atomic64_read(const atomic64_t *v) 128static inline long long atomic64_read(const atomic64_t *v)
181{ 129{
182 barrier(); 130 barrier();
@@ -214,19 +162,11 @@ static inline void atomic64_set_mask(unsigned long mask, atomic64_t *v)
214static inline long long atomic64_cmpxchg(atomic64_t *v, 162static inline long long atomic64_cmpxchg(atomic64_t *v,
215 long long old, long long new) 163 long long old, long long new)
216{ 164{
217#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
218 asm volatile( 165 asm volatile(
219 " csg %0,%2,%1" 166 " csg %0,%2,%1"
220 : "+d" (old), "=Q" (v->counter) 167 : "+d" (old), "=Q" (v->counter)
221 : "d" (new), "Q" (v->counter) 168 : "d" (new), "Q" (v->counter)
222 : "cc", "memory"); 169 : "cc", "memory");
223#else /* __GNUC__ */
224 asm volatile(
225 " csg %0,%3,0(%2)"
226 : "+d" (old), "=m" (v->counter)
227 : "a" (v), "d" (new), "m" (v->counter)
228 : "cc", "memory");
229#endif /* __GNUC__ */
230 return old; 170 return old;
231} 171}
232 172
@@ -243,10 +183,8 @@ static inline long long atomic64_read(const atomic64_t *v)
243 register_pair rp; 183 register_pair rp;
244 184
245 asm volatile( 185 asm volatile(
246 " lm %0,%N0,0(%1)" 186 " lm %0,%N0,%1"
247 : "=&d" (rp) 187 : "=&d" (rp) : "Q" (v->counter) );
248 : "a" (&v->counter), "m" (v->counter)
249 );
250 return rp.pair; 188 return rp.pair;
251} 189}
252 190
@@ -255,10 +193,8 @@ static inline void atomic64_set(atomic64_t *v, long long i)
255 register_pair rp = {.pair = i}; 193 register_pair rp = {.pair = i};
256 194
257 asm volatile( 195 asm volatile(
258 " stm %1,%N1,0(%2)" 196 " stm %1,%N1,%0"
259 : "=m" (v->counter) 197 : "=Q" (v->counter) : "d" (rp) );
260 : "d" (rp), "a" (&v->counter)
261 );
262} 198}
263 199
264static inline long long atomic64_xchg(atomic64_t *v, long long new) 200static inline long long atomic64_xchg(atomic64_t *v, long long new)
@@ -267,11 +203,11 @@ static inline long long atomic64_xchg(atomic64_t *v, long long new)
267 register_pair rp_old; 203 register_pair rp_old;
268 204
269 asm volatile( 205 asm volatile(
270 " lm %0,%N0,0(%2)\n" 206 " lm %0,%N0,%1\n"
271 "0: cds %0,%3,0(%2)\n" 207 "0: cds %0,%2,%1\n"
272 " jl 0b\n" 208 " jl 0b\n"
273 : "=&d" (rp_old), "+m" (v->counter) 209 : "=&d" (rp_old), "=Q" (v->counter)
274 : "a" (&v->counter), "d" (rp_new) 210 : "d" (rp_new), "Q" (v->counter)
275 : "cc"); 211 : "cc");
276 return rp_old.pair; 212 return rp_old.pair;
277} 213}
@@ -283,9 +219,9 @@ static inline long long atomic64_cmpxchg(atomic64_t *v,
283 register_pair rp_new = {.pair = new}; 219 register_pair rp_new = {.pair = new};
284 220
285 asm volatile( 221 asm volatile(
286 " cds %0,%3,0(%2)" 222 " cds %0,%2,%1"
287 : "+&d" (rp_old), "+m" (v->counter) 223 : "+&d" (rp_old), "=Q" (v->counter)
288 : "a" (&v->counter), "d" (rp_new) 224 : "d" (rp_new), "Q" (v->counter)
289 : "cc"); 225 : "cc");
290 return rp_old.pair; 226 return rp_old.pair;
291} 227}
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index b30606f6d523..2e05972c5085 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -71,8 +71,6 @@ extern const char _sb_findmap[];
71#define __BITOPS_AND "nr" 71#define __BITOPS_AND "nr"
72#define __BITOPS_XOR "xr" 72#define __BITOPS_XOR "xr"
73 73
74#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
75
76#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 74#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
77 asm volatile( \ 75 asm volatile( \
78 " l %0,%2\n" \ 76 " l %0,%2\n" \
@@ -85,22 +83,6 @@ extern const char _sb_findmap[];
85 : "d" (__val), "Q" (*(unsigned long *) __addr) \ 83 : "d" (__val), "Q" (*(unsigned long *) __addr) \
86 : "cc"); 84 : "cc");
87 85
88#else /* __GNUC__ */
89
90#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
91 asm volatile( \
92 " l %0,0(%4)\n" \
93 "0: lr %1,%0\n" \
94 __op_string " %1,%3\n" \
95 " cs %0,%1,0(%4)\n" \
96 " jl 0b" \
97 : "=&d" (__old), "=&d" (__new), \
98 "=m" (*(unsigned long *) __addr) \
99 : "d" (__val), "a" (__addr), \
100 "m" (*(unsigned long *) __addr) : "cc");
101
102#endif /* __GNUC__ */
103
104#else /* __s390x__ */ 86#else /* __s390x__ */
105 87
106#define __BITOPS_ALIGN 7 88#define __BITOPS_ALIGN 7
@@ -109,8 +91,6 @@ extern const char _sb_findmap[];
109#define __BITOPS_AND "ngr" 91#define __BITOPS_AND "ngr"
110#define __BITOPS_XOR "xgr" 92#define __BITOPS_XOR "xgr"
111 93
112#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
113
114#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 94#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
115 asm volatile( \ 95 asm volatile( \
116 " lg %0,%2\n" \ 96 " lg %0,%2\n" \
@@ -123,23 +103,6 @@ extern const char _sb_findmap[];
123 : "d" (__val), "Q" (*(unsigned long *) __addr) \ 103 : "d" (__val), "Q" (*(unsigned long *) __addr) \
124 : "cc"); 104 : "cc");
125 105
126#else /* __GNUC__ */
127
128#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
129 asm volatile( \
130 " lg %0,0(%4)\n" \
131 "0: lgr %1,%0\n" \
132 __op_string " %1,%3\n" \
133 " csg %0,%1,0(%4)\n" \
134 " jl 0b" \
135 : "=&d" (__old), "=&d" (__new), \
136 "=m" (*(unsigned long *) __addr) \
137 : "d" (__val), "a" (__addr), \
138 "m" (*(unsigned long *) __addr) : "cc");
139
140
141#endif /* __GNUC__ */
142
143#endif /* __s390x__ */ 106#endif /* __s390x__ */
144 107
145#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) 108#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
@@ -261,9 +224,8 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
261 224
262 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 225 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
263 asm volatile( 226 asm volatile(
264 " oc 0(1,%1),0(%2)" 227 " oc %O0(1,%R0),%1"
265 : "=m" (*(char *) addr) : "a" (addr), 228 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
266 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
267} 229}
268 230
269static inline void 231static inline void
@@ -290,9 +252,8 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr)
290 252
291 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 253 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
292 asm volatile( 254 asm volatile(
293 " nc 0(1,%1),0(%2)" 255 " nc %O0(1,%R0),%1"
294 : "=m" (*(char *) addr) : "a" (addr), 256 : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7]) : "cc" );
295 "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc");
296} 257}
297 258
298static inline void 259static inline void
@@ -318,9 +279,8 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
318 279
319 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 280 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
320 asm volatile( 281 asm volatile(
321 " xc 0(1,%1),0(%2)" 282 " xc %O0(1,%R0),%1"
322 : "=m" (*(char *) addr) : "a" (addr), 283 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
323 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
324} 284}
325 285
326static inline void 286static inline void
@@ -349,10 +309,9 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
349 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 309 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
350 ch = *(unsigned char *) addr; 310 ch = *(unsigned char *) addr;
351 asm volatile( 311 asm volatile(
352 " oc 0(1,%1),0(%2)" 312 " oc %O0(1,%R0),%1"
353 : "=m" (*(char *) addr) 313 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
354 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 314 : "cc", "memory");
355 "m" (*(char *) addr) : "cc", "memory");
356 return (ch >> (nr & 7)) & 1; 315 return (ch >> (nr & 7)) & 1;
357} 316}
358#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y) 317#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y)
@@ -369,10 +328,9 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
369 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 328 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
370 ch = *(unsigned char *) addr; 329 ch = *(unsigned char *) addr;
371 asm volatile( 330 asm volatile(
372 " nc 0(1,%1),0(%2)" 331 " nc %O0(1,%R0),%1"
373 : "=m" (*(char *) addr) 332 : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7])
374 : "a" (addr), "a" (_ni_bitmap + (nr & 7)), 333 : "cc", "memory");
375 "m" (*(char *) addr) : "cc", "memory");
376 return (ch >> (nr & 7)) & 1; 334 return (ch >> (nr & 7)) & 1;
377} 335}
378#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y) 336#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y)
@@ -389,10 +347,9 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
389 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 347 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
390 ch = *(unsigned char *) addr; 348 ch = *(unsigned char *) addr;
391 asm volatile( 349 asm volatile(
392 " xc 0(1,%1),0(%2)" 350 " xc %O0(1,%R0),%1"
393 : "=m" (*(char *) addr) 351 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
394 : "a" (addr), "a" (_oi_bitmap + (nr & 7)), 352 : "cc", "memory");
395 "m" (*(char *) addr) : "cc", "memory");
396 return (ch >> (nr & 7)) & 1; 353 return (ch >> (nr & 7)) & 1;
397} 354}
398#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y) 355#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y)
@@ -591,11 +548,11 @@ static inline unsigned long __load_ulong_le(const unsigned long *p,
591 p = (unsigned long *)((unsigned long) p + offset); 548 p = (unsigned long *)((unsigned long) p + offset);
592#ifndef __s390x__ 549#ifndef __s390x__
593 asm volatile( 550 asm volatile(
594 " ic %0,0(%1)\n" 551 " ic %0,%O1(%R1)\n"
595 " icm %0,2,1(%1)\n" 552 " icm %0,2,%O1+1(%R1)\n"
596 " icm %0,4,2(%1)\n" 553 " icm %0,4,%O1+2(%R1)\n"
597 " icm %0,8,3(%1)" 554 " icm %0,8,%O1+3(%R1)"
598 : "=&d" (word) : "a" (p), "m" (*p) : "cc"); 555 : "=&d" (word) : "Q" (*p) : "cc");
599#else 556#else
600 asm volatile( 557 asm volatile(
601 " lrvg %0,%1" 558 " lrvg %0,%1"
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 7efd0abe8887..9beeb9db9b23 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -5,12 +5,6 @@
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7 7
8#ifdef CONFIG_64BIT
9#define S390_LONG ".quad"
10#else
11#define S390_LONG ".long"
12#endif
13
14#ifdef CONFIG_DEBUG_BUGVERBOSE 8#ifdef CONFIG_DEBUG_BUGVERBOSE
15 9
16#define __EMIT_BUG(x) do { \ 10#define __EMIT_BUG(x) do { \
@@ -21,7 +15,7 @@
21 "2: .asciz \""__FILE__"\"\n" \ 15 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \ 16 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \ 17 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \ 18 "3: .long 1b-3b,2b-3b\n" \
25 " .short %0,%1\n" \ 19 " .short %0,%1\n" \
26 " .org 3b+%2\n" \ 20 " .org 3b+%2\n" \
27 ".previous\n" \ 21 ".previous\n" \
@@ -37,7 +31,7 @@
37 "0: j 0b+2\n" \ 31 "0: j 0b+2\n" \
38 "1:\n" \ 32 "1:\n" \
39 ".section __bug_table,\"a\"\n" \ 33 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \ 34 "2: .long 1b-2b\n" \
41 " .short %0\n" \ 35 " .short %0\n" \
42 " .org 2b+%1\n" \ 36 " .org 2b+%1\n" \
43 ".previous\n" \ 37 ".previous\n" \
@@ -49,7 +43,11 @@
49 43
50#define BUG() do { \ 44#define BUG() do { \
51 __EMIT_BUG(0); \ 45 __EMIT_BUG(0); \
52 for (;;); \ 46 unreachable(); \
47} while (0)
48
49#define __WARN() do { \
50 __EMIT_BUG(BUGFLAG_WARNING); \
53} while (0) 51} while (0)
54 52
55#define WARN_ON(x) ({ \ 53#define WARN_ON(x) ({ \
diff --git a/arch/s390/include/asm/cacheflush.h b/arch/s390/include/asm/cacheflush.h
index 49d5af916d01..405cc97c6249 100644
--- a/arch/s390/include/asm/cacheflush.h
+++ b/arch/s390/include/asm/cacheflush.h
@@ -10,6 +10,7 @@
10#define flush_cache_dup_mm(mm) do { } while (0) 10#define flush_cache_dup_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) do { } while (0) 11#define flush_cache_range(vma, start, end) do { } while (0)
12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
13#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
13#define flush_dcache_page(page) do { } while (0) 14#define flush_dcache_page(page) do { } while (0)
14#define flush_dcache_mmap_lock(mapping) do { } while (0) 15#define flush_dcache_mmap_lock(mapping) do { } while (0)
15#define flush_dcache_mmap_unlock(mapping) do { } while (0) 16#define flush_dcache_mmap_unlock(mapping) do { } while (0)
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index 2a5419551176..f4bd346a52d3 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -142,6 +142,8 @@ struct ccw1;
142extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long); 142extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long);
143extern int ccw_device_set_options(struct ccw_device *, unsigned long); 143extern int ccw_device_set_options(struct ccw_device *, unsigned long);
144extern void ccw_device_clear_options(struct ccw_device *, unsigned long); 144extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
145int ccw_device_is_pathgroup(struct ccw_device *cdev);
146int ccw_device_is_multipath(struct ccw_device *cdev);
145 147
146/* Allow for i/o completion notification after primary interrupt status. */ 148/* Allow for i/o completion notification after primary interrupt status. */
147#define CCWDEV_EARLY_NOTIFICATION 0x0001 149#define CCWDEV_EARLY_NOTIFICATION 0x0001
@@ -151,6 +153,8 @@ extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
151#define CCWDEV_DO_PATHGROUP 0x0004 153#define CCWDEV_DO_PATHGROUP 0x0004
152/* Allow forced onlining of boxed devices. */ 154/* Allow forced onlining of boxed devices. */
153#define CCWDEV_ALLOW_FORCE 0x0008 155#define CCWDEV_ALLOW_FORCE 0x0008
156/* Try to use multipath mode. */
157#define CCWDEV_DO_MULTIPATH 0x0010
154 158
155extern int ccw_device_start(struct ccw_device *, struct ccw1 *, 159extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
156 unsigned long, __u8, unsigned long); 160 unsigned long, __u8, unsigned long);
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
index e85679af54dd..e34347d567a6 100644
--- a/arch/s390/include/asm/cio.h
+++ b/arch/s390/include/asm/cio.h
@@ -20,7 +20,7 @@
20/** 20/**
21 * struct ccw1 - channel command word 21 * struct ccw1 - channel command word
22 * @cmd_code: command code 22 * @cmd_code: command code
23 * @flags: flags, like IDA adressing, etc. 23 * @flags: flags, like IDA addressing, etc.
24 * @count: byte count 24 * @count: byte count
25 * @cda: data address 25 * @cda: data address
26 * 26 *
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 01a08020bc0e..104f2007f097 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -35,7 +35,8 @@
35 35
36extern long psw32_user_bits; 36extern long psw32_user_bits;
37 37
38#define COMPAT_USER_HZ 100 38#define COMPAT_USER_HZ 100
39#define COMPAT_UTS_MACHINE "s390\0\0\0\0"
39 40
40typedef u32 compat_size_t; 41typedef u32 compat_size_t;
41typedef s32 compat_ssize_t; 42typedef s32 compat_ssize_t;
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index f23961ada7fb..258ba88b7b50 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -183,6 +183,7 @@ struct s390_idle_data {
183 unsigned long long idle_count; 183 unsigned long long idle_count;
184 unsigned long long idle_enter; 184 unsigned long long idle_enter;
185 unsigned long long idle_time; 185 unsigned long long idle_time;
186 int nohz_delay;
186}; 187};
187 188
188DECLARE_PER_CPU(struct s390_idle_data, s390_idle); 189DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
@@ -198,4 +199,11 @@ static inline void s390_idle_check(void)
198 vtime_start_cpu(); 199 vtime_start_cpu();
199} 200}
200 201
202static inline int s390_nohz_delay(int cpu)
203{
204 return per_cpu(s390_idle, cpu).nohz_delay != 0;
205}
206
207#define arch_needs_cpu(cpu) s390_nohz_delay(cpu)
208
201#endif /* _S390_CPUTIME_H */ 209#endif /* _S390_CPUTIME_H */
diff --git a/arch/s390/include/asm/crw.h b/arch/s390/include/asm/crw.h
index 2185a6d619d3..749a97e61bea 100644
--- a/arch/s390/include/asm/crw.h
+++ b/arch/s390/include/asm/crw.h
@@ -32,6 +32,7 @@ typedef void (*crw_handler_t)(struct crw *, struct crw *, int);
32extern int crw_register_handler(int rsc, crw_handler_t handler); 32extern int crw_register_handler(int rsc, crw_handler_t handler);
33extern void crw_unregister_handler(int rsc); 33extern void crw_unregister_handler(int rsc);
34extern void crw_handle_channel_report(void); 34extern void crw_handle_channel_report(void);
35void crw_wait_for_channel_report(void);
35 36
36#define NR_RSCS 16 37#define NR_RSCS 16
37 38
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index e885442c1dfe..354d42616c7e 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -155,7 +155,6 @@ extern unsigned int vdso_enabled;
155 } while (0) 155 } while (0)
156 156
157#define CORE_DUMP_USE_REGSET 157#define CORE_DUMP_USE_REGSET
158#define USE_ELF_CORE_DUMP
159#define ELF_EXEC_PAGESIZE 4096 158#define ELF_EXEC_PAGESIZE 4096
160 159
161/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 160/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
diff --git a/arch/s390/include/asm/etr.h b/arch/s390/include/asm/etr.h
index 80ef58c61970..538e1b36a726 100644
--- a/arch/s390/include/asm/etr.h
+++ b/arch/s390/include/asm/etr.h
@@ -145,11 +145,11 @@ static inline int etr_setr(struct etr_eacr *ctrl)
145 int rc = -ENOSYS; 145 int rc = -ENOSYS;
146 146
147 asm volatile( 147 asm volatile(
148 " .insn s,0xb2160000,0(%2)\n" 148 " .insn s,0xb2160000,%1\n"
149 "0: la %0,0\n" 149 "0: la %0,0\n"
150 "1:\n" 150 "1:\n"
151 EX_TABLE(0b,1b) 151 EX_TABLE(0b,1b)
152 : "+d" (rc) : "m" (*ctrl), "a" (ctrl)); 152 : "+d" (rc) : "Q" (*ctrl));
153 return rc; 153 return rc;
154} 154}
155 155
@@ -159,11 +159,11 @@ static inline int etr_stetr(struct etr_aib *aib)
159 int rc = -ENOSYS; 159 int rc = -ENOSYS;
160 160
161 asm volatile( 161 asm volatile(
162 " .insn s,0xb2170000,0(%2)\n" 162 " .insn s,0xb2170000,%1\n"
163 "0: la %0,0\n" 163 "0: la %0,0\n"
164 "1:\n" 164 "1:\n"
165 EX_TABLE(0b,1b) 165 EX_TABLE(0b,1b)
166 : "+d" (rc) : "m" (*aib), "a" (aib)); 166 : "+d" (rc) : "Q" (*aib));
167 return rc; 167 return rc;
168} 168}
169 169
@@ -174,11 +174,11 @@ static inline int etr_steai(struct etr_aib *aib, unsigned int func)
174 int rc = -ENOSYS; 174 int rc = -ENOSYS;
175 175
176 asm volatile( 176 asm volatile(
177 " .insn s,0xb2b30000,0(%2)\n" 177 " .insn s,0xb2b30000,%1\n"
178 "0: la %0,0\n" 178 "0: la %0,0\n"
179 "1:\n" 179 "1:\n"
180 EX_TABLE(0b,1b) 180 EX_TABLE(0b,1b)
181 : "+d" (rc) : "m" (*aib), "a" (aib), "d" (reg0)); 181 : "+d" (rc) : "Q" (*aib), "d" (reg0));
182 return rc; 182 return rc;
183} 183}
184 184
diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h
index 3f26131120b7..15b3ac253898 100644
--- a/arch/s390/include/asm/irqflags.h
+++ b/arch/s390/include/asm/irqflags.h
@@ -1,16 +1,12 @@
1/* 1/*
2 * include/asm-s390/irqflags.h 2 * Copyright IBM Corp. 2006,2010
3 * 3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */ 4 */
7 5
8#ifndef __ASM_IRQFLAGS_H 6#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H 7#define __ASM_IRQFLAGS_H
10 8
11#ifdef __KERNEL__ 9#include <linux/types.h>
12
13#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
14 10
15/* store then or system mask. */ 11/* store then or system mask. */
16#define __raw_local_irq_stosm(__or) \ 12#define __raw_local_irq_stosm(__or) \
@@ -38,40 +34,6 @@
38 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \ 34 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \
39}) 35})
40 36
41#else /* __GNUC__ */
42
43/* store then or system mask. */
44#define __raw_local_irq_stosm(__or) \
45({ \
46 unsigned long __mask; \
47 asm volatile( \
48 " stosm 0(%1),%2" \
49 : "=m" (__mask) \
50 : "a" (&__mask), "i" (__or) : "memory"); \
51 __mask; \
52})
53
54/* store then and system mask. */
55#define __raw_local_irq_stnsm(__and) \
56({ \
57 unsigned long __mask; \
58 asm volatile( \
59 " stnsm 0(%1),%2" \
60 : "=m" (__mask) \
61 : "a" (&__mask), "i" (__and) : "memory"); \
62 __mask; \
63})
64
65/* set system mask. */
66#define __raw_local_irq_ssm(__mask) \
67({ \
68 asm volatile( \
69 " ssm 0(%0)" \
70 : : "a" (&__mask), "m" (__mask) : "memory"); \
71})
72
73#endif /* __GNUC__ */
74
75/* interrupt control.. */ 37/* interrupt control.. */
76static inline unsigned long raw_local_irq_enable(void) 38static inline unsigned long raw_local_irq_enable(void)
77{ 39{
@@ -102,5 +64,4 @@ static inline int raw_irqs_disabled_flags(unsigned long flags)
102/* For spinlocks etc */ 64/* For spinlocks etc */
103#define raw_local_irq_save(x) ((x) = raw_local_irq_disable()) 65#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
104 66
105#endif /* __KERNEL__ */
106#endif /* __ASM_IRQFLAGS_H */ 67#endif /* __ASM_IRQFLAGS_H */
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
index 3dfcaeb5d7f4..82b32a100c7d 100644
--- a/arch/s390/include/asm/kvm.h
+++ b/arch/s390/include/asm/kvm.h
@@ -1,6 +1,5 @@
1#ifndef __LINUX_KVM_S390_H 1#ifndef __LINUX_KVM_S390_H
2#define __LINUX_KVM_S390_H 2#define __LINUX_KVM_S390_H
3
4/* 3/*
5 * asm-s390/kvm.h - KVM s390 specific structures and definitions 4 * asm-s390/kvm.h - KVM s390 specific structures and definitions
6 * 5 *
@@ -15,6 +14,8 @@
15 */ 14 */
16#include <linux/types.h> 15#include <linux/types.h>
17 16
17#define __KVM_S390
18
18/* for KVM_GET_REGS and KVM_SET_REGS */ 19/* for KVM_GET_REGS and KVM_SET_REGS */
19struct kvm_regs { 20struct kvm_regs {
20 /* general purpose regs for s390 */ 21 /* general purpose regs for s390 */
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index f2ef4b619ce1..05527c040b7a 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -1,141 +1,16 @@
1/* 1/*
2 * include/asm-s390/lowcore.h 2 * Copyright IBM Corp. 1999,2010
3 * 3 * Author(s): Hartmut Penner <hp@de.ibm.com>,
4 * S390 version 4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Denis Joseph Barrow,
6 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
9 */ 6 */
10 7
11#ifndef _ASM_S390_LOWCORE_H 8#ifndef _ASM_S390_LOWCORE_H
12#define _ASM_S390_LOWCORE_H 9#define _ASM_S390_LOWCORE_H
13 10
14#define __LC_IPL_PARMBLOCK_PTR 0x0014
15#define __LC_EXT_PARAMS 0x0080
16#define __LC_CPU_ADDRESS 0x0084
17#define __LC_EXT_INT_CODE 0x0086
18
19#define __LC_SVC_ILC 0x0088
20#define __LC_SVC_INT_CODE 0x008a
21#define __LC_PGM_ILC 0x008c
22#define __LC_PGM_INT_CODE 0x008e
23
24#define __LC_PER_ATMID 0x0096
25#define __LC_PER_ADDRESS 0x0098
26#define __LC_PER_ACCESS_ID 0x00a1
27#define __LC_AR_MODE_ID 0x00a3
28
29#define __LC_SUBCHANNEL_ID 0x00b8
30#define __LC_SUBCHANNEL_NR 0x00ba
31#define __LC_IO_INT_PARM 0x00bc
32#define __LC_IO_INT_WORD 0x00c0
33#define __LC_STFL_FAC_LIST 0x00c8
34#define __LC_MCCK_CODE 0x00e8
35
36#define __LC_DUMP_REIPL 0x0e00
37
38#ifndef __s390x__
39#define __LC_EXT_OLD_PSW 0x0018
40#define __LC_SVC_OLD_PSW 0x0020
41#define __LC_PGM_OLD_PSW 0x0028
42#define __LC_MCK_OLD_PSW 0x0030
43#define __LC_IO_OLD_PSW 0x0038
44#define __LC_EXT_NEW_PSW 0x0058
45#define __LC_SVC_NEW_PSW 0x0060
46#define __LC_PGM_NEW_PSW 0x0068
47#define __LC_MCK_NEW_PSW 0x0070
48#define __LC_IO_NEW_PSW 0x0078
49#define __LC_SAVE_AREA 0x0200
50#define __LC_RETURN_PSW 0x0240
51#define __LC_RETURN_MCCK_PSW 0x0248
52#define __LC_SYNC_ENTER_TIMER 0x0250
53#define __LC_ASYNC_ENTER_TIMER 0x0258
54#define __LC_EXIT_TIMER 0x0260
55#define __LC_USER_TIMER 0x0268
56#define __LC_SYSTEM_TIMER 0x0270
57#define __LC_STEAL_TIMER 0x0278
58#define __LC_LAST_UPDATE_TIMER 0x0280
59#define __LC_LAST_UPDATE_CLOCK 0x0288
60#define __LC_CURRENT 0x0290
61#define __LC_THREAD_INFO 0x0294
62#define __LC_KERNEL_STACK 0x0298
63#define __LC_ASYNC_STACK 0x029c
64#define __LC_PANIC_STACK 0x02a0
65#define __LC_KERNEL_ASCE 0x02a4
66#define __LC_USER_ASCE 0x02a8
67#define __LC_USER_EXEC_ASCE 0x02ac
68#define __LC_CPUID 0x02b0
69#define __LC_INT_CLOCK 0x02c8
70#define __LC_MACHINE_FLAGS 0x02d8
71#define __LC_FTRACE_FUNC 0x02dc
72#define __LC_IRB 0x0300
73#define __LC_PFAULT_INTPARM 0x0080
74#define __LC_CPU_TIMER_SAVE_AREA 0x00d8
75#define __LC_CLOCK_COMP_SAVE_AREA 0x00e0
76#define __LC_PSW_SAVE_AREA 0x0100
77#define __LC_PREFIX_SAVE_AREA 0x0108
78#define __LC_AREGS_SAVE_AREA 0x0120
79#define __LC_FPREGS_SAVE_AREA 0x0160
80#define __LC_GPREGS_SAVE_AREA 0x0180
81#define __LC_CREGS_SAVE_AREA 0x01c0
82#else /* __s390x__ */
83#define __LC_LAST_BREAK 0x0110
84#define __LC_EXT_OLD_PSW 0x0130
85#define __LC_SVC_OLD_PSW 0x0140
86#define __LC_PGM_OLD_PSW 0x0150
87#define __LC_MCK_OLD_PSW 0x0160
88#define __LC_IO_OLD_PSW 0x0170
89#define __LC_RESTART_PSW 0x01a0
90#define __LC_EXT_NEW_PSW 0x01b0
91#define __LC_SVC_NEW_PSW 0x01c0
92#define __LC_PGM_NEW_PSW 0x01d0
93#define __LC_MCK_NEW_PSW 0x01e0
94#define __LC_IO_NEW_PSW 0x01f0
95#define __LC_SAVE_AREA 0x0200
96#define __LC_RETURN_PSW 0x0280
97#define __LC_RETURN_MCCK_PSW 0x0290
98#define __LC_SYNC_ENTER_TIMER 0x02a0
99#define __LC_ASYNC_ENTER_TIMER 0x02a8
100#define __LC_EXIT_TIMER 0x02b0
101#define __LC_USER_TIMER 0x02b8
102#define __LC_SYSTEM_TIMER 0x02c0
103#define __LC_STEAL_TIMER 0x02c8
104#define __LC_LAST_UPDATE_TIMER 0x02d0
105#define __LC_LAST_UPDATE_CLOCK 0x02d8
106#define __LC_CURRENT 0x02e0
107#define __LC_THREAD_INFO 0x02e8
108#define __LC_KERNEL_STACK 0x02f0
109#define __LC_ASYNC_STACK 0x02f8
110#define __LC_PANIC_STACK 0x0300
111#define __LC_KERNEL_ASCE 0x0308
112#define __LC_USER_ASCE 0x0310
113#define __LC_USER_EXEC_ASCE 0x0318
114#define __LC_CPUID 0x0320
115#define __LC_INT_CLOCK 0x0340
116#define __LC_VDSO_PER_CPU 0x0350
117#define __LC_MACHINE_FLAGS 0x0358
118#define __LC_FTRACE_FUNC 0x0360
119#define __LC_IRB 0x0380
120#define __LC_PASTE 0x03c0
121#define __LC_PFAULT_INTPARM 0x11b8
122#define __LC_FPREGS_SAVE_AREA 0x1200
123#define __LC_GPREGS_SAVE_AREA 0x1280
124#define __LC_PSW_SAVE_AREA 0x1300
125#define __LC_PREFIX_SAVE_AREA 0x1318
126#define __LC_FP_CREG_SAVE_AREA 0x131c
127#define __LC_TODREG_SAVE_AREA 0x1324
128#define __LC_CPU_TIMER_SAVE_AREA 0x1328
129#define __LC_CLOCK_COMP_SAVE_AREA 0x1331
130#define __LC_AREGS_SAVE_AREA 0x1340
131#define __LC_CREGS_SAVE_AREA 0x1380
132#endif /* __s390x__ */
133
134#ifndef __ASSEMBLY__
135
136#include <asm/cpu.h>
137#include <asm/ptrace.h>
138#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/ptrace.h>
13#include <asm/cpu.h>
139 14
140void restart_int_handler(void); 15void restart_int_handler(void);
141void ext_int_handler(void); 16void ext_int_handler(void);
@@ -144,7 +19,12 @@ void pgm_check_handler(void);
144void mcck_int_handler(void); 19void mcck_int_handler(void);
145void io_int_handler(void); 20void io_int_handler(void);
146 21
147struct save_area_s390 { 22#ifdef CONFIG_32BIT
23
24#define LC_ORDER 0
25#define LC_PAGES 1
26
27struct save_area {
148 u32 ext_save; 28 u32 ext_save;
149 u64 timer; 29 u64 timer;
150 u64 clk_cmp; 30 u64 clk_cmp;
@@ -156,54 +36,13 @@ struct save_area_s390 {
156 u64 fp_regs[4]; 36 u64 fp_regs[4];
157 u32 gp_regs[16]; 37 u32 gp_regs[16];
158 u32 ctrl_regs[16]; 38 u32 ctrl_regs[16];
159} __attribute__((packed)); 39} __packed;
160
161struct save_area_s390x {
162 u64 fp_regs[16];
163 u64 gp_regs[16];
164 u8 psw[16];
165 u8 pad1[8];
166 u32 pref_reg;
167 u32 fp_ctrl_reg;
168 u8 pad2[4];
169 u32 tod_reg;
170 u64 timer;
171 u64 clk_cmp;
172 u8 pad3[8];
173 u32 acc_regs[16];
174 u64 ctrl_regs[16];
175} __attribute__((packed));
176
177union save_area {
178 struct save_area_s390 s390;
179 struct save_area_s390x s390x;
180};
181
182#define SAVE_AREA_BASE_S390 0xd4
183#define SAVE_AREA_BASE_S390X 0x1200
184
185#ifndef __s390x__
186#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
187#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
188#else
189#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
191#endif
192
193#ifndef __s390x__
194#define LC_ORDER 0
195#else
196#define LC_ORDER 1
197#endif
198
199#define LC_PAGES (1UL << LC_ORDER)
200 40
201struct _lowcore 41struct _lowcore {
202{
203#ifndef __s390x__
204 /* 0x0000 - 0x01ff: defined by architecture */
205 psw_t restart_psw; /* 0x0000 */ 42 psw_t restart_psw; /* 0x0000 */
206 __u32 ccw2[4]; /* 0x0008 */ 43 psw_t restart_old_psw; /* 0x0008 */
44 __u8 pad_0x0010[0x0014-0x0010]; /* 0x0010 */
45 __u32 ipl_parmblock_ptr; /* 0x0014 */
207 psw_t external_old_psw; /* 0x0018 */ 46 psw_t external_old_psw; /* 0x0018 */
208 psw_t svc_old_psw; /* 0x0020 */ 47 psw_t svc_old_psw; /* 0x0020 */
209 psw_t program_old_psw; /* 0x0028 */ 48 psw_t program_old_psw; /* 0x0028 */
@@ -229,7 +68,9 @@ struct _lowcore
229 __u32 monitor_code; /* 0x009c */ 68 __u32 monitor_code; /* 0x009c */
230 __u8 exc_access_id; /* 0x00a0 */ 69 __u8 exc_access_id; /* 0x00a0 */
231 __u8 per_access_id; /* 0x00a1 */ 70 __u8 per_access_id; /* 0x00a1 */
232 __u8 pad_0x00a2[0x00b8-0x00a2]; /* 0x00a2 */ 71 __u8 op_access_id; /* 0x00a2 */
72 __u8 ar_access_id; /* 0x00a3 */
73 __u8 pad_0x00a4[0x00b8-0x00a4]; /* 0x00a4 */
233 __u16 subchannel_id; /* 0x00b8 */ 74 __u16 subchannel_id; /* 0x00b8 */
234 __u16 subchannel_nr; /* 0x00ba */ 75 __u16 subchannel_nr; /* 0x00ba */
235 __u32 io_int_parm; /* 0x00bc */ 76 __u32 io_int_parm; /* 0x00bc */
@@ -245,8 +86,9 @@ struct _lowcore
245 __u32 external_damage_code; /* 0x00f4 */ 86 __u32 external_damage_code; /* 0x00f4 */
246 __u32 failing_storage_address; /* 0x00f8 */ 87 __u32 failing_storage_address; /* 0x00f8 */
247 __u8 pad_0x00fc[0x0100-0x00fc]; /* 0x00fc */ 88 __u8 pad_0x00fc[0x0100-0x00fc]; /* 0x00fc */
248 __u32 st_status_fixed_logout[4]; /* 0x0100 */ 89 psw_t psw_save_area; /* 0x0100 */
249 __u8 pad_0x0110[0x0120-0x0110]; /* 0x0110 */ 90 __u32 prefixreg_save_area; /* 0x0108 */
91 __u8 pad_0x010c[0x0120-0x010c]; /* 0x010c */
250 92
251 /* CPU register save area: defined by architecture */ 93 /* CPU register save area: defined by architecture */
252 __u32 access_regs_save_area[16]; /* 0x0120 */ 94 __u32 access_regs_save_area[16]; /* 0x0120 */
@@ -293,12 +135,12 @@ struct _lowcore
293 __u64 clock_comparator; /* 0x02d0 */ 135 __u64 clock_comparator; /* 0x02d0 */
294 __u32 machine_flags; /* 0x02d8 */ 136 __u32 machine_flags; /* 0x02d8 */
295 __u32 ftrace_func; /* 0x02dc */ 137 __u32 ftrace_func; /* 0x02dc */
296 __u8 pad_0x02f0[0x0300-0x02f0]; /* 0x02f0 */ 138 __u8 pad_0x02e0[0x0300-0x02e0]; /* 0x02e0 */
297 139
298 /* Interrupt response block */ 140 /* Interrupt response block */
299 __u8 irb[64]; /* 0x0300 */ 141 __u8 irb[64]; /* 0x0300 */
300 142
301 __u8 pad_0x0400[0x0e00-0x0400]; /* 0x0400 */ 143 __u8 pad_0x0340[0x0e00-0x0340]; /* 0x0340 */
302 144
303 /* 145 /*
304 * 0xe00 contains the address of the IPL Parameter Information 146 * 0xe00 contains the address of the IPL Parameter Information
@@ -310,10 +152,32 @@ struct _lowcore
310 152
311 /* Align to the top 1k of prefix area */ 153 /* Align to the top 1k of prefix area */
312 __u8 pad_0x0e08[0x1000-0x0e08]; /* 0x0e08 */ 154 __u8 pad_0x0e08[0x1000-0x0e08]; /* 0x0e08 */
313#else /* !__s390x__ */ 155} __packed;
314 /* 0x0000 - 0x01ff: defined by architecture */ 156
315 __u32 ccw1[2]; /* 0x0000 */ 157#else /* CONFIG_32BIT */
316 __u32 ccw2[4]; /* 0x0008 */ 158
159#define LC_ORDER 1
160#define LC_PAGES 2
161
162struct save_area {
163 u64 fp_regs[16];
164 u64 gp_regs[16];
165 u8 psw[16];
166 u8 pad1[8];
167 u32 pref_reg;
168 u32 fp_ctrl_reg;
169 u8 pad2[4];
170 u32 tod_reg;
171 u64 timer;
172 u64 clk_cmp;
173 u8 pad3[8];
174 u32 acc_regs[16];
175 u64 ctrl_regs[16];
176} __packed;
177
178struct _lowcore {
179 __u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */
180 __u32 ipl_parmblock_ptr; /* 0x0014 */
317 __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */ 181 __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
318 __u32 ext_params; /* 0x0080 */ 182 __u32 ext_params; /* 0x0080 */
319 __u16 cpu_addr; /* 0x0084 */ 183 __u16 cpu_addr; /* 0x0084 */
@@ -344,7 +208,9 @@ struct _lowcore
344 __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */ 208 __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
345 __u32 external_damage_code; /* 0x00f4 */ 209 __u32 external_damage_code; /* 0x00f4 */
346 addr_t failing_storage_address; /* 0x00f8 */ 210 addr_t failing_storage_address; /* 0x00f8 */
347 __u8 pad_0x0100[0x0120-0x0100]; /* 0x0100 */ 211 __u8 pad_0x0100[0x0110-0x0100]; /* 0x0100 */
212 __u64 breaking_event_addr; /* 0x0110 */
213 __u8 pad_0x0118[0x0120-0x0118]; /* 0x0118 */
348 psw_t restart_old_psw; /* 0x0120 */ 214 psw_t restart_old_psw; /* 0x0120 */
349 psw_t external_old_psw; /* 0x0130 */ 215 psw_t external_old_psw; /* 0x0130 */
350 psw_t svc_old_psw; /* 0x0140 */ 216 psw_t svc_old_psw; /* 0x0140 */
@@ -425,7 +291,7 @@ struct _lowcore
425 /* CPU register save area: defined by architecture */ 291 /* CPU register save area: defined by architecture */
426 __u64 floating_pt_save_area[16]; /* 0x1200 */ 292 __u64 floating_pt_save_area[16]; /* 0x1200 */
427 __u64 gpregs_save_area[16]; /* 0x1280 */ 293 __u64 gpregs_save_area[16]; /* 0x1280 */
428 __u32 st_status_fixed_logout[4]; /* 0x1300 */ 294 psw_t psw_save_area; /* 0x1300 */
429 __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */ 295 __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
430 __u32 prefixreg_save_area; /* 0x1318 */ 296 __u32 prefixreg_save_area; /* 0x1318 */
431 __u32 fpt_creg_save_area; /* 0x131c */ 297 __u32 fpt_creg_save_area; /* 0x131c */
@@ -439,10 +305,12 @@ struct _lowcore
439 305
440 /* align to the top of the prefix area */ 306 /* align to the top of the prefix area */
441 __u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */ 307 __u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */
442#endif /* !__s390x__ */ 308} __packed;
443} __attribute__((packed)); /* End structure*/ 309
310#endif /* CONFIG_32BIT */
444 311
445#define S390_lowcore (*((struct _lowcore *) 0)) 312#define S390_lowcore (*((struct _lowcore *) 0))
313
446extern struct _lowcore *lowcore_ptr[]; 314extern struct _lowcore *lowcore_ptr[];
447 315
448static inline void set_prefix(__u32 address) 316static inline void set_prefix(__u32 address)
@@ -458,6 +326,4 @@ static inline __u32 store_prefix(void)
458 return address; 326 return address;
459} 327}
460 328
461#endif 329#endif /* _ASM_S390_LOWCORE_H */
462
463#endif
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index fc7edd6f41b6..976e273988c2 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -36,7 +36,7 @@ static inline int init_new_context(struct task_struct *tsk,
36 mm->context.has_pgste = 1; 36 mm->context.has_pgste = 1;
37 mm->context.alloc_pgste = 1; 37 mm->context.alloc_pgste = 1;
38 } else { 38 } else {
39 mm->context.noexec = s390_noexec; 39 mm->context.noexec = (user_mode == SECONDARY_SPACE_MODE);
40 mm->context.has_pgste = 0; 40 mm->context.has_pgste = 0;
41 mm->context.alloc_pgste = 0; 41 mm->context.alloc_pgste = 0;
42 } 42 }
@@ -58,7 +58,7 @@ static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
58 pgd_t *pgd = mm->pgd; 58 pgd_t *pgd = mm->pgd;
59 59
60 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); 60 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd);
61 if (switch_amode) { 61 if (user_mode != HOME_SPACE_MODE) {
62 /* Load primary space page table origin. */ 62 /* Load primary space page table origin. */
63 pgd = mm->context.noexec ? get_shadow_table(pgd) : pgd; 63 pgd = mm->context.noexec ? get_shadow_table(pgd) : pgd;
64 S390_lowcore.user_exec_asce = mm->context.asce_bits | __pa(pgd); 64 S390_lowcore.user_exec_asce = mm->context.asce_bits | __pa(pgd);
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 5e9daf5d7f22..af650fb47206 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -107,9 +107,6 @@ typedef pte_t *pgtable_t;
107#define __pgd(x) ((pgd_t) { (x) } ) 107#define __pgd(x) ((pgd_t) { (x) } )
108#define __pgprot(x) ((pgprot_t) { (x) } ) 108#define __pgprot(x) ((pgprot_t) { (x) } )
109 109
110/* default storage key used for all pages */
111extern unsigned int default_storage_key;
112
113static inline void 110static inline void
114page_set_storage_key(unsigned long addr, unsigned int skey) 111page_set_storage_key(unsigned long addr, unsigned int skey)
115{ 112{
diff --git a/arch/s390/include/asm/param.h b/arch/s390/include/asm/param.h
index 34aaa4603347..c616821bf2ac 100644
--- a/arch/s390/include/asm/param.h
+++ b/arch/s390/include/asm/param.h
@@ -1,30 +1,6 @@
1/*
2 * include/asm-s390/param.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/param.h"
7 */
8
9#ifndef _ASMS390_PARAM_H 1#ifndef _ASMS390_PARAM_H
10#define _ASMS390_PARAM_H 2#define _ASMS390_PARAM_H
11 3
12#ifdef __KERNEL__ 4#include <asm-generic/param.h>
13# define HZ CONFIG_HZ /* Internal kernel timer frequency */
14# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
16#endif
17
18#ifndef HZ
19#define HZ 100
20#endif
21
22#define EXEC_PAGESIZE 4096
23
24#ifndef NOGROUP
25#define NOGROUP (-1)
26#endif
27
28#define MAXHOSTNAMELEN 64 /* max length of hostname */
29 5
30#endif 6#endif /* _ASMS390_PARAM_H */
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index ddad5903341c..68940d0bad91 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -143,7 +143,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
143 spin_lock_init(&mm->context.list_lock); 143 spin_lock_init(&mm->context.list_lock);
144 INIT_LIST_HEAD(&mm->context.crst_list); 144 INIT_LIST_HEAD(&mm->context.crst_list);
145 INIT_LIST_HEAD(&mm->context.pgtable_list); 145 INIT_LIST_HEAD(&mm->context.pgtable_list);
146 return (pgd_t *) crst_table_alloc(mm, s390_noexec); 146 return (pgd_t *)
147 crst_table_alloc(mm, user_mode == SECONDARY_SPACE_MODE);
147} 148}
148#define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd) 149#define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd)
149 150
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 60a7b1a1702f..89a504c3f12e 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -43,7 +43,7 @@ extern void vmem_map_init(void);
43 * The S390 doesn't have any external MMU info: the kernel page 43 * The S390 doesn't have any external MMU info: the kernel page
44 * tables contain all the necessary information. 44 * tables contain all the necessary information.
45 */ 45 */
46#define update_mmu_cache(vma, address, pte) do { } while (0) 46#define update_mmu_cache(vma, address, ptep) do { } while (0)
47 47
48/* 48/*
49 * ZERO_PAGE is a global shared page that is always zero: used 49 * ZERO_PAGE is a global shared page that is always zero: used
@@ -105,7 +105,7 @@ extern char empty_zero_page[PAGE_SIZE];
105#ifndef __ASSEMBLY__ 105#ifndef __ASSEMBLY__
106/* 106/*
107 * The vmalloc area will always be on the topmost area of the kernel 107 * The vmalloc area will always be on the topmost area of the kernel
108 * mapping. We reserve 96MB (31bit) / 1GB (64bit) for vmalloc, 108 * mapping. We reserve 96MB (31bit) / 128GB (64bit) for vmalloc,
109 * which should be enough for any sane case. 109 * which should be enough for any sane case.
110 * By putting vmalloc at the top, we maximise the gap between physical 110 * By putting vmalloc at the top, we maximise the gap between physical
111 * memory and vmalloc to catch misplaced memory accesses. As a side 111 * memory and vmalloc to catch misplaced memory accesses. As a side
@@ -120,8 +120,8 @@ extern unsigned long VMALLOC_START;
120#define VMALLOC_END 0x7e000000UL 120#define VMALLOC_END 0x7e000000UL
121#define VMEM_MAP_END 0x80000000UL 121#define VMEM_MAP_END 0x80000000UL
122#else /* __s390x__ */ 122#else /* __s390x__ */
123#define VMALLOC_SIZE (1UL << 30) 123#define VMALLOC_SIZE (128UL << 30)
124#define VMALLOC_END 0x3e040000000UL 124#define VMALLOC_END 0x3e000000000UL
125#define VMEM_MAP_END 0x40000000000UL 125#define VMEM_MAP_END 0x40000000000UL
126#endif /* __s390x__ */ 126#endif /* __s390x__ */
127 127
@@ -169,12 +169,13 @@ extern unsigned long VMALLOC_START;
169 * STL Segment-Table-Length: Segment-table length (STL+1*16 entries -> up to 2048) 169 * STL Segment-Table-Length: Segment-table length (STL+1*16 entries -> up to 2048)
170 * 170 *
171 * A 64 bit pagetable entry of S390 has following format: 171 * A 64 bit pagetable entry of S390 has following format:
172 * | PFRA |0IP0| OS | 172 * | PFRA |0IPC| OS |
173 * 0000000000111111111122222222223333333333444444444455555555556666 173 * 0000000000111111111122222222223333333333444444444455555555556666
174 * 0123456789012345678901234567890123456789012345678901234567890123 174 * 0123456789012345678901234567890123456789012345678901234567890123
175 * 175 *
176 * I Page-Invalid Bit: Page is not available for address-translation 176 * I Page-Invalid Bit: Page is not available for address-translation
177 * P Page-Protection Bit: Store access not possible for page 177 * P Page-Protection Bit: Store access not possible for page
178 * C Change-bit override: HW is not required to set change bit
178 * 179 *
179 * A 64 bit segmenttable entry of S390 has following format: 180 * A 64 bit segmenttable entry of S390 has following format:
180 * | P-table origin | TT 181 * | P-table origin | TT
@@ -218,6 +219,7 @@ extern unsigned long VMALLOC_START;
218 */ 219 */
219 220
220/* Hardware bits in the page table entry */ 221/* Hardware bits in the page table entry */
222#define _PAGE_CO 0x100 /* HW Change-bit override */
221#define _PAGE_RO 0x200 /* HW read-only bit */ 223#define _PAGE_RO 0x200 /* HW read-only bit */
222#define _PAGE_INVALID 0x400 /* HW invalid bit */ 224#define _PAGE_INVALID 0x400 /* HW invalid bit */
223 225
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index b42715458312..73e259834e10 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -28,7 +28,7 @@
28 28
29static inline void get_cpu_id(struct cpuid *ptr) 29static inline void get_cpu_id(struct cpuid *ptr)
30{ 30{
31 asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr)); 31 asm volatile("stidp %0" : "=Q" (*ptr));
32} 32}
33 33
34extern void s390_adjust_jiffies(void); 34extern void s390_adjust_jiffies(void);
@@ -184,9 +184,9 @@ static inline void psw_set_key(unsigned int key)
184static inline void __load_psw(psw_t psw) 184static inline void __load_psw(psw_t psw)
185{ 185{
186#ifndef __s390x__ 186#ifndef __s390x__
187 asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); 187 asm volatile("lpsw %0" : : "Q" (psw) : "cc");
188#else 188#else
189 asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); 189 asm volatile("lpswe %0" : : "Q" (psw) : "cc");
190#endif 190#endif
191} 191}
192 192
@@ -206,17 +206,17 @@ static inline void __load_psw_mask (unsigned long mask)
206 asm volatile( 206 asm volatile(
207 " basr %0,0\n" 207 " basr %0,0\n"
208 "0: ahi %0,1f-0b\n" 208 "0: ahi %0,1f-0b\n"
209 " st %0,4(%1)\n" 209 " st %0,%O1+4(%R1)\n"
210 " lpsw 0(%1)\n" 210 " lpsw %1\n"
211 "1:" 211 "1:"
212 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); 212 : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc");
213#else /* __s390x__ */ 213#else /* __s390x__ */
214 asm volatile( 214 asm volatile(
215 " larl %0,1f\n" 215 " larl %0,1f\n"
216 " stg %0,8(%1)\n" 216 " stg %0,%O1+8(%R1)\n"
217 " lpswe 0(%1)\n" 217 " lpswe %1\n"
218 "1:" 218 "1:"
219 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); 219 : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc");
220#endif /* __s390x__ */ 220#endif /* __s390x__ */
221} 221}
222 222
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 95dcf183a28d..fef9b33cdd59 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -489,16 +489,24 @@ struct user_regs_struct
489 * These are defined as per linux/ptrace.h, which see. 489 * These are defined as per linux/ptrace.h, which see.
490 */ 490 */
491#define arch_has_single_step() (1) 491#define arch_has_single_step() (1)
492struct task_struct; 492extern void show_regs(struct pt_regs * regs);
493extern void user_enable_single_step(struct task_struct *);
494extern void user_disable_single_step(struct task_struct *);
495 493
496#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 494#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
497#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 495#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
498#define user_stack_pointer(regs)((regs)->gprs[15]) 496#define user_stack_pointer(regs)((regs)->gprs[15])
499#define regs_return_value(regs)((regs)->gprs[2]) 497#define regs_return_value(regs)((regs)->gprs[2])
500#define profile_pc(regs) instruction_pointer(regs) 498#define profile_pc(regs) instruction_pointer(regs)
501extern void show_regs(struct pt_regs * regs); 499
500int regs_query_register_offset(const char *name);
501const char *regs_query_register_name(unsigned int offset);
502unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset);
503unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n);
504
505static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
506{
507 return regs->gprs[15] & PSW_ADDR_INSN;
508}
509
502#endif /* __KERNEL__ */ 510#endif /* __KERNEL__ */
503#endif /* __ASSEMBLY__ */ 511#endif /* __ASSEMBLY__ */
504 512
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 79d849f014f0..9b04b1102bbc 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -13,7 +13,8 @@
13#include <asm/cio.h> 13#include <asm/cio.h>
14#include <asm/ccwdev.h> 14#include <asm/ccwdev.h>
15 15
16#define QDIO_MAX_QUEUES_PER_IRQ 32 16/* only use 4 queues to save some cachelines */
17#define QDIO_MAX_QUEUES_PER_IRQ 4
17#define QDIO_MAX_BUFFERS_PER_Q 128 18#define QDIO_MAX_BUFFERS_PER_Q 128
18#define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1) 19#define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1)
19#define QDIO_MAX_ELEMENTS_PER_BUFFER 16 20#define QDIO_MAX_ELEMENTS_PER_BUFFER 16
@@ -320,11 +321,6 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
320#define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40 321#define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40
321#define QDIO_ERROR_SLSB_STATE 0x80 322#define QDIO_ERROR_SLSB_STATE 0x80
322 323
323/* for qdio_initialize */
324#define QDIO_INBOUND_0COPY_SBALS 0x01
325#define QDIO_OUTBOUND_0COPY_SBALS 0x02
326#define QDIO_USE_OUTBOUND_PCIS 0x04
327
328/* for qdio_cleanup */ 324/* for qdio_cleanup */
329#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 325#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
330#define QDIO_FLAG_CLEANUP_USING_HALT 0x02 326#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
@@ -343,7 +339,6 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
343 * @input_handler: handler to be called for input queues 339 * @input_handler: handler to be called for input queues
344 * @output_handler: handler to be called for output queues 340 * @output_handler: handler to be called for output queues
345 * @int_parm: interruption parameter 341 * @int_parm: interruption parameter
346 * @flags: initialization flags
347 * @input_sbal_addr_array: address of no_input_qs * 128 pointers 342 * @input_sbal_addr_array: address of no_input_qs * 128 pointers
348 * @output_sbal_addr_array: address of no_output_qs * 128 pointers 343 * @output_sbal_addr_array: address of no_output_qs * 128 pointers
349 */ 344 */
@@ -360,7 +355,6 @@ struct qdio_initialize {
360 qdio_handler_t *input_handler; 355 qdio_handler_t *input_handler;
361 qdio_handler_t *output_handler; 356 qdio_handler_t *output_handler;
362 unsigned long int_parm; 357 unsigned long int_parm;
363 unsigned long flags;
364 void **input_sbal_addr_array; 358 void **input_sbal_addr_array;
365 void **output_sbal_addr_array; 359 void **output_sbal_addr_array;
366}; 360};
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h
index 9d2a17971805..423fdda2322d 100644
--- a/arch/s390/include/asm/rwsem.h
+++ b/arch/s390/include/asm/rwsem.h
@@ -124,21 +124,21 @@ static inline void __down_read(struct rw_semaphore *sem)
124 124
125 asm volatile( 125 asm volatile(
126#ifndef __s390x__ 126#ifndef __s390x__
127 " l %0,0(%3)\n" 127 " l %0,%2\n"
128 "0: lr %1,%0\n" 128 "0: lr %1,%0\n"
129 " ahi %1,%5\n" 129 " ahi %1,%4\n"
130 " cs %0,%1,0(%3)\n" 130 " cs %0,%1,%2\n"
131 " jl 0b" 131 " jl 0b"
132#else /* __s390x__ */ 132#else /* __s390x__ */
133 " lg %0,0(%3)\n" 133 " lg %0,%2\n"
134 "0: lgr %1,%0\n" 134 "0: lgr %1,%0\n"
135 " aghi %1,%5\n" 135 " aghi %1,%4\n"
136 " csg %0,%1,0(%3)\n" 136 " csg %0,%1,%2\n"
137 " jl 0b" 137 " jl 0b"
138#endif /* __s390x__ */ 138#endif /* __s390x__ */
139 : "=&d" (old), "=&d" (new), "=m" (sem->count) 139 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
140 : "a" (&sem->count), "m" (sem->count), 140 : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
141 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); 141 : "cc", "memory");
142 if (old < 0) 142 if (old < 0)
143 rwsem_down_read_failed(sem); 143 rwsem_down_read_failed(sem);
144} 144}
@@ -152,25 +152,25 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
152 152
153 asm volatile( 153 asm volatile(
154#ifndef __s390x__ 154#ifndef __s390x__
155 " l %0,0(%3)\n" 155 " l %0,%2\n"
156 "0: ltr %1,%0\n" 156 "0: ltr %1,%0\n"
157 " jm 1f\n" 157 " jm 1f\n"
158 " ahi %1,%5\n" 158 " ahi %1,%4\n"
159 " cs %0,%1,0(%3)\n" 159 " cs %0,%1,%2\n"
160 " jl 0b\n" 160 " jl 0b\n"
161 "1:" 161 "1:"
162#else /* __s390x__ */ 162#else /* __s390x__ */
163 " lg %0,0(%3)\n" 163 " lg %0,%2\n"
164 "0: ltgr %1,%0\n" 164 "0: ltgr %1,%0\n"
165 " jm 1f\n" 165 " jm 1f\n"
166 " aghi %1,%5\n" 166 " aghi %1,%4\n"
167 " csg %0,%1,0(%3)\n" 167 " csg %0,%1,%2\n"
168 " jl 0b\n" 168 " jl 0b\n"
169 "1:" 169 "1:"
170#endif /* __s390x__ */ 170#endif /* __s390x__ */
171 : "=&d" (old), "=&d" (new), "=m" (sem->count) 171 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
172 : "a" (&sem->count), "m" (sem->count), 172 : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
173 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); 173 : "cc", "memory");
174 return old >= 0 ? 1 : 0; 174 return old >= 0 ? 1 : 0;
175} 175}
176 176
@@ -184,20 +184,20 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
184 tmp = RWSEM_ACTIVE_WRITE_BIAS; 184 tmp = RWSEM_ACTIVE_WRITE_BIAS;
185 asm volatile( 185 asm volatile(
186#ifndef __s390x__ 186#ifndef __s390x__
187 " l %0,0(%3)\n" 187 " l %0,%2\n"
188 "0: lr %1,%0\n" 188 "0: lr %1,%0\n"
189 " a %1,%5\n" 189 " a %1,%4\n"
190 " cs %0,%1,0(%3)\n" 190 " cs %0,%1,%2\n"
191 " jl 0b" 191 " jl 0b"
192#else /* __s390x__ */ 192#else /* __s390x__ */
193 " lg %0,0(%3)\n" 193 " lg %0,%2\n"
194 "0: lgr %1,%0\n" 194 "0: lgr %1,%0\n"
195 " ag %1,%5\n" 195 " ag %1,%4\n"
196 " csg %0,%1,0(%3)\n" 196 " csg %0,%1,%2\n"
197 " jl 0b" 197 " jl 0b"
198#endif /* __s390x__ */ 198#endif /* __s390x__ */
199 : "=&d" (old), "=&d" (new), "=m" (sem->count) 199 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
200 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 200 : "Q" (sem->count), "m" (tmp)
201 : "cc", "memory"); 201 : "cc", "memory");
202 if (old != 0) 202 if (old != 0)
203 rwsem_down_write_failed(sem); 203 rwsem_down_write_failed(sem);
@@ -217,22 +217,22 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
217 217
218 asm volatile( 218 asm volatile(
219#ifndef __s390x__ 219#ifndef __s390x__
220 " l %0,0(%2)\n" 220 " l %0,%1\n"
221 "0: ltr %0,%0\n" 221 "0: ltr %0,%0\n"
222 " jnz 1f\n" 222 " jnz 1f\n"
223 " cs %0,%4,0(%2)\n" 223 " cs %0,%3,%1\n"
224 " jl 0b\n" 224 " jl 0b\n"
225#else /* __s390x__ */ 225#else /* __s390x__ */
226 " lg %0,0(%2)\n" 226 " lg %0,%1\n"
227 "0: ltgr %0,%0\n" 227 "0: ltgr %0,%0\n"
228 " jnz 1f\n" 228 " jnz 1f\n"
229 " csg %0,%4,0(%2)\n" 229 " csg %0,%3,%1\n"
230 " jl 0b\n" 230 " jl 0b\n"
231#endif /* __s390x__ */ 231#endif /* __s390x__ */
232 "1:" 232 "1:"
233 : "=&d" (old), "=m" (sem->count) 233 : "=&d" (old), "=Q" (sem->count)
234 : "a" (&sem->count), "m" (sem->count), 234 : "Q" (sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS)
235 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory"); 235 : "cc", "memory");
236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; 236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
237} 237}
238 238
@@ -245,21 +245,20 @@ static inline void __up_read(struct rw_semaphore *sem)
245 245
246 asm volatile( 246 asm volatile(
247#ifndef __s390x__ 247#ifndef __s390x__
248 " l %0,0(%3)\n" 248 " l %0,%2\n"
249 "0: lr %1,%0\n" 249 "0: lr %1,%0\n"
250 " ahi %1,%5\n" 250 " ahi %1,%4\n"
251 " cs %0,%1,0(%3)\n" 251 " cs %0,%1,%2\n"
252 " jl 0b" 252 " jl 0b"
253#else /* __s390x__ */ 253#else /* __s390x__ */
254 " lg %0,0(%3)\n" 254 " lg %0,%2\n"
255 "0: lgr %1,%0\n" 255 "0: lgr %1,%0\n"
256 " aghi %1,%5\n" 256 " aghi %1,%4\n"
257 " csg %0,%1,0(%3)\n" 257 " csg %0,%1,%2\n"
258 " jl 0b" 258 " jl 0b"
259#endif /* __s390x__ */ 259#endif /* __s390x__ */
260 : "=&d" (old), "=&d" (new), "=m" (sem->count) 260 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
261 : "a" (&sem->count), "m" (sem->count), 261 : "Q" (sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS)
262 "i" (-RWSEM_ACTIVE_READ_BIAS)
263 : "cc", "memory"); 262 : "cc", "memory");
264 if (new < 0) 263 if (new < 0)
265 if ((new & RWSEM_ACTIVE_MASK) == 0) 264 if ((new & RWSEM_ACTIVE_MASK) == 0)
@@ -276,20 +275,20 @@ static inline void __up_write(struct rw_semaphore *sem)
276 tmp = -RWSEM_ACTIVE_WRITE_BIAS; 275 tmp = -RWSEM_ACTIVE_WRITE_BIAS;
277 asm volatile( 276 asm volatile(
278#ifndef __s390x__ 277#ifndef __s390x__
279 " l %0,0(%3)\n" 278 " l %0,%2\n"
280 "0: lr %1,%0\n" 279 "0: lr %1,%0\n"
281 " a %1,%5\n" 280 " a %1,%4\n"
282 " cs %0,%1,0(%3)\n" 281 " cs %0,%1,%2\n"
283 " jl 0b" 282 " jl 0b"
284#else /* __s390x__ */ 283#else /* __s390x__ */
285 " lg %0,0(%3)\n" 284 " lg %0,%2\n"
286 "0: lgr %1,%0\n" 285 "0: lgr %1,%0\n"
287 " ag %1,%5\n" 286 " ag %1,%4\n"
288 " csg %0,%1,0(%3)\n" 287 " csg %0,%1,%2\n"
289 " jl 0b" 288 " jl 0b"
290#endif /* __s390x__ */ 289#endif /* __s390x__ */
291 : "=&d" (old), "=&d" (new), "=m" (sem->count) 290 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
292 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 291 : "Q" (sem->count), "m" (tmp)
293 : "cc", "memory"); 292 : "cc", "memory");
294 if (new < 0) 293 if (new < 0)
295 if ((new & RWSEM_ACTIVE_MASK) == 0) 294 if ((new & RWSEM_ACTIVE_MASK) == 0)
@@ -306,20 +305,20 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
306 tmp = -RWSEM_WAITING_BIAS; 305 tmp = -RWSEM_WAITING_BIAS;
307 asm volatile( 306 asm volatile(
308#ifndef __s390x__ 307#ifndef __s390x__
309 " l %0,0(%3)\n" 308 " l %0,%2\n"
310 "0: lr %1,%0\n" 309 "0: lr %1,%0\n"
311 " a %1,%5\n" 310 " a %1,%4\n"
312 " cs %0,%1,0(%3)\n" 311 " cs %0,%1,%2\n"
313 " jl 0b" 312 " jl 0b"
314#else /* __s390x__ */ 313#else /* __s390x__ */
315 " lg %0,0(%3)\n" 314 " lg %0,%2\n"
316 "0: lgr %1,%0\n" 315 "0: lgr %1,%0\n"
317 " ag %1,%5\n" 316 " ag %1,%4\n"
318 " csg %0,%1,0(%3)\n" 317 " csg %0,%1,%2\n"
319 " jl 0b" 318 " jl 0b"
320#endif /* __s390x__ */ 319#endif /* __s390x__ */
321 : "=&d" (old), "=&d" (new), "=m" (sem->count) 320 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
322 : "a" (&sem->count), "m" (sem->count), "m" (tmp) 321 : "Q" (sem->count), "m" (tmp)
323 : "cc", "memory"); 322 : "cc", "memory");
324 if (new > 1) 323 if (new > 1)
325 rwsem_downgrade_wake(sem); 324 rwsem_downgrade_wake(sem);
@@ -334,20 +333,20 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
334 333
335 asm volatile( 334 asm volatile(
336#ifndef __s390x__ 335#ifndef __s390x__
337 " l %0,0(%3)\n" 336 " l %0,%2\n"
338 "0: lr %1,%0\n" 337 "0: lr %1,%0\n"
339 " ar %1,%5\n" 338 " ar %1,%4\n"
340 " cs %0,%1,0(%3)\n" 339 " cs %0,%1,%2\n"
341 " jl 0b" 340 " jl 0b"
342#else /* __s390x__ */ 341#else /* __s390x__ */
343 " lg %0,0(%3)\n" 342 " lg %0,%2\n"
344 "0: lgr %1,%0\n" 343 "0: lgr %1,%0\n"
345 " agr %1,%5\n" 344 " agr %1,%4\n"
346 " csg %0,%1,0(%3)\n" 345 " csg %0,%1,%2\n"
347 " jl 0b" 346 " jl 0b"
348#endif /* __s390x__ */ 347#endif /* __s390x__ */
349 : "=&d" (old), "=&d" (new), "=m" (sem->count) 348 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
350 : "a" (&sem->count), "m" (sem->count), "d" (delta) 349 : "Q" (sem->count), "d" (delta)
351 : "cc", "memory"); 350 : "cc", "memory");
352} 351}
353 352
@@ -360,20 +359,20 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
360 359
361 asm volatile( 360 asm volatile(
362#ifndef __s390x__ 361#ifndef __s390x__
363 " l %0,0(%3)\n" 362 " l %0,%2\n"
364 "0: lr %1,%0\n" 363 "0: lr %1,%0\n"
365 " ar %1,%5\n" 364 " ar %1,%4\n"
366 " cs %0,%1,0(%3)\n" 365 " cs %0,%1,%2\n"
367 " jl 0b" 366 " jl 0b"
368#else /* __s390x__ */ 367#else /* __s390x__ */
369 " lg %0,0(%3)\n" 368 " lg %0,%2\n"
370 "0: lgr %1,%0\n" 369 "0: lgr %1,%0\n"
371 " agr %1,%5\n" 370 " agr %1,%4\n"
372 " csg %0,%1,0(%3)\n" 371 " csg %0,%1,%2\n"
373 " jl 0b" 372 " jl 0b"
374#endif /* __s390x__ */ 373#endif /* __s390x__ */
375 : "=&d" (old), "=&d" (new), "=m" (sem->count) 374 : "=&d" (old), "=&d" (new), "=Q" (sem->count)
376 : "a" (&sem->count), "m" (sem->count), "d" (delta) 375 : "Q" (sem->count), "d" (delta)
377 : "cc", "memory"); 376 : "cc", "memory");
378 return new; 377 return new;
379} 378}
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index e37478e87286..9ab6bd3a65d1 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -14,14 +14,14 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#include <asm/lowcore.h>
18#include <asm/types.h>
19
20#define PARMAREA 0x10400 17#define PARMAREA 0x10400
21#define MEMORY_CHUNKS 256 18#define MEMORY_CHUNKS 256
22 19
23#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
24 21
22#include <asm/lowcore.h>
23#include <asm/types.h>
24
25#ifndef __s390x__ 25#ifndef __s390x__
26#define IPL_DEVICE (*(unsigned long *) (0x10404)) 26#define IPL_DEVICE (*(unsigned long *) (0x10404))
27#define INITRD_START (*(unsigned long *) (0x1040C)) 27#define INITRD_START (*(unsigned long *) (0x1040C))
@@ -49,17 +49,12 @@ extern unsigned long memory_end;
49 49
50void detect_memory_layout(struct mem_chunk chunk[]); 50void detect_memory_layout(struct mem_chunk chunk[]);
51 51
52#ifdef CONFIG_S390_SWITCH_AMODE 52#define PRIMARY_SPACE_MODE 0
53extern unsigned int switch_amode; 53#define ACCESS_REGISTER_MODE 1
54#else 54#define SECONDARY_SPACE_MODE 2
55#define switch_amode (0) 55#define HOME_SPACE_MODE 3
56#endif
57 56
58#ifdef CONFIG_S390_EXEC_PROTECT 57extern unsigned int user_mode;
59extern unsigned int s390_noexec;
60#else
61#define s390_noexec (0)
62#endif
63 58
64/* 59/*
65 * Machine features detected in head.S 60 * Machine features detected in head.S
@@ -76,9 +71,12 @@ extern unsigned int s390_noexec;
76#define MACHINE_FLAG_KVM (1UL << 9) 71#define MACHINE_FLAG_KVM (1UL << 9)
77#define MACHINE_FLAG_HPAGE (1UL << 10) 72#define MACHINE_FLAG_HPAGE (1UL << 10)
78#define MACHINE_FLAG_PFMF (1UL << 11) 73#define MACHINE_FLAG_PFMF (1UL << 11)
74#define MACHINE_FLAG_LPAR (1UL << 12)
79 75
80#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 76#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
81#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 77#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
78#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
79
82#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) 80#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
83 81
84#ifndef __s390x__ 82#ifndef __s390x__
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
index ec403d4304f8..e3bffd4e2d66 100644
--- a/arch/s390/include/asm/sigp.h
+++ b/arch/s390/include/asm/sigp.h
@@ -1,127 +1,131 @@
1/* 1/*
2 * include/asm-s390/sigp.h 2 * Routines and structures for signalling other processors.
3 * 3 *
4 * S390 version 4 * Copyright IBM Corp. 1999,2010
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Author(s): Denis Joseph Barrow,
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 6 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 7 * Heiko Carstens <heiko.carstens@de.ibm.com>,
8 * Heiko Carstens (heiko.carstens@de.ibm.com)
9 *
10 * sigp.h by D.J. Barrow (c) IBM 1999
11 * contains routines / structures for signalling other S/390 processors in an
12 * SMP configuration.
13 */ 8 */
14 9
15#ifndef __SIGP__ 10#ifndef __ASM_SIGP_H
16#define __SIGP__ 11#define __ASM_SIGP_H
17 12
18#include <asm/ptrace.h> 13#include <asm/system.h>
19#include <asm/atomic.h>
20 14
21/* get real cpu address from logical cpu number */ 15/* Get real cpu address from logical cpu number. */
22extern volatile int __cpu_logical_map[]; 16extern unsigned short __cpu_logical_map[];
23 17
24typedef enum 18static inline int cpu_logical_map(int cpu)
25{
26 sigp_unassigned=0x0,
27 sigp_sense,
28 sigp_external_call,
29 sigp_emergency_signal,
30 sigp_start,
31 sigp_stop,
32 sigp_restart,
33 sigp_unassigned1,
34 sigp_unassigned2,
35 sigp_stop_and_store_status,
36 sigp_unassigned3,
37 sigp_initial_cpu_reset,
38 sigp_cpu_reset,
39 sigp_set_prefix,
40 sigp_store_status_at_address,
41 sigp_store_extended_status_at_address
42} sigp_order_code;
43
44typedef __u32 sigp_status_word;
45
46typedef enum
47{ 19{
48 sigp_order_code_accepted=0, 20#ifdef CONFIG_SMP
49 sigp_status_stored, 21 return __cpu_logical_map[cpu];
50 sigp_busy, 22#else
51 sigp_not_operational 23 return stap();
52} sigp_ccode; 24#endif
25}
53 26
27enum {
28 sigp_sense = 1,
29 sigp_external_call = 2,
30 sigp_emergency_signal = 3,
31 sigp_start = 4,
32 sigp_stop = 5,
33 sigp_restart = 6,
34 sigp_stop_and_store_status = 9,
35 sigp_initial_cpu_reset = 11,
36 sigp_cpu_reset = 12,
37 sigp_set_prefix = 13,
38 sigp_store_status_at_address = 14,
39 sigp_store_extended_status_at_address = 15,
40 sigp_set_architecture = 18,
41 sigp_conditional_emergency_signal = 19,
42 sigp_sense_running = 21,
43};
44
45enum {
46 sigp_order_code_accepted = 0,
47 sigp_status_stored = 1,
48 sigp_busy = 2,
49 sigp_not_operational = 3,
50};
54 51
55/* 52/*
56 * Definitions for the external call 53 * Definitions for external call.
57 */ 54 */
58 55enum {
59/* 'Bit' signals, asynchronous */ 56 ec_schedule = 0,
60typedef enum
61{
62 ec_schedule=0,
63 ec_call_function, 57 ec_call_function,
64 ec_call_function_single, 58 ec_call_function_single,
65 ec_bit_last 59};
66} ec_bit_sig;
67 60
68/* 61/*
69 * Signal processor 62 * Signal processor.
70 */ 63 */
71static inline sigp_ccode 64static inline int raw_sigp(u16 cpu, int order)
72signal_processor(__u16 cpu_addr, sigp_order_code order_code)
73{ 65{
74 register unsigned long reg1 asm ("1") = 0; 66 register unsigned long reg1 asm ("1") = 0;
75 sigp_ccode ccode; 67 int ccode;
76 68
77 asm volatile( 69 asm volatile(
78 " sigp %1,%2,0(%3)\n" 70 " sigp %1,%2,0(%3)\n"
79 " ipm %0\n" 71 " ipm %0\n"
80 " srl %0,28\n" 72 " srl %0,28\n"
81 : "=d" (ccode) 73 : "=d" (ccode)
82 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 74 : "d" (reg1), "d" (cpu),
83 "a" (order_code) : "cc" , "memory"); 75 "a" (order) : "cc" , "memory");
84 return ccode; 76 return ccode;
85} 77}
86 78
87/* 79/*
88 * Signal processor with parameter 80 * Signal processor with parameter.
89 */ 81 */
90static inline sigp_ccode 82static inline int raw_sigp_p(u32 parameter, u16 cpu, int order)
91signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
92{ 83{
93 register unsigned int reg1 asm ("1") = parameter; 84 register unsigned int reg1 asm ("1") = parameter;
94 sigp_ccode ccode; 85 int ccode;
95 86
96 asm volatile( 87 asm volatile(
97 " sigp %1,%2,0(%3)\n" 88 " sigp %1,%2,0(%3)\n"
98 " ipm %0\n" 89 " ipm %0\n"
99 " srl %0,28\n" 90 " srl %0,28\n"
100 : "=d" (ccode) 91 : "=d" (ccode)
101 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 92 : "d" (reg1), "d" (cpu),
102 "a" (order_code) : "cc" , "memory"); 93 "a" (order) : "cc" , "memory");
103 return ccode; 94 return ccode;
104} 95}
105 96
106/* 97/*
107 * Signal processor with parameter and return status 98 * Signal processor with parameter and return status.
108 */ 99 */
109static inline sigp_ccode 100static inline int raw_sigp_ps(u32 *status, u32 parm, u16 cpu, int order)
110signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
111 sigp_order_code order_code)
112{ 101{
113 register unsigned int reg1 asm ("1") = parameter; 102 register unsigned int reg1 asm ("1") = parm;
114 sigp_ccode ccode; 103 int ccode;
115 104
116 asm volatile( 105 asm volatile(
117 " sigp %1,%2,0(%3)\n" 106 " sigp %1,%2,0(%3)\n"
118 " ipm %0\n" 107 " ipm %0\n"
119 " srl %0,28\n" 108 " srl %0,28\n"
120 : "=d" (ccode), "+d" (reg1) 109 : "=d" (ccode), "+d" (reg1)
121 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) 110 : "d" (cpu), "a" (order)
122 : "cc" , "memory"); 111 : "cc" , "memory");
123 *statusptr = reg1; 112 *status = reg1;
124 return ccode; 113 return ccode;
125} 114}
126 115
127#endif /* __SIGP__ */ 116static inline int sigp(int cpu, int order)
117{
118 return raw_sigp(cpu_logical_map(cpu), order);
119}
120
121static inline int sigp_p(u32 parameter, int cpu, int order)
122{
123 return raw_sigp_p(parameter, cpu_logical_map(cpu), order);
124}
125
126static inline int sigp_ps(u32 *status, u32 parm, int cpu, int order)
127{
128 return raw_sigp_ps(status, parm, cpu_logical_map(cpu), order);
129}
130
131#endif /* __ASM_SIGP_H */
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index a868b272c257..edc03cb9cd79 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -1,57 +1,22 @@
1/* 1/*
2 * include/asm-s390/smp.h 2 * Copyright IBM Corp. 1999,2009
3 * 3 * Author(s): Denis Joseph Barrow,
4 * S390 version 4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Heiko Carstens <heiko.carstens@de.ibm.com>,
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * Heiko Carstens (heiko.carstens@de.ibm.com)
9 */ 6 */
10#ifndef __ASM_SMP_H 7#ifndef __ASM_SMP_H
11#define __ASM_SMP_H 8#define __ASM_SMP_H
12 9
13#include <linux/threads.h> 10#ifdef CONFIG_SMP
14#include <linux/cpumask.h>
15#include <linux/bitops.h>
16 11
17#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
18
19#include <asm/lowcore.h>
20#include <asm/sigp.h>
21#include <asm/ptrace.h>
22#include <asm/system.h> 12#include <asm/system.h>
23 13#include <asm/sigp.h>
24/*
25 s390 specific smp.c headers
26 */
27typedef struct
28{
29 int intresting;
30 sigp_ccode ccode;
31 __u32 status;
32 __u16 cpu;
33} sigp_info;
34 14
35extern void machine_restart_smp(char *); 15extern void machine_restart_smp(char *);
36extern void machine_halt_smp(void); 16extern void machine_halt_smp(void);
37extern void machine_power_off_smp(void); 17extern void machine_power_off_smp(void);
38 18
39#define NO_PROC_ID 0xFF /* No processor magic marker */
40
41/*
42 * This magic constant controls our willingness to transfer
43 * a process across CPUs. Such a transfer incurs misses on the L1
44 * cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
45 * gut feeling is this will vary by board in value. For a board
46 * with separate L2 cache it probably depends also on the RSS, and
47 * for a board with shared L2 cache it ought to decay fast as other
48 * processes are run.
49 */
50
51#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */
52
53#define raw_smp_processor_id() (S390_lowcore.cpu_nr) 19#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
54#define cpu_logical_map(cpu) (cpu)
55 20
56extern int __cpu_disable (void); 21extern int __cpu_disable (void);
57extern void __cpu_die (unsigned int cpu); 22extern void __cpu_die (unsigned int cpu);
@@ -64,7 +29,45 @@ extern int smp_cpu_polarization[];
64extern void arch_send_call_function_single_ipi(int cpu); 29extern void arch_send_call_function_single_ipi(int cpu);
65extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 30extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
66 31
67#endif 32extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
33
34extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *);
35extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp,
36 int from, int to);
37extern void smp_restart_cpu(void);
38
39/*
40 * returns 1 if (virtual) cpu is scheduled
41 * returns 0 otherwise
42 */
43static inline int smp_vcpu_scheduled(int cpu)
44{
45 u32 status;
46
47 switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) {
48 case sigp_status_stored:
49 /* Check for running status */
50 if (status & 0x400)
51 return 0;
52 break;
53 case sigp_not_operational:
54 return 0;
55 default:
56 break;
57 }
58 return 1;
59}
60
61#else /* CONFIG_SMP */
62
63static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
64{
65 func(data);
66}
67
68#define smp_vcpu_scheduled (1)
69
70#endif /* CONFIG_SMP */
68 71
69#ifdef CONFIG_HOTPLUG_CPU 72#ifdef CONFIG_HOTPLUG_CPU
70extern int smp_rescan_cpus(void); 73extern int smp_rescan_cpus(void);
@@ -72,5 +75,4 @@ extern int smp_rescan_cpus(void);
72static inline int smp_rescan_cpus(void) { return 0; } 75static inline int smp_rescan_cpus(void) { return 0; }
73#endif 76#endif
74 77
75extern union save_area *zfcpdump_save_areas[NR_CPUS + 1]; 78#endif /* __ASM_SMP_H */
76#endif
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/asm/socket.h
index e42df89a0b85..fdff1e995c73 100644
--- a/arch/s390/include/asm/socket.h
+++ b/arch/s390/include/asm/socket.h
@@ -68,4 +68,6 @@
68#define SO_PROTOCOL 38 68#define SO_PROTOCOL 38
69#define SO_DOMAIN 39 69#define SO_DOMAIN 39
70 70
71#define SO_RXQ_OVFL 40
72
71#endif /* _ASM_SOCKET_H */ 73#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/include/asm/sockios.h b/arch/s390/include/asm/sockios.h
index f4fc16c7da59..6f60eee73242 100644
--- a/arch/s390/include/asm/sockios.h
+++ b/arch/s390/include/asm/sockios.h
@@ -1,21 +1,6 @@
1/* 1#ifndef _ASM_S390_SOCKIOS_H
2 * include/asm-s390/sockios.h 2#define _ASM_S390_SOCKIOS_H
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/sockios.h"
7 */
8 3
9#ifndef __ARCH_S390_SOCKIOS__ 4#include <asm-generic/sockios.h>
10#define __ARCH_S390_SOCKIOS__
11
12/* Socket-level I/O control calls. */
13#define FIOSETOWN 0x8901
14#define SIOCSPGRP 0x8902
15#define FIOGETOWN 0x8903
16#define SIOCGPGRP 0x8904
17#define SIOCATMARK 0x8905
18#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
19#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
20 5
21#endif 6#endif
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index 41ce6861174e..56612fc8186e 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/smp.h> 14#include <linux/smp.h>
15 15
16#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
17
18static inline int 16static inline int
19_raw_compare_and_swap(volatile unsigned int *lock, 17_raw_compare_and_swap(volatile unsigned int *lock,
20 unsigned int old, unsigned int new) 18 unsigned int old, unsigned int new)
@@ -27,22 +25,6 @@ _raw_compare_and_swap(volatile unsigned int *lock,
27 return old; 25 return old;
28} 26}
29 27
30#else /* __GNUC__ */
31
32static inline int
33_raw_compare_and_swap(volatile unsigned int *lock,
34 unsigned int old, unsigned int new)
35{
36 asm volatile(
37 " cs %0,%3,0(%4)"
38 : "=d" (old), "=m" (*lock)
39 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
40 : "cc", "memory" );
41 return old;
42}
43
44#endif /* __GNUC__ */
45
46/* 28/*
47 * Simple spin lock operations. There are two variants, one clears IRQ's 29 * Simple spin lock operations. There are two variants, one clears IRQ's
48 * on the local processor, one does not. 30 * on the local processor, one does not.
@@ -52,27 +34,27 @@ _raw_compare_and_swap(volatile unsigned int *lock,
52 * (the type definitions are in asm/spinlock_types.h) 34 * (the type definitions are in asm/spinlock_types.h)
53 */ 35 */
54 36
55#define __raw_spin_is_locked(x) ((x)->owner_cpu != 0) 37#define arch_spin_is_locked(x) ((x)->owner_cpu != 0)
56#define __raw_spin_unlock_wait(lock) \ 38#define arch_spin_unlock_wait(lock) \
57 do { while (__raw_spin_is_locked(lock)) \ 39 do { while (arch_spin_is_locked(lock)) \
58 _raw_spin_relax(lock); } while (0) 40 arch_spin_relax(lock); } while (0)
59 41
60extern void _raw_spin_lock_wait(raw_spinlock_t *); 42extern void arch_spin_lock_wait(arch_spinlock_t *);
61extern void _raw_spin_lock_wait_flags(raw_spinlock_t *, unsigned long flags); 43extern void arch_spin_lock_wait_flags(arch_spinlock_t *, unsigned long flags);
62extern int _raw_spin_trylock_retry(raw_spinlock_t *); 44extern int arch_spin_trylock_retry(arch_spinlock_t *);
63extern void _raw_spin_relax(raw_spinlock_t *lock); 45extern void arch_spin_relax(arch_spinlock_t *lock);
64 46
65static inline void __raw_spin_lock(raw_spinlock_t *lp) 47static inline void arch_spin_lock(arch_spinlock_t *lp)
66{ 48{
67 int old; 49 int old;
68 50
69 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id()); 51 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
70 if (likely(old == 0)) 52 if (likely(old == 0))
71 return; 53 return;
72 _raw_spin_lock_wait(lp); 54 arch_spin_lock_wait(lp);
73} 55}
74 56
75static inline void __raw_spin_lock_flags(raw_spinlock_t *lp, 57static inline void arch_spin_lock_flags(arch_spinlock_t *lp,
76 unsigned long flags) 58 unsigned long flags)
77{ 59{
78 int old; 60 int old;
@@ -80,20 +62,20 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lp,
80 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id()); 62 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
81 if (likely(old == 0)) 63 if (likely(old == 0))
82 return; 64 return;
83 _raw_spin_lock_wait_flags(lp, flags); 65 arch_spin_lock_wait_flags(lp, flags);
84} 66}
85 67
86static inline int __raw_spin_trylock(raw_spinlock_t *lp) 68static inline int arch_spin_trylock(arch_spinlock_t *lp)
87{ 69{
88 int old; 70 int old;
89 71
90 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id()); 72 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
91 if (likely(old == 0)) 73 if (likely(old == 0))
92 return 1; 74 return 1;
93 return _raw_spin_trylock_retry(lp); 75 return arch_spin_trylock_retry(lp);
94} 76}
95 77
96static inline void __raw_spin_unlock(raw_spinlock_t *lp) 78static inline void arch_spin_unlock(arch_spinlock_t *lp)
97{ 79{
98 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0); 80 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0);
99} 81}
@@ -113,22 +95,22 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lp)
113 * read_can_lock - would read_trylock() succeed? 95 * read_can_lock - would read_trylock() succeed?
114 * @lock: the rwlock in question. 96 * @lock: the rwlock in question.
115 */ 97 */
116#define __raw_read_can_lock(x) ((int)(x)->lock >= 0) 98#define arch_read_can_lock(x) ((int)(x)->lock >= 0)
117 99
118/** 100/**
119 * write_can_lock - would write_trylock() succeed? 101 * write_can_lock - would write_trylock() succeed?
120 * @lock: the rwlock in question. 102 * @lock: the rwlock in question.
121 */ 103 */
122#define __raw_write_can_lock(x) ((x)->lock == 0) 104#define arch_write_can_lock(x) ((x)->lock == 0)
123 105
124extern void _raw_read_lock_wait(raw_rwlock_t *lp); 106extern void _raw_read_lock_wait(arch_rwlock_t *lp);
125extern void _raw_read_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags); 107extern void _raw_read_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags);
126extern int _raw_read_trylock_retry(raw_rwlock_t *lp); 108extern int _raw_read_trylock_retry(arch_rwlock_t *lp);
127extern void _raw_write_lock_wait(raw_rwlock_t *lp); 109extern void _raw_write_lock_wait(arch_rwlock_t *lp);
128extern void _raw_write_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags); 110extern void _raw_write_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags);
129extern int _raw_write_trylock_retry(raw_rwlock_t *lp); 111extern int _raw_write_trylock_retry(arch_rwlock_t *lp);
130 112
131static inline void __raw_read_lock(raw_rwlock_t *rw) 113static inline void arch_read_lock(arch_rwlock_t *rw)
132{ 114{
133 unsigned int old; 115 unsigned int old;
134 old = rw->lock & 0x7fffffffU; 116 old = rw->lock & 0x7fffffffU;
@@ -136,7 +118,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
136 _raw_read_lock_wait(rw); 118 _raw_read_lock_wait(rw);
137} 119}
138 120
139static inline void __raw_read_lock_flags(raw_rwlock_t *rw, unsigned long flags) 121static inline void arch_read_lock_flags(arch_rwlock_t *rw, unsigned long flags)
140{ 122{
141 unsigned int old; 123 unsigned int old;
142 old = rw->lock & 0x7fffffffU; 124 old = rw->lock & 0x7fffffffU;
@@ -144,7 +126,7 @@ static inline void __raw_read_lock_flags(raw_rwlock_t *rw, unsigned long flags)
144 _raw_read_lock_wait_flags(rw, flags); 126 _raw_read_lock_wait_flags(rw, flags);
145} 127}
146 128
147static inline void __raw_read_unlock(raw_rwlock_t *rw) 129static inline void arch_read_unlock(arch_rwlock_t *rw)
148{ 130{
149 unsigned int old, cmp; 131 unsigned int old, cmp;
150 132
@@ -155,24 +137,24 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
155 } while (cmp != old); 137 } while (cmp != old);
156} 138}
157 139
158static inline void __raw_write_lock(raw_rwlock_t *rw) 140static inline void arch_write_lock(arch_rwlock_t *rw)
159{ 141{
160 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) 142 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
161 _raw_write_lock_wait(rw); 143 _raw_write_lock_wait(rw);
162} 144}
163 145
164static inline void __raw_write_lock_flags(raw_rwlock_t *rw, unsigned long flags) 146static inline void arch_write_lock_flags(arch_rwlock_t *rw, unsigned long flags)
165{ 147{
166 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) 148 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
167 _raw_write_lock_wait_flags(rw, flags); 149 _raw_write_lock_wait_flags(rw, flags);
168} 150}
169 151
170static inline void __raw_write_unlock(raw_rwlock_t *rw) 152static inline void arch_write_unlock(arch_rwlock_t *rw)
171{ 153{
172 _raw_compare_and_swap(&rw->lock, 0x80000000, 0); 154 _raw_compare_and_swap(&rw->lock, 0x80000000, 0);
173} 155}
174 156
175static inline int __raw_read_trylock(raw_rwlock_t *rw) 157static inline int arch_read_trylock(arch_rwlock_t *rw)
176{ 158{
177 unsigned int old; 159 unsigned int old;
178 old = rw->lock & 0x7fffffffU; 160 old = rw->lock & 0x7fffffffU;
@@ -181,43 +163,14 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
181 return _raw_read_trylock_retry(rw); 163 return _raw_read_trylock_retry(rw);
182} 164}
183 165
184static inline int __raw_write_trylock(raw_rwlock_t *rw) 166static inline int arch_write_trylock(arch_rwlock_t *rw)
185{ 167{
186 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) 168 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0))
187 return 1; 169 return 1;
188 return _raw_write_trylock_retry(rw); 170 return _raw_write_trylock_retry(rw);
189} 171}
190 172
191#define _raw_read_relax(lock) cpu_relax() 173#define arch_read_relax(lock) cpu_relax()
192#define _raw_write_relax(lock) cpu_relax() 174#define arch_write_relax(lock) cpu_relax()
193
194#define __always_inline__spin_lock
195#define __always_inline__read_lock
196#define __always_inline__write_lock
197#define __always_inline__spin_lock_bh
198#define __always_inline__read_lock_bh
199#define __always_inline__write_lock_bh
200#define __always_inline__spin_lock_irq
201#define __always_inline__read_lock_irq
202#define __always_inline__write_lock_irq
203#define __always_inline__spin_lock_irqsave
204#define __always_inline__read_lock_irqsave
205#define __always_inline__write_lock_irqsave
206#define __always_inline__spin_trylock
207#define __always_inline__read_trylock
208#define __always_inline__write_trylock
209#define __always_inline__spin_trylock_bh
210#define __always_inline__spin_unlock
211#define __always_inline__read_unlock
212#define __always_inline__write_unlock
213#define __always_inline__spin_unlock_bh
214#define __always_inline__read_unlock_bh
215#define __always_inline__write_unlock_bh
216#define __always_inline__spin_unlock_irq
217#define __always_inline__read_unlock_irq
218#define __always_inline__write_unlock_irq
219#define __always_inline__spin_unlock_irqrestore
220#define __always_inline__read_unlock_irqrestore
221#define __always_inline__write_unlock_irqrestore
222 175
223#endif /* __ASM_SPINLOCK_H */ 176#endif /* __ASM_SPINLOCK_H */
diff --git a/arch/s390/include/asm/spinlock_types.h b/arch/s390/include/asm/spinlock_types.h
index 654abc40de04..9c76656a0af0 100644
--- a/arch/s390/include/asm/spinlock_types.h
+++ b/arch/s390/include/asm/spinlock_types.h
@@ -7,14 +7,14 @@
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned int owner_cpu; 9 volatile unsigned int owner_cpu;
10} __attribute__ ((aligned (4))) raw_spinlock_t; 10} __attribute__ ((aligned (4))) arch_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 12#define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
13 13
14typedef struct { 14typedef struct {
15 volatile unsigned int lock; 15 volatile unsigned int lock;
16} raw_rwlock_t; 16} arch_rwlock_t;
17 17
18#define __RAW_RW_LOCK_UNLOCKED { 0 } 18#define __ARCH_RW_LOCK_UNLOCKED { 0 }
19 19
20#endif 20#endif
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h
index eb18dc1f327b..6bdee21c077e 100644
--- a/arch/s390/include/asm/swab.h
+++ b/arch/s390/include/asm/swab.h
@@ -47,11 +47,11 @@ static inline __u32 __arch_swab32p(const __u32 *x)
47 47
48 asm volatile( 48 asm volatile(
49#ifndef __s390x__ 49#ifndef __s390x__
50 " icm %0,8,3(%1)\n" 50 " icm %0,8,%O1+3(%R1)\n"
51 " icm %0,4,2(%1)\n" 51 " icm %0,4,%O1+2(%R1)\n"
52 " icm %0,2,1(%1)\n" 52 " icm %0,2,%O1+1(%R1)\n"
53 " ic %0,0(%1)" 53 " ic %0,%1"
54 : "=&d" (result) : "a" (x), "m" (*x) : "cc"); 54 : "=&d" (result) : "Q" (*x) : "cc");
55#else /* __s390x__ */ 55#else /* __s390x__ */
56 " lrv %0,%1" 56 " lrv %0,%1"
57 : "=d" (result) : "m" (*x)); 57 : "=d" (result) : "m" (*x));
@@ -77,9 +77,9 @@ static inline __u16 __arch_swab16p(const __u16 *x)
77 77
78 asm volatile( 78 asm volatile(
79#ifndef __s390x__ 79#ifndef __s390x__
80 " icm %0,2,1(%1)\n" 80 " icm %0,2,%O+1(%R1)\n"
81 " ic %0,0(%1)\n" 81 " ic %0,%1\n"
82 : "=&d" (result) : "a" (x), "m" (*x) : "cc"); 82 : "=&d" (result) : "Q" (*x) : "cc");
83#else /* __s390x__ */ 83#else /* __s390x__ */
84 " lrvh %0,%1" 84 " lrvh %0,%1"
85 : "=d" (result) : "m" (*x)); 85 : "=d" (result) : "m" (*x));
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index e0a73d3eb837..8429686951f9 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -15,6 +15,13 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17 17
18/*
19 * The syscall table always contains 32 bit pointers since we know that the
20 * address of the function to be called is (way) below 4GB. So the "int"
21 * type here is what we want [need] for both 32 bit and 64 bit systems.
22 */
23extern const unsigned int sys_call_table[];
24
18static inline long syscall_get_nr(struct task_struct *task, 25static inline long syscall_get_nr(struct task_struct *task,
19 struct pt_regs *regs) 26 struct pt_regs *regs)
20{ 27{
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 9d70057d828c..22bdb2a0ee5f 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -87,7 +87,8 @@ struct sysinfo_2_2_2 {
87 87
88struct sysinfo_3_2_2 { 88struct sysinfo_3_2_2 {
89 char reserved_0[31]; 89 char reserved_0[31];
90 unsigned char count; 90 unsigned char :4;
91 unsigned char count:4;
91 struct { 92 struct {
92 char reserved_0[4]; 93 char reserved_0[4];
93 unsigned short cpus_total; 94 unsigned short cpus_total;
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
index 379661d2f81a..1741c1556a4e 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
@@ -24,65 +24,65 @@ extern struct task_struct *__switch_to(void *, void *);
24static inline void save_fp_regs(s390_fp_regs *fpregs) 24static inline void save_fp_regs(s390_fp_regs *fpregs)
25{ 25{
26 asm volatile( 26 asm volatile(
27 " std 0,8(%1)\n" 27 " std 0,%O0+8(%R0)\n"
28 " std 2,24(%1)\n" 28 " std 2,%O0+24(%R0)\n"
29 " std 4,40(%1)\n" 29 " std 4,%O0+40(%R0)\n"
30 " std 6,56(%1)" 30 " std 6,%O0+56(%R0)"
31 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory"); 31 : "=Q" (*fpregs) : "Q" (*fpregs));
32 if (!MACHINE_HAS_IEEE) 32 if (!MACHINE_HAS_IEEE)
33 return; 33 return;
34 asm volatile( 34 asm volatile(
35 " stfpc 0(%1)\n" 35 " stfpc %0\n"
36 " std 1,16(%1)\n" 36 " std 1,%O0+16(%R0)\n"
37 " std 3,32(%1)\n" 37 " std 3,%O0+32(%R0)\n"
38 " std 5,48(%1)\n" 38 " std 5,%O0+48(%R0)\n"
39 " std 7,64(%1)\n" 39 " std 7,%O0+64(%R0)\n"
40 " std 8,72(%1)\n" 40 " std 8,%O0+72(%R0)\n"
41 " std 9,80(%1)\n" 41 " std 9,%O0+80(%R0)\n"
42 " std 10,88(%1)\n" 42 " std 10,%O0+88(%R0)\n"
43 " std 11,96(%1)\n" 43 " std 11,%O0+96(%R0)\n"
44 " std 12,104(%1)\n" 44 " std 12,%O0+104(%R0)\n"
45 " std 13,112(%1)\n" 45 " std 13,%O0+112(%R0)\n"
46 " std 14,120(%1)\n" 46 " std 14,%O0+120(%R0)\n"
47 " std 15,128(%1)\n" 47 " std 15,%O0+128(%R0)\n"
48 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory"); 48 : "=Q" (*fpregs) : "Q" (*fpregs));
49} 49}
50 50
51static inline void restore_fp_regs(s390_fp_regs *fpregs) 51static inline void restore_fp_regs(s390_fp_regs *fpregs)
52{ 52{
53 asm volatile( 53 asm volatile(
54 " ld 0,8(%0)\n" 54 " ld 0,%O0+8(%R0)\n"
55 " ld 2,24(%0)\n" 55 " ld 2,%O0+24(%R0)\n"
56 " ld 4,40(%0)\n" 56 " ld 4,%O0+40(%R0)\n"
57 " ld 6,56(%0)" 57 " ld 6,%O0+56(%R0)"
58 : : "a" (fpregs), "m" (*fpregs)); 58 : : "Q" (*fpregs));
59 if (!MACHINE_HAS_IEEE) 59 if (!MACHINE_HAS_IEEE)
60 return; 60 return;
61 asm volatile( 61 asm volatile(
62 " lfpc 0(%0)\n" 62 " lfpc %0\n"
63 " ld 1,16(%0)\n" 63 " ld 1,%O0+16(%R0)\n"
64 " ld 3,32(%0)\n" 64 " ld 3,%O0+32(%R0)\n"
65 " ld 5,48(%0)\n" 65 " ld 5,%O0+48(%R0)\n"
66 " ld 7,64(%0)\n" 66 " ld 7,%O0+64(%R0)\n"
67 " ld 8,72(%0)\n" 67 " ld 8,%O0+72(%R0)\n"
68 " ld 9,80(%0)\n" 68 " ld 9,%O0+80(%R0)\n"
69 " ld 10,88(%0)\n" 69 " ld 10,%O0+88(%R0)\n"
70 " ld 11,96(%0)\n" 70 " ld 11,%O0+96(%R0)\n"
71 " ld 12,104(%0)\n" 71 " ld 12,%O0+104(%R0)\n"
72 " ld 13,112(%0)\n" 72 " ld 13,%O0+112(%R0)\n"
73 " ld 14,120(%0)\n" 73 " ld 14,%O0+120(%R0)\n"
74 " ld 15,128(%0)\n" 74 " ld 15,%O0+128(%R0)\n"
75 : : "a" (fpregs), "m" (*fpregs)); 75 : : "Q" (*fpregs));
76} 76}
77 77
78static inline void save_access_regs(unsigned int *acrs) 78static inline void save_access_regs(unsigned int *acrs)
79{ 79{
80 asm volatile("stam 0,15,0(%0)" : : "a" (acrs) : "memory"); 80 asm volatile("stam 0,15,%0" : "=Q" (*acrs));
81} 81}
82 82
83static inline void restore_access_regs(unsigned int *acrs) 83static inline void restore_access_regs(unsigned int *acrs)
84{ 84{
85 asm volatile("lam 0,15,0(%0)" : : "a" (acrs)); 85 asm volatile("lam 0,15,%0" : : "Q" (*acrs));
86} 86}
87 87
88#define switch_to(prev,next,last) do { \ 88#define switch_to(prev,next,last) do { \
@@ -110,6 +110,7 @@ extern void pfault_fini(void);
110#endif /* CONFIG_PFAULT */ 110#endif /* CONFIG_PFAULT */
111 111
112extern void cmma_init(void); 112extern void cmma_init(void);
113extern int memcpy_real(void *, void *, size_t);
113 114
114#define finish_arch_switch(prev) do { \ 115#define finish_arch_switch(prev) do { \
115 set_fs(current->thread.mm_segment); \ 116 set_fs(current->thread.mm_segment); \
@@ -139,48 +140,48 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
139 shift = (3 ^ (addr & 3)) << 3; 140 shift = (3 ^ (addr & 3)) << 3;
140 addr ^= addr & 3; 141 addr ^= addr & 3;
141 asm volatile( 142 asm volatile(
142 " l %0,0(%4)\n" 143 " l %0,%4\n"
143 "0: lr 0,%0\n" 144 "0: lr 0,%0\n"
144 " nr 0,%3\n" 145 " nr 0,%3\n"
145 " or 0,%2\n" 146 " or 0,%2\n"
146 " cs %0,0,0(%4)\n" 147 " cs %0,0,%4\n"
147 " jl 0b\n" 148 " jl 0b\n"
148 : "=&d" (old), "=m" (*(int *) addr) 149 : "=&d" (old), "=Q" (*(int *) addr)
149 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), 150 : "d" (x << shift), "d" (~(255 << shift)),
150 "m" (*(int *) addr) : "memory", "cc", "0"); 151 "Q" (*(int *) addr) : "memory", "cc", "0");
151 return old >> shift; 152 return old >> shift;
152 case 2: 153 case 2:
153 addr = (unsigned long) ptr; 154 addr = (unsigned long) ptr;
154 shift = (2 ^ (addr & 2)) << 3; 155 shift = (2 ^ (addr & 2)) << 3;
155 addr ^= addr & 2; 156 addr ^= addr & 2;
156 asm volatile( 157 asm volatile(
157 " l %0,0(%4)\n" 158 " l %0,%4\n"
158 "0: lr 0,%0\n" 159 "0: lr 0,%0\n"
159 " nr 0,%3\n" 160 " nr 0,%3\n"
160 " or 0,%2\n" 161 " or 0,%2\n"
161 " cs %0,0,0(%4)\n" 162 " cs %0,0,%4\n"
162 " jl 0b\n" 163 " jl 0b\n"
163 : "=&d" (old), "=m" (*(int *) addr) 164 : "=&d" (old), "=Q" (*(int *) addr)
164 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), 165 : "d" (x << shift), "d" (~(65535 << shift)),
165 "m" (*(int *) addr) : "memory", "cc", "0"); 166 "Q" (*(int *) addr) : "memory", "cc", "0");
166 return old >> shift; 167 return old >> shift;
167 case 4: 168 case 4:
168 asm volatile( 169 asm volatile(
169 " l %0,0(%3)\n" 170 " l %0,%3\n"
170 "0: cs %0,%2,0(%3)\n" 171 "0: cs %0,%2,%3\n"
171 " jl 0b\n" 172 " jl 0b\n"
172 : "=&d" (old), "=m" (*(int *) ptr) 173 : "=&d" (old), "=Q" (*(int *) ptr)
173 : "d" (x), "a" (ptr), "m" (*(int *) ptr) 174 : "d" (x), "Q" (*(int *) ptr)
174 : "memory", "cc"); 175 : "memory", "cc");
175 return old; 176 return old;
176#ifdef __s390x__ 177#ifdef __s390x__
177 case 8: 178 case 8:
178 asm volatile( 179 asm volatile(
179 " lg %0,0(%3)\n" 180 " lg %0,%3\n"
180 "0: csg %0,%2,0(%3)\n" 181 "0: csg %0,%2,%3\n"
181 " jl 0b\n" 182 " jl 0b\n"
182 : "=&d" (old), "=m" (*(long *) ptr) 183 : "=&d" (old), "=m" (*(long *) ptr)
183 : "d" (x), "a" (ptr), "m" (*(long *) ptr) 184 : "d" (x), "Q" (*(long *) ptr)
184 : "memory", "cc"); 185 : "memory", "cc");
185 return old; 186 return old;
186#endif /* __s390x__ */ 187#endif /* __s390x__ */
@@ -215,20 +216,20 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
215 shift = (3 ^ (addr & 3)) << 3; 216 shift = (3 ^ (addr & 3)) << 3;
216 addr ^= addr & 3; 217 addr ^= addr & 3;
217 asm volatile( 218 asm volatile(
218 " l %0,0(%4)\n" 219 " l %0,%2\n"
219 "0: nr %0,%5\n" 220 "0: nr %0,%5\n"
220 " lr %1,%0\n" 221 " lr %1,%0\n"
221 " or %0,%2\n" 222 " or %0,%3\n"
222 " or %1,%3\n" 223 " or %1,%4\n"
223 " cs %0,%1,0(%4)\n" 224 " cs %0,%1,%2\n"
224 " jnl 1f\n" 225 " jnl 1f\n"
225 " xr %1,%0\n" 226 " xr %1,%0\n"
226 " nr %1,%5\n" 227 " nr %1,%5\n"
227 " jnz 0b\n" 228 " jnz 0b\n"
228 "1:" 229 "1:"
229 : "=&d" (prev), "=&d" (tmp) 230 : "=&d" (prev), "=&d" (tmp), "=Q" (*(int *) ptr)
230 : "d" (old << shift), "d" (new << shift), "a" (ptr), 231 : "d" (old << shift), "d" (new << shift),
231 "d" (~(255 << shift)) 232 "d" (~(255 << shift)), "Q" (*(int *) ptr)
232 : "memory", "cc"); 233 : "memory", "cc");
233 return prev >> shift; 234 return prev >> shift;
234 case 2: 235 case 2:
@@ -236,33 +237,35 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
236 shift = (2 ^ (addr & 2)) << 3; 237 shift = (2 ^ (addr & 2)) << 3;
237 addr ^= addr & 2; 238 addr ^= addr & 2;
238 asm volatile( 239 asm volatile(
239 " l %0,0(%4)\n" 240 " l %0,%2\n"
240 "0: nr %0,%5\n" 241 "0: nr %0,%5\n"
241 " lr %1,%0\n" 242 " lr %1,%0\n"
242 " or %0,%2\n" 243 " or %0,%3\n"
243 " or %1,%3\n" 244 " or %1,%4\n"
244 " cs %0,%1,0(%4)\n" 245 " cs %0,%1,%2\n"
245 " jnl 1f\n" 246 " jnl 1f\n"
246 " xr %1,%0\n" 247 " xr %1,%0\n"
247 " nr %1,%5\n" 248 " nr %1,%5\n"
248 " jnz 0b\n" 249 " jnz 0b\n"
249 "1:" 250 "1:"
250 : "=&d" (prev), "=&d" (tmp) 251 : "=&d" (prev), "=&d" (tmp), "=Q" (*(int *) ptr)
251 : "d" (old << shift), "d" (new << shift), "a" (ptr), 252 : "d" (old << shift), "d" (new << shift),
252 "d" (~(65535 << shift)) 253 "d" (~(65535 << shift)), "Q" (*(int *) ptr)
253 : "memory", "cc"); 254 : "memory", "cc");
254 return prev >> shift; 255 return prev >> shift;
255 case 4: 256 case 4:
256 asm volatile( 257 asm volatile(
257 " cs %0,%2,0(%3)\n" 258 " cs %0,%3,%1\n"
258 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 259 : "=&d" (prev), "=Q" (*(int *) ptr)
260 : "0" (old), "d" (new), "Q" (*(int *) ptr)
259 : "memory", "cc"); 261 : "memory", "cc");
260 return prev; 262 return prev;
261#ifdef __s390x__ 263#ifdef __s390x__
262 case 8: 264 case 8:
263 asm volatile( 265 asm volatile(
264 " csg %0,%2,0(%3)\n" 266 " csg %0,%3,%1\n"
265 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) 267 : "=&d" (prev), "=Q" (*(long *) ptr)
268 : "0" (old), "d" (new), "Q" (*(long *) ptr)
266 : "memory", "cc"); 269 : "memory", "cc");
267 return prev; 270 return prev;
268#endif /* __s390x__ */ 271#endif /* __s390x__ */
@@ -302,17 +305,17 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
302#define __ctl_load(array, low, high) ({ \ 305#define __ctl_load(array, low, high) ({ \
303 typedef struct { char _[sizeof(array)]; } addrtype; \ 306 typedef struct { char _[sizeof(array)]; } addrtype; \
304 asm volatile( \ 307 asm volatile( \
305 " lctlg %1,%2,0(%0)\n" \ 308 " lctlg %1,%2,%0\n" \
306 : : "a" (&array), "i" (low), "i" (high), \ 309 : : "Q" (*(addrtype *)(&array)), \
307 "m" (*(addrtype *)(&array))); \ 310 "i" (low), "i" (high)); \
308 }) 311 })
309 312
310#define __ctl_store(array, low, high) ({ \ 313#define __ctl_store(array, low, high) ({ \
311 typedef struct { char _[sizeof(array)]; } addrtype; \ 314 typedef struct { char _[sizeof(array)]; } addrtype; \
312 asm volatile( \ 315 asm volatile( \
313 " stctg %2,%3,0(%1)\n" \ 316 " stctg %1,%2,%0\n" \
314 : "=m" (*(addrtype *)(&array)) \ 317 : "=Q" (*(addrtype *)(&array)) \
315 : "a" (&array), "i" (low), "i" (high)); \ 318 : "i" (low), "i" (high)); \
316 }) 319 })
317 320
318#else /* __s390x__ */ 321#else /* __s390x__ */
@@ -320,17 +323,17 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
320#define __ctl_load(array, low, high) ({ \ 323#define __ctl_load(array, low, high) ({ \
321 typedef struct { char _[sizeof(array)]; } addrtype; \ 324 typedef struct { char _[sizeof(array)]; } addrtype; \
322 asm volatile( \ 325 asm volatile( \
323 " lctl %1,%2,0(%0)\n" \ 326 " lctl %1,%2,%0\n" \
324 : : "a" (&array), "i" (low), "i" (high), \ 327 : : "Q" (*(addrtype *)(&array)), \
325 "m" (*(addrtype *)(&array))); \ 328 "i" (low), "i" (high)); \
326}) 329})
327 330
328#define __ctl_store(array, low, high) ({ \ 331#define __ctl_store(array, low, high) ({ \
329 typedef struct { char _[sizeof(array)]; } addrtype; \ 332 typedef struct { char _[sizeof(array)]; } addrtype; \
330 asm volatile( \ 333 asm volatile( \
331 " stctl %2,%3,0(%1)\n" \ 334 " stctl %1,%2,%0\n" \
332 : "=m" (*(addrtype *)(&array)) \ 335 : "=Q" (*(addrtype *)(&array)) \
333 : "a" (&array), "i" (low), "i" (high)); \ 336 : "i" (low), "i" (high)); \
334 }) 337 })
335 338
336#endif /* __s390x__ */ 339#endif /* __s390x__ */
diff --git a/arch/s390/include/asm/termbits.h b/arch/s390/include/asm/termbits.h
index 58731853d529..71bf6ac6a2b9 100644
--- a/arch/s390/include/asm/termbits.h
+++ b/arch/s390/include/asm/termbits.h
@@ -1,206 +1,6 @@
1/* 1#ifndef _ASM_S390_TERMBITS_H
2 * include/asm-s390/termbits.h 2#define _ASM_S390_TERMBITS_H
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/termbits.h"
7 */
8 3
9#ifndef __ARCH_S390_TERMBITS_H__ 4#include <asm-generic/termbits.h>
10#define __ARCH_S390_TERMBITS_H__
11
12#include <linux/posix_types.h>
13
14typedef unsigned char cc_t;
15typedef unsigned int speed_t;
16typedef unsigned int tcflag_t;
17
18#define NCCS 19
19struct termios {
20 tcflag_t c_iflag; /* input mode flags */
21 tcflag_t c_oflag; /* output mode flags */
22 tcflag_t c_cflag; /* control mode flags */
23 tcflag_t c_lflag; /* local mode flags */
24 cc_t c_line; /* line discipline */
25 cc_t c_cc[NCCS]; /* control characters */
26};
27
28struct termios2 {
29 tcflag_t c_iflag; /* input mode flags */
30 tcflag_t c_oflag; /* output mode flags */
31 tcflag_t c_cflag; /* control mode flags */
32 tcflag_t c_lflag; /* local mode flags */
33 cc_t c_line; /* line discipline */
34 cc_t c_cc[NCCS]; /* control characters */
35 speed_t c_ispeed; /* input speed */
36 speed_t c_ospeed; /* output speed */
37};
38
39struct ktermios {
40 tcflag_t c_iflag; /* input mode flags */
41 tcflag_t c_oflag; /* output mode flags */
42 tcflag_t c_cflag; /* control mode flags */
43 tcflag_t c_lflag; /* local mode flags */
44 cc_t c_line; /* line discipline */
45 cc_t c_cc[NCCS]; /* control characters */
46 speed_t c_ispeed; /* input speed */
47 speed_t c_ospeed; /* output speed */
48};
49
50/* c_cc characters */
51#define VINTR 0
52#define VQUIT 1
53#define VERASE 2
54#define VKILL 3
55#define VEOF 4
56#define VTIME 5
57#define VMIN 6
58#define VSWTC 7
59#define VSTART 8
60#define VSTOP 9
61#define VSUSP 10
62#define VEOL 11
63#define VREPRINT 12
64#define VDISCARD 13
65#define VWERASE 14
66#define VLNEXT 15
67#define VEOL2 16
68
69/* c_iflag bits */
70#define IGNBRK 0000001
71#define BRKINT 0000002
72#define IGNPAR 0000004
73#define PARMRK 0000010
74#define INPCK 0000020
75#define ISTRIP 0000040
76#define INLCR 0000100
77#define IGNCR 0000200
78#define ICRNL 0000400
79#define IUCLC 0001000
80#define IXON 0002000
81#define IXANY 0004000
82#define IXOFF 0010000
83#define IMAXBEL 0020000
84#define IUTF8 0040000
85
86/* c_oflag bits */
87#define OPOST 0000001
88#define OLCUC 0000002
89#define ONLCR 0000004
90#define OCRNL 0000010
91#define ONOCR 0000020
92#define ONLRET 0000040
93#define OFILL 0000100
94#define OFDEL 0000200
95#define NLDLY 0000400
96#define NL0 0000000
97#define NL1 0000400
98#define CRDLY 0003000
99#define CR0 0000000
100#define CR1 0001000
101#define CR2 0002000
102#define CR3 0003000
103#define TABDLY 0014000
104#define TAB0 0000000
105#define TAB1 0004000
106#define TAB2 0010000
107#define TAB3 0014000
108#define XTABS 0014000
109#define BSDLY 0020000
110#define BS0 0000000
111#define BS1 0020000
112#define VTDLY 0040000
113#define VT0 0000000
114#define VT1 0040000
115#define FFDLY 0100000
116#define FF0 0000000
117#define FF1 0100000
118
119/* c_cflag bit meaning */
120#define CBAUD 0010017
121#define B0 0000000 /* hang up */
122#define B50 0000001
123#define B75 0000002
124#define B110 0000003
125#define B134 0000004
126#define B150 0000005
127#define B200 0000006
128#define B300 0000007
129#define B600 0000010
130#define B1200 0000011
131#define B1800 0000012
132#define B2400 0000013
133#define B4800 0000014
134#define B9600 0000015
135#define B19200 0000016
136#define B38400 0000017
137#define EXTA B19200
138#define EXTB B38400
139#define CSIZE 0000060
140#define CS5 0000000
141#define CS6 0000020
142#define CS7 0000040
143#define CS8 0000060
144#define CSTOPB 0000100
145#define CREAD 0000200
146#define PARENB 0000400
147#define PARODD 0001000
148#define HUPCL 0002000
149#define CLOCAL 0004000
150#define CBAUDEX 0010000
151#define BOTHER 0010000
152#define B57600 0010001
153#define B115200 0010002
154#define B230400 0010003
155#define B460800 0010004
156#define B500000 0010005
157#define B576000 0010006
158#define B921600 0010007
159#define B1000000 0010010
160#define B1152000 0010011
161#define B1500000 0010012
162#define B2000000 0010013
163#define B2500000 0010014
164#define B3000000 0010015
165#define B3500000 0010016
166#define B4000000 0010017
167#define CIBAUD 002003600000 /* input baud rate */
168#define CMSPAR 010000000000 /* mark or space (stick) parity */
169#define CRTSCTS 020000000000 /* flow control */
170
171#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
172
173/* c_lflag bits */
174#define ISIG 0000001
175#define ICANON 0000002
176#define XCASE 0000004
177#define ECHO 0000010
178#define ECHOE 0000020
179#define ECHOK 0000040
180#define ECHONL 0000100
181#define NOFLSH 0000200
182#define TOSTOP 0000400
183#define ECHOCTL 0001000
184#define ECHOPRT 0002000
185#define ECHOKE 0004000
186#define FLUSHO 0010000
187#define PENDIN 0040000
188#define IEXTEN 0100000
189
190/* tcflow() and TCXONC use these */
191#define TCOOFF 0
192#define TCOON 1
193#define TCIOFF 2
194#define TCION 3
195
196/* tcflush() and TCFLSH use these */
197#define TCIFLUSH 0
198#define TCOFLUSH 1
199#define TCIOFLUSH 2
200
201/* tcsetattr uses these */
202#define TCSANOW 0
203#define TCSADRAIN 1
204#define TCSAFLUSH 2
205 5
206#endif 6#endif
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 07eb61b2fb3a..34f0873d6525 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -73,7 +73,7 @@ struct thread_info {
73/* how to get the thread information struct from C */ 73/* how to get the thread information struct from C */
74static inline struct thread_info *current_thread_info(void) 74static inline struct thread_info *current_thread_info(void)
75{ 75{
76 return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE); 76 return (struct thread_info *)(S390_lowcore.kernel_stack - THREAD_SIZE);
77} 77}
78 78
79#define THREAD_SIZE_ORDER THREAD_ORDER 79#define THREAD_SIZE_ORDER THREAD_ORDER
@@ -93,13 +93,12 @@ static inline struct thread_info *current_thread_info(void)
93#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 93#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
94#define TIF_SECCOMP 10 /* secure computing */ 94#define TIF_SECCOMP 10 /* secure computing */
95#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 95#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
96#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 96#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
97#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
98 TIF_NEED_RESCHED */ 97 TIF_NEED_RESCHED */
99#define TIF_31BIT 18 /* 32bit process */ 98#define TIF_31BIT 17 /* 32bit process */
100#define TIF_MEMDIE 19 99#define TIF_MEMDIE 18
101#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 100#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
102#define TIF_FREEZE 21 /* thread is freezing for suspend */ 101#define TIF_FREEZE 20 /* thread is freezing for suspend */
103 102
104#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 103#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
105#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 104#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
@@ -112,7 +111,6 @@ static inline struct thread_info *current_thread_info(void)
112#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 111#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
113#define _TIF_SECCOMP (1<<TIF_SECCOMP) 112#define _TIF_SECCOMP (1<<TIF_SECCOMP)
114#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 113#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
115#define _TIF_USEDFPU (1<<TIF_USEDFPU)
116#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 114#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
117#define _TIF_31BIT (1<<TIF_31BIT) 115#define _TIF_31BIT (1<<TIF_31BIT)
118#define _TIF_FREEZE (1<<TIF_FREEZE) 116#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 68d9fea34b4b..f174bdaa6b59 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -20,10 +20,10 @@ static inline int set_clock(__u64 time)
20 int cc; 20 int cc;
21 21
22 asm volatile( 22 asm volatile(
23 " sck 0(%2)\n" 23 " sck %1\n"
24 " ipm %0\n" 24 " ipm %0\n"
25 " srl %0,28\n" 25 " srl %0,28\n"
26 : "=d" (cc) : "m" (time), "a" (&time) : "cc"); 26 : "=d" (cc) : "Q" (time) : "cc");
27 return cc; 27 return cc;
28} 28}
29 29
@@ -32,21 +32,21 @@ static inline int store_clock(__u64 *time)
32 int cc; 32 int cc;
33 33
34 asm volatile( 34 asm volatile(
35 " stck 0(%2)\n" 35 " stck %1\n"
36 " ipm %0\n" 36 " ipm %0\n"
37 " srl %0,28\n" 37 " srl %0,28\n"
38 : "=d" (cc), "=m" (*time) : "a" (time) : "cc"); 38 : "=d" (cc), "=Q" (*time) : : "cc");
39 return cc; 39 return cc;
40} 40}
41 41
42static inline void set_clock_comparator(__u64 time) 42static inline void set_clock_comparator(__u64 time)
43{ 43{
44 asm volatile("sckc 0(%1)" : : "m" (time), "a" (&time)); 44 asm volatile("sckc %0" : : "Q" (time));
45} 45}
46 46
47static inline void store_clock_comparator(__u64 *time) 47static inline void store_clock_comparator(__u64 *time)
48{ 48{
49 asm volatile("stckc 0(%1)" : "=m" (*time) : "a" (time)); 49 asm volatile("stckc %0" : "=Q" (*time));
50} 50}
51 51
52#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ 52#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
@@ -57,11 +57,7 @@ static inline unsigned long long get_clock (void)
57{ 57{
58 unsigned long long clk; 58 unsigned long long clk;
59 59
60#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
61 asm volatile("stck %0" : "=Q" (clk) : : "cc"); 60 asm volatile("stck %0" : "=Q" (clk) : : "cc");
62#else /* __GNUC__ */
63 asm volatile("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc");
64#endif /* __GNUC__ */
65 return clk; 61 return clk;
66} 62}
67 63
@@ -69,13 +65,7 @@ static inline unsigned long long get_clock_xt(void)
69{ 65{
70 unsigned char clk[16]; 66 unsigned char clk[16];
71 67
72#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
73 asm volatile("stcke %0" : "=Q" (clk) : : "cc"); 68 asm volatile("stcke %0" : "=Q" (clk) : : "cc");
74#else /* __GNUC__ */
75 asm volatile("stcke 0(%1)" : "=m" (clk)
76 : "a" (clk) : "cc");
77#endif /* __GNUC__ */
78
79 return *((unsigned long long *)&clk[1]); 69 return *((unsigned long long *)&clk[1]);
80} 70}
81 71
diff --git a/arch/s390/include/asm/todclk.h b/arch/s390/include/asm/todclk.h
deleted file mode 100644
index c7f62055488a..000000000000
--- a/arch/s390/include/asm/todclk.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * File...........: linux/include/asm/todclk.h
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 *
7 * History of changes (starts July 2000)
8 */
9
10#ifndef __ASM_TODCLK_H
11#define __ASM_TODCLK_H
12
13#ifdef __KERNEL__
14
15#define TOD_uSEC (0x1000ULL)
16#define TOD_mSEC (1000 * TOD_uSEC)
17#define TOD_SEC (1000 * TOD_mSEC)
18#define TOD_MIN (60 * TOD_SEC)
19#define TOD_HOUR (60 * TOD_MIN)
20
21#endif
22
23#endif
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index 8377e91533d2..d6b1ed0ec52b 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -93,6 +93,8 @@ extern struct uaccess_ops uaccess_mvcos;
93extern struct uaccess_ops uaccess_mvcos_switch; 93extern struct uaccess_ops uaccess_mvcos_switch;
94extern struct uaccess_ops uaccess_pt; 94extern struct uaccess_ops uaccess_pt;
95 95
96extern int __handle_fault(unsigned long, unsigned long, int);
97
96static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 98static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
97{ 99{
98 size = uaccess.copy_to_user_small(size, ptr, x); 100 size = uaccess.copy_to_user_small(size, ptr, x);
@@ -263,6 +265,12 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
263 return uaccess.copy_from_user(n, from, to); 265 return uaccess.copy_from_user(n, from, to);
264} 266}
265 267
268extern void copy_from_user_overflow(void)
269#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
270__compiletime_warning("copy_from_user() buffer size is not provably correct")
271#endif
272;
273
266/** 274/**
267 * copy_from_user: - Copy a block of data from user space. 275 * copy_from_user: - Copy a block of data from user space.
268 * @to: Destination address, in kernel space. 276 * @to: Destination address, in kernel space.
@@ -282,7 +290,13 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
282static inline unsigned long __must_check 290static inline unsigned long __must_check
283copy_from_user(void *to, const void __user *from, unsigned long n) 291copy_from_user(void *to, const void __user *from, unsigned long n)
284{ 292{
293 unsigned int sz = __compiletime_object_size(to);
294
285 might_fault(); 295 might_fault();
296 if (unlikely(sz != -1 && sz < n)) {
297 copy_from_user_overflow();
298 return n;
299 }
286 if (access_ok(VERIFY_READ, from, n)) 300 if (access_ok(VERIFY_READ, from, n))
287 n = __copy_from_user(to, from, n); 301 n = __copy_from_user(to, from, n);
288 else 302 else
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index cb5232df151e..5f0075150a65 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -376,6 +376,9 @@
376#define __IGNORE_migrate_pages 376#define __IGNORE_migrate_pages
377#define __IGNORE_move_pages 377#define __IGNORE_move_pages
378 378
379/* Ignore system calls that are also reachable via sys_socket */
380#define __IGNORE_recvmmsg
381
379#define __ARCH_WANT_IPC_PARSE_VERSION 382#define __ARCH_WANT_IPC_PARSE_VERSION
380#define __ARCH_WANT_OLD_READDIR 383#define __ARCH_WANT_OLD_READDIR
381#define __ARCH_WANT_SYS_ALARM 384#define __ARCH_WANT_SYS_ALARM
@@ -389,6 +392,7 @@
389#define __ARCH_WANT_SYS_LLSEEK 392#define __ARCH_WANT_SYS_LLSEEK
390#define __ARCH_WANT_SYS_NICE 393#define __ARCH_WANT_SYS_NICE
391#define __ARCH_WANT_SYS_OLD_GETRLIMIT 394#define __ARCH_WANT_SYS_OLD_GETRLIMIT
395#define __ARCH_WANT_SYS_OLD_MMAP
392#define __ARCH_WANT_SYS_OLDUMOUNT 396#define __ARCH_WANT_SYS_OLDUMOUNT
393#define __ARCH_WANT_SYS_SIGPENDING 397#define __ARCH_WANT_SYS_SIGPENDING
394#define __ARCH_WANT_SYS_SIGPROCMASK 398#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h
index 7bdd7c8ebc91..533f35751aeb 100644
--- a/arch/s390/include/asm/vdso.h
+++ b/arch/s390/include/asm/vdso.h
@@ -7,7 +7,7 @@
7#define VDSO32_LBASE 0 7#define VDSO32_LBASE 0
8#define VDSO64_LBASE 0 8#define VDSO64_LBASE 0
9 9
10#define VDSO_VERSION_STRING LINUX_2.6.26 10#define VDSO_VERSION_STRING LINUX_2.6.29
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13
@@ -29,6 +29,7 @@ struct vdso_data {
29 __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */ 29 __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */
30 __u32 tz_dsttime; /* Type of dst correction 0x34 */ 30 __u32 tz_dsttime; /* Type of dst correction 0x34 */
31 __u32 ectg_available; 31 __u32 ectg_available;
32 __u32 ntp_mult; /* NTP adjusted multiplier 0x3C */
32}; 33};
33 34
34struct vdso_per_cpu_data { 35struct vdso_per_cpu_data {
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index c7be8e10b87e..64230bc392fa 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -29,9 +29,12 @@ obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
30 30
31extra-y += head.o init_task.o vmlinux.lds 31extra-y += head.o init_task.o vmlinux.lds
32extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o)
32 33
33obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
34obj-$(CONFIG_SMP) += smp.o topology.o 35obj-$(CONFIG_SMP) += smp.o topology.o
36obj-$(CONFIG_SMP) += $(if $(CONFIG_64BIT),switch_cpu64.o, \
37 switch_cpu.o)
35obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o 38obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o
36obj-$(CONFIG_AUDIT) += audit.o 39obj-$(CONFIG_AUDIT) += audit.o
37compat-obj-$(CONFIG_AUDIT) += compat_audit.o 40compat-obj-$(CONFIG_AUDIT) += compat_audit.o
@@ -44,6 +47,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o
44obj-$(CONFIG_FUNCTION_TRACER) += $(if $(CONFIG_64BIT),mcount64.o,mcount.o) 47obj-$(CONFIG_FUNCTION_TRACER) += $(if $(CONFIG_64BIT),mcount64.o,mcount.o)
45obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 48obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
46obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 49obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
50obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
47 51
48# Kexec part 52# Kexec part
49S390_KEXEC_OBJS := machine_kexec.o crash.o 53S390_KEXEC_OBJS := machine_kexec.o crash.o
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 63e46433e81d..a09408952ed0 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -4,18 +4,27 @@
4 * and format the required data. 4 * and format the required data.
5 */ 5 */
6 6
7#include <linux/sched.h> 7#define ASM_OFFSETS_C
8
8#include <linux/kbuild.h> 9#include <linux/kbuild.h>
10#include <linux/sched.h>
9#include <asm/vdso.h> 11#include <asm/vdso.h>
10#include <asm/sigp.h> 12#include <asm/sigp.h>
11 13
14/*
15 * Make sure that the compiler is new enough. We want a compiler that
16 * is known to work with the "Q" assembler constraint.
17 */
18#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
19#error Your compiler is too old; please use version 3.3.3 or newer
20#endif
21
12int main(void) 22int main(void)
13{ 23{
14 DEFINE(__THREAD_info, offsetof(struct task_struct, stack)); 24 DEFINE(__THREAD_info, offsetof(struct task_struct, stack));
15 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp)); 25 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp));
16 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info)); 26 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info));
17 DEFINE(__THREAD_mm_segment, 27 DEFINE(__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment));
18 offsetof(struct task_struct, thread.mm_segment));
19 BLANK(); 28 BLANK();
20 DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); 29 DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
21 BLANK(); 30 BLANK();
@@ -52,18 +61,95 @@ int main(void)
52 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 61 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
53 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest)); 62 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
54 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available)); 63 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
55 DEFINE(__VDSO_ECTG_BASE, 64 DEFINE(__VDSO_NTP_MULT, offsetof(struct vdso_data, ntp_mult));
56 offsetof(struct vdso_per_cpu_data, ectg_timer_base)); 65 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
57 DEFINE(__VDSO_ECTG_USER, 66 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
58 offsetof(struct vdso_per_cpu_data, ectg_user_time));
59 /* constants used by the vdso */ 67 /* constants used by the vdso */
60 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); 68 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
61 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); 69 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
62 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 70 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
71 BLANK();
63 /* constants for SIGP */ 72 /* constants for SIGP */
64 DEFINE(__SIGP_STOP, sigp_stop); 73 DEFINE(__SIGP_STOP, sigp_stop);
65 DEFINE(__SIGP_RESTART, sigp_restart); 74 DEFINE(__SIGP_RESTART, sigp_restart);
66 DEFINE(__SIGP_SENSE, sigp_sense); 75 DEFINE(__SIGP_SENSE, sigp_sense);
67 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset); 76 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset);
77 BLANK();
78 /* lowcore offsets */
79 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
80 DEFINE(__LC_CPU_ADDRESS, offsetof(struct _lowcore, cpu_addr));
81 DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code));
82 DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc));
83 DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code));
84 DEFINE(__LC_PGM_ILC, offsetof(struct _lowcore, pgm_ilc));
85 DEFINE(__LC_PGM_INT_CODE, offsetof(struct _lowcore, pgm_code));
86 DEFINE(__LC_PER_ATMID, offsetof(struct _lowcore, per_perc_atmid));
87 DEFINE(__LC_PER_ADDRESS, offsetof(struct _lowcore, per_address));
88 DEFINE(__LC_PER_ACCESS_ID, offsetof(struct _lowcore, per_access_id));
89 DEFINE(__LC_AR_MODE_ID, offsetof(struct _lowcore, ar_access_id));
90 DEFINE(__LC_SUBCHANNEL_ID, offsetof(struct _lowcore, subchannel_id));
91 DEFINE(__LC_SUBCHANNEL_NR, offsetof(struct _lowcore, subchannel_nr));
92 DEFINE(__LC_IO_INT_PARM, offsetof(struct _lowcore, io_int_parm));
93 DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word));
94 DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list));
95 DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code));
96 DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
97 BLANK();
98 DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
99 DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw));
100 DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw));
101 DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw));
102 DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw));
103 DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw));
104 DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw));
105 DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw));
106 DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw));
107 DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw));
108 DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw));
109 DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw));
110 DEFINE(__LC_SAVE_AREA, offsetof(struct _lowcore, save_area));
111 DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw));
112 DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw));
113 DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer));
114 DEFINE(__LC_ASYNC_ENTER_TIMER, offsetof(struct _lowcore, async_enter_timer));
115 DEFINE(__LC_EXIT_TIMER, offsetof(struct _lowcore, exit_timer));
116 DEFINE(__LC_USER_TIMER, offsetof(struct _lowcore, user_timer));
117 DEFINE(__LC_SYSTEM_TIMER, offsetof(struct _lowcore, system_timer));
118 DEFINE(__LC_STEAL_TIMER, offsetof(struct _lowcore, steal_timer));
119 DEFINE(__LC_LAST_UPDATE_TIMER, offsetof(struct _lowcore, last_update_timer));
120 DEFINE(__LC_LAST_UPDATE_CLOCK, offsetof(struct _lowcore, last_update_clock));
121 DEFINE(__LC_CURRENT, offsetof(struct _lowcore, current_task));
122 DEFINE(__LC_THREAD_INFO, offsetof(struct _lowcore, thread_info));
123 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
124 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
125 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
126 DEFINE(__LC_KERNEL_ASCE, offsetof(struct _lowcore, kernel_asce));
127 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
128 DEFINE(__LC_USER_EXEC_ASCE, offsetof(struct _lowcore, user_exec_asce));
129 DEFINE(__LC_CPUID, offsetof(struct _lowcore, cpu_id));
130 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
131 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
132 DEFINE(__LC_FTRACE_FUNC, offsetof(struct _lowcore, ftrace_func));
133 DEFINE(__LC_IRB, offsetof(struct _lowcore, irb));
134 DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area));
135 DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area));
136 DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area));
137 DEFINE(__LC_PREFIX_SAVE_AREA, offsetof(struct _lowcore, prefixreg_save_area));
138 DEFINE(__LC_AREGS_SAVE_AREA, offsetof(struct _lowcore, access_regs_save_area));
139 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
140 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
141 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
142#ifdef CONFIG_32BIT
143 DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params));
144 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr));
145#else /* CONFIG_32BIT */
146 DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params2));
147 DEFINE(__LC_EXT_PARAMS2, offsetof(struct _lowcore, ext_params2));
148 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, floating_pt_save_area));
149 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
150 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
151 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
152 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
153#endif /* CONFIG_32BIT */
68 return 0; 154 return 0;
69} 155}
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
index dc7e5259770f..15e46ca94335 100644
--- a/arch/s390/kernel/base.S
+++ b/arch/s390/kernel/base.S
@@ -6,8 +6,8 @@
6 * Michael Holzheu <holzheu@de.ibm.com> 6 * Michael Holzheu <holzheu@de.ibm.com>
7 */ 7 */
8 8
9#include <asm/asm-offsets.h>
9#include <asm/ptrace.h> 10#include <asm/ptrace.h>
10#include <asm/lowcore.h>
11 11
12#ifdef CONFIG_64BIT 12#ifdef CONFIG_64BIT
13 13
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 0debcec23a39..73b624ed9cd8 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -29,16 +29,9 @@
29#include <linux/sem.h> 29#include <linux/sem.h>
30#include <linux/msg.h> 30#include <linux/msg.h>
31#include <linux/shm.h> 31#include <linux/shm.h>
32#include <linux/slab.h>
33#include <linux/uio.h> 32#include <linux/uio.h>
34#include <linux/nfs_fs.h>
35#include <linux/quota.h> 33#include <linux/quota.h>
36#include <linux/module.h> 34#include <linux/module.h>
37#include <linux/sunrpc/svc.h>
38#include <linux/nfsd/nfsd.h>
39#include <linux/nfsd/cache.h>
40#include <linux/nfsd/xdr.h>
41#include <linux/nfsd/syscall.h>
42#include <linux/poll.h> 35#include <linux/poll.h>
43#include <linux/personality.h> 36#include <linux/personality.h>
44#include <linux/stat.h> 37#include <linux/stat.h>
@@ -58,6 +51,7 @@
58#include <linux/ptrace.h> 51#include <linux/ptrace.h>
59#include <linux/fadvise.h> 52#include <linux/fadvise.h>
60#include <linux/ipc.h> 53#include <linux/ipc.h>
54#include <linux/slab.h>
61 55
62#include <asm/types.h> 56#include <asm/types.h>
63#include <asm/uaccess.h> 57#include <asm/uaccess.h>
@@ -527,59 +521,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
527 return ret; 521 return ret;
528} 522}
529 523
530#ifdef CONFIG_SYSCTL_SYSCALL
531struct __sysctl_args32 {
532 u32 name;
533 int nlen;
534 u32 oldval;
535 u32 oldlenp;
536 u32 newval;
537 u32 newlen;
538 u32 __unused[4];
539};
540
541asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
542{
543 struct __sysctl_args32 tmp;
544 int error;
545 size_t oldlen;
546 size_t __user *oldlenp = NULL;
547 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
548
549 if (copy_from_user(&tmp, args, sizeof(tmp)))
550 return -EFAULT;
551
552 if (tmp.oldval && tmp.oldlenp) {
553 /* Duh, this is ugly and might not work if sysctl_args
554 is in read-only memory, but do_sysctl does indirectly
555 a lot of uaccess in both directions and we'd have to
556 basically copy the whole sysctl.c here, and
557 glibc's __sysctl uses rw memory for the structure
558 anyway. */
559 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
560 put_user(oldlen, (size_t __user *)addr))
561 return -EFAULT;
562 oldlenp = (size_t __user *)addr;
563 }
564
565 lock_kernel();
566 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
567 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
568 unlock_kernel();
569 if (oldlenp) {
570 if (!error) {
571 if (get_user(oldlen, (size_t __user *)addr) ||
572 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
573 error = -EFAULT;
574 }
575 if (copy_to_user(args->__unused, tmp.__unused,
576 sizeof(tmp.__unused)))
577 error = -EFAULT;
578 }
579 return error;
580}
581#endif
582
583struct stat64_emu31 { 524struct stat64_emu31 {
584 unsigned long long st_dev; 525 unsigned long long st_dev;
585 unsigned int __pad1; 526 unsigned int __pad1;
@@ -675,75 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
675 */ 616 */
676 617
677struct mmap_arg_struct_emu31 { 618struct mmap_arg_struct_emu31 {
678 u32 addr; 619 compat_ulong_t addr;
679 u32 len; 620 compat_ulong_t len;
680 u32 prot; 621 compat_ulong_t prot;
681 u32 flags; 622 compat_ulong_t flags;
682 u32 fd; 623 compat_ulong_t fd;
683 u32 offset; 624 compat_ulong_t offset;
684}; 625};
685 626
686/* common code for old and new mmaps */ 627asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
687static inline long do_mmap2(
688 unsigned long addr, unsigned long len,
689 unsigned long prot, unsigned long flags,
690 unsigned long fd, unsigned long pgoff)
691{
692 struct file * file = NULL;
693 unsigned long error = -EBADF;
694
695 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
696 if (!(flags & MAP_ANONYMOUS)) {
697 file = fget(fd);
698 if (!file)
699 goto out;
700 }
701
702 down_write(&current->mm->mmap_sem);
703 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
704 if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
705 /* Result is out of bounds. */
706 do_munmap(current->mm, addr, len);
707 error = -ENOMEM;
708 }
709 up_write(&current->mm->mmap_sem);
710
711 if (file)
712 fput(file);
713out:
714 return error;
715}
716
717
718asmlinkage unsigned long
719old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
720{ 628{
721 struct mmap_arg_struct_emu31 a; 629 struct mmap_arg_struct_emu31 a;
722 int error = -EFAULT;
723 630
724 if (copy_from_user(&a, arg, sizeof(a))) 631 if (copy_from_user(&a, arg, sizeof(a)))
725 goto out; 632 return -EFAULT;
726
727 error = -EINVAL;
728 if (a.offset & ~PAGE_MASK) 633 if (a.offset & ~PAGE_MASK)
729 goto out; 634 return -EINVAL;
730 635 a.addr = (unsigned long) compat_ptr(a.addr);
731 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 636 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
732out: 637 a.offset >> PAGE_SHIFT);
733 return error;
734} 638}
735 639
736asmlinkage long 640asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
737sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
738{ 641{
739 struct mmap_arg_struct_emu31 a; 642 struct mmap_arg_struct_emu31 a;
740 int error = -EFAULT;
741 643
742 if (copy_from_user(&a, arg, sizeof(a))) 644 if (copy_from_user(&a, arg, sizeof(a)))
743 goto out; 645 return -EFAULT;
744 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 646 a.addr = (unsigned long) compat_ptr(a.addr);
745out: 647 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
746 return error;
747} 648}
748 649
749asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) 650asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index c07f9ca05ade..cb97afc85c94 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -4,10 +4,6 @@
4#include <linux/compat.h> 4#include <linux/compat.h>
5#include <linux/socket.h> 5#include <linux/socket.h>
6#include <linux/syscalls.h> 6#include <linux/syscalls.h>
7#include <linux/nfs_fs.h>
8#include <linux/sunrpc/svc.h>
9#include <linux/nfsd/nfsd.h>
10#include <linux/nfsd/export.h>
11 7
12/* Macro that masks the high order bit of an 32 bit pointer and converts it*/ 8/* Macro that masks the high order bit of an 32 bit pointer and converts it*/
13/* to a 64 bit pointer */ 9/* to a 64 bit pointer */
@@ -162,7 +158,6 @@ struct ucontext32 {
162 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 158 compat_sigset_t uc_sigmask; /* mask last for extensibility */
163}; 159};
164 160
165struct __sysctl_args32;
166struct stat64_emu31; 161struct stat64_emu31;
167struct mmap_arg_struct_emu31; 162struct mmap_arg_struct_emu31;
168struct fadvise64_64_args; 163struct fadvise64_64_args;
@@ -212,7 +207,6 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
212 size_t count); 207 size_t count);
213long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, 208long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
214 s32 count); 209 s32 count);
215long sys32_sysctl(struct __sysctl_args32 __user *args);
216long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf); 210long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf);
217long sys32_lstat64(char __user * filename, 211long sys32_lstat64(char __user * filename,
218 struct stat64_emu31 __user * statbuf); 212 struct stat64_emu31 __user * statbuf);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cbd9901dc0f8..672ce52341b4 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper:
547 .globl sys32_newuname_wrapper 547 .globl sys32_newuname_wrapper
548sys32_newuname_wrapper: 548sys32_newuname_wrapper:
549 llgtr %r2,%r2 # struct new_utsname * 549 llgtr %r2,%r2 # struct new_utsname *
550 jg sys_s390_newuname # branch to system call 550 jg sys_newuname # branch to system call
551 551
552 .globl compat_sys_adjtimex_wrapper 552 .globl compat_sys_adjtimex_wrapper
553compat_sys_adjtimex_wrapper: 553compat_sys_adjtimex_wrapper:
@@ -689,8 +689,6 @@ sys32_fdatasync_wrapper:
689 llgfr %r2,%r2 # unsigned int 689 llgfr %r2,%r2 # unsigned int
690 jg sys_fdatasync # branch to system call 690 jg sys_fdatasync # branch to system call
691 691
692#sys32_sysctl_wrapper # tbd
693
694 .globl sys32_mlock_wrapper 692 .globl sys32_mlock_wrapper
695sys32_mlock_wrapper: 693sys32_mlock_wrapper:
696 llgfr %r2,%r2 # unsigned long 694 llgfr %r2,%r2 # unsigned long
@@ -1087,8 +1085,8 @@ sys32_stime_wrapper:
1087 1085
1088 .globl sys32_sysctl_wrapper 1086 .globl sys32_sysctl_wrapper
1089sys32_sysctl_wrapper: 1087sys32_sysctl_wrapper:
1090 llgtr %r2,%r2 # struct __sysctl_args32 * 1088 llgtr %r2,%r2 # struct compat_sysctl_args *
1091 jg sys32_sysctl 1089 jg compat_sys_sysctl
1092 1090
1093 .globl sys32_fstat64_wrapper 1091 .globl sys32_fstat64_wrapper
1094sys32_fstat64_wrapper: 1092sys32_fstat64_wrapper:
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 20f282c911c2..0168472b2fdf 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/ctype.h> 20#include <linux/ctype.h>
21#include <linux/string.h>
21#include <linux/sysctl.h> 22#include <linux/sysctl.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -893,35 +894,30 @@ s390dbf_procactive(ctl_table *table, int write,
893 894
894static struct ctl_table s390dbf_table[] = { 895static struct ctl_table s390dbf_table[] = {
895 { 896 {
896 .ctl_name = CTL_S390DBF_STOPPABLE,
897 .procname = "debug_stoppable", 897 .procname = "debug_stoppable",
898 .data = &debug_stoppable, 898 .data = &debug_stoppable,
899 .maxlen = sizeof(int), 899 .maxlen = sizeof(int),
900 .mode = S_IRUGO | S_IWUSR, 900 .mode = S_IRUGO | S_IWUSR,
901 .proc_handler = &proc_dointvec, 901 .proc_handler = proc_dointvec,
902 .strategy = &sysctl_intvec,
903 }, 902 },
904 { 903 {
905 .ctl_name = CTL_S390DBF_ACTIVE,
906 .procname = "debug_active", 904 .procname = "debug_active",
907 .data = &debug_active, 905 .data = &debug_active,
908 .maxlen = sizeof(int), 906 .maxlen = sizeof(int),
909 .mode = S_IRUGO | S_IWUSR, 907 .mode = S_IRUGO | S_IWUSR,
910 .proc_handler = &s390dbf_procactive, 908 .proc_handler = s390dbf_procactive,
911 .strategy = &sysctl_intvec,
912 }, 909 },
913 { .ctl_name = 0 } 910 { }
914}; 911};
915 912
916static struct ctl_table s390dbf_dir_table[] = { 913static struct ctl_table s390dbf_dir_table[] = {
917 { 914 {
918 .ctl_name = CTL_S390DBF,
919 .procname = "s390dbf", 915 .procname = "s390dbf",
920 .maxlen = 0, 916 .maxlen = 0,
921 .mode = S_IRUGO | S_IXUGO, 917 .mode = S_IRUGO | S_IXUGO,
922 .child = s390dbf_table, 918 .child = s390dbf_table,
923 }, 919 },
924 { .ctl_name = 0 } 920 { }
925}; 921};
926 922
927static struct ctl_table_header *s390dbf_sysctl_header; 923static struct ctl_table_header *s390dbf_sysctl_header;
@@ -1183,7 +1179,7 @@ debug_get_uint(char *buf)
1183{ 1179{
1184 int rc; 1180 int rc;
1185 1181
1186 for(; isspace(*buf); buf++); 1182 buf = skip_spaces(buf);
1187 rc = simple_strtoul(buf, &buf, 10); 1183 rc = simple_strtoul(buf, &buf, 10);
1188 if(*buf){ 1184 if(*buf){
1189 rc = -EINVAL; 1185 rc = -EINVAL;
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index db943a7ec513..b39b27d68b45 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -86,10 +86,17 @@ enum {
86 U4_12, /* 4 bit unsigned value starting at 12 */ 86 U4_12, /* 4 bit unsigned value starting at 12 */
87 U4_16, /* 4 bit unsigned value starting at 16 */ 87 U4_16, /* 4 bit unsigned value starting at 16 */
88 U4_20, /* 4 bit unsigned value starting at 20 */ 88 U4_20, /* 4 bit unsigned value starting at 20 */
89 U4_32, /* 4 bit unsigned value starting at 32 */
89 U8_8, /* 8 bit unsigned value starting at 8 */ 90 U8_8, /* 8 bit unsigned value starting at 8 */
90 U8_16, /* 8 bit unsigned value starting at 16 */ 91 U8_16, /* 8 bit unsigned value starting at 16 */
92 U8_24, /* 8 bit unsigned value starting at 24 */
93 U8_32, /* 8 bit unsigned value starting at 32 */
94 I8_8, /* 8 bit signed value starting at 8 */
95 I8_32, /* 8 bit signed value starting at 32 */
91 I16_16, /* 16 bit signed value starting at 16 */ 96 I16_16, /* 16 bit signed value starting at 16 */
97 I16_32, /* 32 bit signed value starting at 16 */
92 U16_16, /* 16 bit unsigned value starting at 16 */ 98 U16_16, /* 16 bit unsigned value starting at 16 */
99 U16_32, /* 32 bit unsigned value starting at 16 */
93 J16_16, /* PC relative jump offset at 16 */ 100 J16_16, /* PC relative jump offset at 16 */
94 J32_16, /* PC relative long offset at 16 */ 101 J32_16, /* PC relative long offset at 16 */
95 I32_16, /* 32 bit signed value starting at 16 */ 102 I32_16, /* 32 bit signed value starting at 16 */
@@ -104,21 +111,37 @@ enum {
104 */ 111 */
105enum { 112enum {
106 INSTR_INVALID, 113 INSTR_INVALID,
107 INSTR_E, INSTR_RIE_RRP, INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, 114 INSTR_E,
108 INSTR_RIL_UP, INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP, 115 INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
116 INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU,
117 INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
118 INSTR_RIS_R0RDU, INSTR_RIS_R0UU, INSTR_RIS_RURDI, INSTR_RIS_RURDU,
119 INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
109 INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0, 120 INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0,
110 INSTR_RRE_FF, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF, INSTR_RRE_RR, 121 INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
111 INSTR_RRE_RR_OPT, INSTR_RRF_F0FF, INSTR_RRF_FUFF, INSTR_RRF_M0RR, 122 INSTR_RRE_RR, INSTR_RRE_RR_OPT,
112 INSTR_RRF_R0RR, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, 123 INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
124 INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_M0RR, INSTR_RRF_R0RR,
125 INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, INSTR_RRF_U0RR,
126 INSTR_RRF_UUFF, INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
113 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR, 127 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
114 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD, INSTR_RSI_RRP, 128 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
115 INSTR_RSL_R0RD, INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, 129 INSTR_RSI_RRP,
116 INSTR_RSY_RURD, INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, 130 INSTR_RSL_R0RD,
117 INSTR_RS_RRRD, INSTR_RS_RURD, INSTR_RXE_FRRD, INSTR_RXE_RRRD, 131 INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
118 INSTR_RXF_FRRDF, INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RX_FRRD, 132 INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
119 INSTR_RX_RRRD, INSTR_RX_URRD, INSTR_SIY_URD, INSTR_SI_URD, 133 INSTR_RS_RURD,
120 INSTR_SSE_RDRD, INSTR_SSF_RRDRD, INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, 134 INSTR_RXE_FRRD, INSTR_RXE_RRRD,
121 INSTR_SS_LLRDRD, INSTR_SS_RRRDRD, INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3, 135 INSTR_RXF_FRRDF,
136 INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RXY_URRD,
137 INSTR_RX_FRRD, INSTR_RX_RRRD, INSTR_RX_URRD,
138 INSTR_SIL_RDI, INSTR_SIL_RDU,
139 INSTR_SIY_IRD, INSTR_SIY_URD,
140 INSTR_SI_URD,
141 INSTR_SSE_RDRD,
142 INSTR_SSF_RRDRD,
143 INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
144 INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
122 INSTR_S_00, INSTR_S_RD, 145 INSTR_S_00, INSTR_S_RD,
123}; 146};
124 147
@@ -129,7 +152,7 @@ struct operand {
129}; 152};
130 153
131struct insn { 154struct insn {
132 const char name[5]; 155 const char name[6];
133 unsigned char opfrag; 156 unsigned char opfrag;
134 unsigned char format; 157 unsigned char format;
135}; 158};
@@ -170,11 +193,16 @@ static const struct operand operands[] =
170 [U4_12] = { 4, 12, 0 }, 193 [U4_12] = { 4, 12, 0 },
171 [U4_16] = { 4, 16, 0 }, 194 [U4_16] = { 4, 16, 0 },
172 [U4_20] = { 4, 20, 0 }, 195 [U4_20] = { 4, 20, 0 },
196 [U4_32] = { 4, 32, 0 },
173 [U8_8] = { 8, 8, 0 }, 197 [U8_8] = { 8, 8, 0 },
174 [U8_16] = { 8, 16, 0 }, 198 [U8_16] = { 8, 16, 0 },
199 [U8_24] = { 8, 24, 0 },
200 [U8_32] = { 8, 32, 0 },
175 [I16_16] = { 16, 16, OPERAND_SIGNED }, 201 [I16_16] = { 16, 16, OPERAND_SIGNED },
176 [U16_16] = { 16, 16, 0 }, 202 [U16_16] = { 16, 16, 0 },
203 [U16_32] = { 16, 32, 0 },
177 [J16_16] = { 16, 16, OPERAND_PCREL }, 204 [J16_16] = { 16, 16, OPERAND_PCREL },
205 [I16_32] = { 16, 32, OPERAND_SIGNED },
178 [J32_16] = { 32, 16, OPERAND_PCREL }, 206 [J32_16] = { 32, 16, OPERAND_PCREL },
179 [I32_16] = { 32, 16, OPERAND_SIGNED }, 207 [I32_16] = { 32, 16, OPERAND_SIGNED },
180 [U32_16] = { 32, 16, 0 }, 208 [U32_16] = { 32, 16, 0 },
@@ -183,82 +211,93 @@ static const struct operand operands[] =
183}; 211};
184 212
185static const unsigned char formats[][7] = { 213static const unsigned char formats[][7] = {
186 [INSTR_E] = { 0xff, 0,0,0,0,0,0 }, /* e.g. pr */ 214 [INSTR_E] = { 0xff, 0,0,0,0,0,0 },
187 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxhg */ 215 [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 },
188 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 }, /* e.g. brasl */ 216 [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
189 [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 }, /* e.g. brcl */ 217 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
190 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 }, /* e.g. afi */ 218 [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
191 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 }, /* e.g. alfi */ 219 [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
192 [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 }, /* e.g. ahi */ 220 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 },
193 [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 }, /* e.g. brct */ 221 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 },
194 [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 }, /* e.g. tml */ 222 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 },
195 [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 }, /* e.g. brc */ 223 [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 },
196 [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. palb */ 224 [INSTR_RIS_R0RDU] = { 0xff, R_8,U8_32,D_20,B_16,0,0 },
197 [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 }, /* e.g. tb */ 225 [INSTR_RIS_RURDI] = { 0xff, R_8,I8_32,U4_12,D_20,B_16,0 },
198 [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 }, /* e.g. cpya */ 226 [INSTR_RIS_RURDU] = { 0xff, R_8,U8_32,U4_12,D_20,B_16,0 },
199 [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 }, /* e.g. sar */ 227 [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 },
200 [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 }, /* e.g. sqer */ 228 [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 },
201 [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 }, /* e.g. debr */ 229 [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 },
202 [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 }, /* e.g. ipm */ 230 [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 },
203 [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 }, /* e.g. ear */ 231 [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 },
204 [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 }, /* e.g. cefbr */ 232 [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 },
205 [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 }, /* e.g. lura */ 233 [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 },
206 [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 }, /* efpc, sfpc */ 234 [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 },
207 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 }, /* e.g. madbr */ 235 [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 },
208 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */ 236 [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 },
209 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */ 237 [INSTR_RRE_FR] = { 0xff, F_24,R_28,0,0,0,0 },
210 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 }, /* e.g. idte */ 238 [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 },
211 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, /* e.g. fixr */ 239 [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 },
212 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, /* e.g. cfebr */ 240 [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 },
213 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, /* e.g. sske */ 241 [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 },
214 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 }, /* e.g. adr */ 242 [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },
215 [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 }, /* e.g. spm */ 243 [INSTR_RRF_0UFF] = { 0xff, F_24,F_28,U4_20,0,0,0 },
216 [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 }, /* e.g. lr */ 244 [INSTR_RRF_F0FF2] = { 0xff, F_24,F_16,F_28,0,0,0 },
217 [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 }, /* e.g. svc */ 245 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 },
218 [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 }, /* e.g. bcr */ 246 [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 },
219 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. lmh */ 247 [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
220 [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lmh */ 248 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
221 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icmh */ 249 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 },
222 [INSTR_RSL_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. tp */ 250 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 },
223 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxh */ 251 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
224 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },/* e.g. stmy */ 252 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 },
253 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 },
254 [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 },
255 [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
256 [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 },
257 [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
258 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 },
259 [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 },
260 [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 },
261 [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 },
262 [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 },
263 [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
264 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
265 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
266 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
267 [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 },
268 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
269 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
270 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
225 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 }, 271 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
226 /* e.g. icmh */ 272 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 },
227 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },/* e.g. lamy */ 273 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
228 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },/* e.g. lamy */ 274 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 },
229 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 }, /* e.g. lam */ 275 [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
230 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lctl */ 276 [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
231 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. sll */ 277 [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
232 [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. cs */ 278 [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
233 [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icm */
234 [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. axbr */
235 [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. lg */
236 [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 }, 279 [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 },
237 /* e.g. madb */ 280 [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },
238 [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },/* e.g. ly */ 281 [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },
239 [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */ 282 [INSTR_RXY_URRD] = { 0xff, U4_8,D20_20,X_12,B_16,0,0 },
240 [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */ 283 [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
241 [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */ 284 [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
242 [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */ 285 [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 },
243 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */ 286 [INSTR_SIL_RDI] = { 0xff, D_20,B_16,I16_32,0,0,0 },
244 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */ 287 [INSTR_SIL_RDU] = { 0xff, D_20,B_16,U16_32,0,0,0 },
245 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */ 288 [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 },
289 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 },
290 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 },
291 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 },
292 [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
246 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, 293 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
247 /* e.g. mvc */
248 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 }, 294 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
249 /* e.g. srp */
250 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 }, 295 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
251 /* e.g. pack */
252 [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
253 /* e.g. mvck */
254 [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 }, 296 [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 },
255 /* e.g. plo */
256 [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 }, 297 [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 },
257 /* e.g. lmd */ 298 [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
258 [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. hsch */ 299 [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 },
259 [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 }, /* e.g. lpsw */ 300 [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 },
260 [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
261 /* e.g. mvcos */
262}; 301};
263 302
264static struct insn opcode[] = { 303static struct insn opcode[] = {
@@ -454,6 +493,8 @@ static struct insn opcode[] = {
454static struct insn opcode_01[] = { 493static struct insn opcode_01[] = {
455#ifdef CONFIG_64BIT 494#ifdef CONFIG_64BIT
456 { "sam64", 0x0e, INSTR_E }, 495 { "sam64", 0x0e, INSTR_E },
496 { "pfpo", 0x0a, INSTR_E },
497 { "ptff", 0x04, INSTR_E },
457#endif 498#endif
458 { "pr", 0x01, INSTR_E }, 499 { "pr", 0x01, INSTR_E },
459 { "upt", 0x02, INSTR_E }, 500 { "upt", 0x02, INSTR_E },
@@ -519,6 +560,8 @@ static struct insn opcode_b2[] = {
519 { "cutfu", 0xa7, INSTR_RRF_M0RR }, 560 { "cutfu", 0xa7, INSTR_RRF_M0RR },
520 { "stfle", 0xb0, INSTR_S_RD }, 561 { "stfle", 0xb0, INSTR_S_RD },
521 { "lpswe", 0xb2, INSTR_S_RD }, 562 { "lpswe", 0xb2, INSTR_S_RD },
563 { "srnmt", 0xb9, INSTR_S_RD },
564 { "lfas", 0xbd, INSTR_S_RD },
522#endif 565#endif
523 { "stidp", 0x02, INSTR_S_RD }, 566 { "stidp", 0x02, INSTR_S_RD },
524 { "sck", 0x04, INSTR_S_RD }, 567 { "sck", 0x04, INSTR_S_RD },
@@ -589,7 +632,6 @@ static struct insn opcode_b2[] = {
589 { "clst", 0x5d, INSTR_RRE_RR }, 632 { "clst", 0x5d, INSTR_RRE_RR },
590 { "srst", 0x5e, INSTR_RRE_RR }, 633 { "srst", 0x5e, INSTR_RRE_RR },
591 { "cmpsc", 0x63, INSTR_RRE_RR }, 634 { "cmpsc", 0x63, INSTR_RRE_RR },
592 { "cmpsc", 0x63, INSTR_RRE_RR },
593 { "siga", 0x74, INSTR_S_RD }, 635 { "siga", 0x74, INSTR_S_RD },
594 { "xsch", 0x76, INSTR_S_00 }, 636 { "xsch", 0x76, INSTR_S_00 },
595 { "rp", 0x77, INSTR_S_RD }, 637 { "rp", 0x77, INSTR_S_RD },
@@ -630,6 +672,57 @@ static struct insn opcode_b3[] = {
630 { "cger", 0xc8, INSTR_RRF_U0RF }, 672 { "cger", 0xc8, INSTR_RRF_U0RF },
631 { "cgdr", 0xc9, INSTR_RRF_U0RF }, 673 { "cgdr", 0xc9, INSTR_RRF_U0RF },
632 { "cgxr", 0xca, INSTR_RRF_U0RF }, 674 { "cgxr", 0xca, INSTR_RRF_U0RF },
675 { "lpdfr", 0x70, INSTR_RRE_FF },
676 { "lndfr", 0x71, INSTR_RRE_FF },
677 { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
678 { "lcdfr", 0x73, INSTR_RRE_FF },
679 { "ldgr", 0xc1, INSTR_RRE_FR },
680 { "lgdr", 0xcd, INSTR_RRE_RF },
681 { "adtr", 0xd2, INSTR_RRR_F0FF },
682 { "axtr", 0xda, INSTR_RRR_F0FF },
683 { "cdtr", 0xe4, INSTR_RRE_FF },
684 { "cxtr", 0xec, INSTR_RRE_FF },
685 { "kdtr", 0xe0, INSTR_RRE_FF },
686 { "kxtr", 0xe8, INSTR_RRE_FF },
687 { "cedtr", 0xf4, INSTR_RRE_FF },
688 { "cextr", 0xfc, INSTR_RRE_FF },
689 { "cdgtr", 0xf1, INSTR_RRE_FR },
690 { "cxgtr", 0xf9, INSTR_RRE_FR },
691 { "cdstr", 0xf3, INSTR_RRE_FR },
692 { "cxstr", 0xfb, INSTR_RRE_FR },
693 { "cdutr", 0xf2, INSTR_RRE_FR },
694 { "cxutr", 0xfa, INSTR_RRE_FR },
695 { "cgdtr", 0xe1, INSTR_RRF_U0RF },
696 { "cgxtr", 0xe9, INSTR_RRF_U0RF },
697 { "csdtr", 0xe3, INSTR_RRE_RF },
698 { "csxtr", 0xeb, INSTR_RRE_RF },
699 { "cudtr", 0xe2, INSTR_RRE_RF },
700 { "cuxtr", 0xea, INSTR_RRE_RF },
701 { "ddtr", 0xd1, INSTR_RRR_F0FF },
702 { "dxtr", 0xd9, INSTR_RRR_F0FF },
703 { "eedtr", 0xe5, INSTR_RRE_RF },
704 { "eextr", 0xed, INSTR_RRE_RF },
705 { "esdtr", 0xe7, INSTR_RRE_RF },
706 { "esxtr", 0xef, INSTR_RRE_RF },
707 { "iedtr", 0xf6, INSTR_RRF_F0FR },
708 { "iextr", 0xfe, INSTR_RRF_F0FR },
709 { "ltdtr", 0xd6, INSTR_RRE_FF },
710 { "ltxtr", 0xde, INSTR_RRE_FF },
711 { "fidtr", 0xd7, INSTR_RRF_UUFF },
712 { "fixtr", 0xdf, INSTR_RRF_UUFF },
713 { "ldetr", 0xd4, INSTR_RRF_0UFF },
714 { "lxdtr", 0xdc, INSTR_RRF_0UFF },
715 { "ledtr", 0xd5, INSTR_RRF_UUFF },
716 { "ldxtr", 0xdd, INSTR_RRF_UUFF },
717 { "mdtr", 0xd0, INSTR_RRR_F0FF },
718 { "mxtr", 0xd8, INSTR_RRR_F0FF },
719 { "qadtr", 0xf5, INSTR_RRF_FUFF },
720 { "qaxtr", 0xfd, INSTR_RRF_FUFF },
721 { "rrdtr", 0xf7, INSTR_RRF_FFRU },
722 { "rrxtr", 0xff, INSTR_RRF_FFRU },
723 { "sfasr", 0x85, INSTR_RRE_R0 },
724 { "sdtr", 0xd3, INSTR_RRR_F0FF },
725 { "sxtr", 0xdb, INSTR_RRR_F0FF },
633#endif 726#endif
634 { "lpebr", 0x00, INSTR_RRE_FF }, 727 { "lpebr", 0x00, INSTR_RRE_FF },
635 { "lnebr", 0x01, INSTR_RRE_FF }, 728 { "lnebr", 0x01, INSTR_RRE_FF },
@@ -780,6 +873,14 @@ static struct insn opcode_b9[] = {
780 { "cu24", 0xb1, INSTR_RRF_M0RR }, 873 { "cu24", 0xb1, INSTR_RRF_M0RR },
781 { "cu41", 0xb2, INSTR_RRF_M0RR }, 874 { "cu41", 0xb2, INSTR_RRF_M0RR },
782 { "cu42", 0xb3, INSTR_RRF_M0RR }, 875 { "cu42", 0xb3, INSTR_RRF_M0RR },
876 { "crt", 0x72, INSTR_RRF_U0RR },
877 { "cgrt", 0x60, INSTR_RRF_U0RR },
878 { "clrt", 0x73, INSTR_RRF_U0RR },
879 { "clgrt", 0x61, INSTR_RRF_U0RR },
880 { "ptf", 0xa2, INSTR_RRE_R0 },
881 { "pfmf", 0xaf, INSTR_RRE_RR },
882 { "trte", 0xbf, INSTR_RRF_M0RR },
883 { "trtre", 0xbd, INSTR_RRF_M0RR },
783#endif 884#endif
784 { "kmac", 0x1e, INSTR_RRE_RR }, 885 { "kmac", 0x1e, INSTR_RRE_RR },
785 { "lrvr", 0x1f, INSTR_RRE_RR }, 886 { "lrvr", 0x1f, INSTR_RRE_RR },
@@ -835,6 +936,43 @@ static struct insn opcode_c2[] = {
835 { "cfi", 0x0d, INSTR_RIL_RI }, 936 { "cfi", 0x0d, INSTR_RIL_RI },
836 { "clgfi", 0x0e, INSTR_RIL_RU }, 937 { "clgfi", 0x0e, INSTR_RIL_RU },
837 { "clfi", 0x0f, INSTR_RIL_RU }, 938 { "clfi", 0x0f, INSTR_RIL_RU },
939 { "msfi", 0x01, INSTR_RIL_RI },
940 { "msgfi", 0x00, INSTR_RIL_RI },
941#endif
942 { "", 0, INSTR_INVALID }
943};
944
945static struct insn opcode_c4[] = {
946#ifdef CONFIG_64BIT
947 { "lrl", 0x0d, INSTR_RIL_RP },
948 { "lgrl", 0x08, INSTR_RIL_RP },
949 { "lgfrl", 0x0c, INSTR_RIL_RP },
950 { "lhrl", 0x05, INSTR_RIL_RP },
951 { "lghrl", 0x04, INSTR_RIL_RP },
952 { "llgfrl", 0x0e, INSTR_RIL_RP },
953 { "llhrl", 0x02, INSTR_RIL_RP },
954 { "llghrl", 0x06, INSTR_RIL_RP },
955 { "strl", 0x0f, INSTR_RIL_RP },
956 { "stgrl", 0x0b, INSTR_RIL_RP },
957 { "sthrl", 0x07, INSTR_RIL_RP },
958#endif
959 { "", 0, INSTR_INVALID }
960};
961
962static struct insn opcode_c6[] = {
963#ifdef CONFIG_64BIT
964 { "crl", 0x0d, INSTR_RIL_RP },
965 { "cgrl", 0x08, INSTR_RIL_RP },
966 { "cgfrl", 0x0c, INSTR_RIL_RP },
967 { "chrl", 0x05, INSTR_RIL_RP },
968 { "cghrl", 0x04, INSTR_RIL_RP },
969 { "clrl", 0x0f, INSTR_RIL_RP },
970 { "clgrl", 0x0a, INSTR_RIL_RP },
971 { "clgfrl", 0x0e, INSTR_RIL_RP },
972 { "clhrl", 0x07, INSTR_RIL_RP },
973 { "clghrl", 0x06, INSTR_RIL_RP },
974 { "pfdrl", 0x02, INSTR_RIL_UP },
975 { "exrl", 0x00, INSTR_RIL_RP },
838#endif 976#endif
839 { "", 0, INSTR_INVALID } 977 { "", 0, INSTR_INVALID }
840}; 978};
@@ -842,6 +980,8 @@ static struct insn opcode_c2[] = {
842static struct insn opcode_c8[] = { 980static struct insn opcode_c8[] = {
843#ifdef CONFIG_64BIT 981#ifdef CONFIG_64BIT
844 { "mvcos", 0x00, INSTR_SSF_RRDRD }, 982 { "mvcos", 0x00, INSTR_SSF_RRDRD },
983 { "ectg", 0x01, INSTR_SSF_RRDRD },
984 { "csst", 0x02, INSTR_SSF_RRDRD },
845#endif 985#endif
846 { "", 0, INSTR_INVALID } 986 { "", 0, INSTR_INVALID }
847}; 987};
@@ -917,6 +1057,12 @@ static struct insn opcode_e3[] = {
917 { "llgh", 0x91, INSTR_RXY_RRRD }, 1057 { "llgh", 0x91, INSTR_RXY_RRRD },
918 { "llc", 0x94, INSTR_RXY_RRRD }, 1058 { "llc", 0x94, INSTR_RXY_RRRD },
919 { "llh", 0x95, INSTR_RXY_RRRD }, 1059 { "llh", 0x95, INSTR_RXY_RRRD },
1060 { "cgh", 0x34, INSTR_RXY_RRRD },
1061 { "laey", 0x75, INSTR_RXY_RRRD },
1062 { "ltgf", 0x32, INSTR_RXY_RRRD },
1063 { "mfy", 0x5c, INSTR_RXY_RRRD },
1064 { "mhy", 0x7c, INSTR_RXY_RRRD },
1065 { "pfd", 0x36, INSTR_RXY_URRD },
920#endif 1066#endif
921 { "lrv", 0x1e, INSTR_RXY_RRRD }, 1067 { "lrv", 0x1e, INSTR_RXY_RRRD },
922 { "lrvh", 0x1f, INSTR_RXY_RRRD }, 1068 { "lrvh", 0x1f, INSTR_RXY_RRRD },
@@ -931,6 +1077,15 @@ static struct insn opcode_e3[] = {
931static struct insn opcode_e5[] = { 1077static struct insn opcode_e5[] = {
932#ifdef CONFIG_64BIT 1078#ifdef CONFIG_64BIT
933 { "strag", 0x02, INSTR_SSE_RDRD }, 1079 { "strag", 0x02, INSTR_SSE_RDRD },
1080 { "chhsi", 0x54, INSTR_SIL_RDI },
1081 { "chsi", 0x5c, INSTR_SIL_RDI },
1082 { "cghsi", 0x58, INSTR_SIL_RDI },
1083 { "clhhsi", 0x55, INSTR_SIL_RDU },
1084 { "clfhsi", 0x5d, INSTR_SIL_RDU },
1085 { "clghsi", 0x59, INSTR_SIL_RDU },
1086 { "mvhhi", 0x44, INSTR_SIL_RDI },
1087 { "mvhi", 0x4c, INSTR_SIL_RDI },
1088 { "mvghi", 0x48, INSTR_SIL_RDI },
934#endif 1089#endif
935 { "lasp", 0x00, INSTR_SSE_RDRD }, 1090 { "lasp", 0x00, INSTR_SSE_RDRD },
936 { "tprot", 0x01, INSTR_SSE_RDRD }, 1091 { "tprot", 0x01, INSTR_SSE_RDRD },
@@ -977,6 +1132,11 @@ static struct insn opcode_eb[] = {
977 { "lmy", 0x98, INSTR_RSY_RRRD }, 1132 { "lmy", 0x98, INSTR_RSY_RRRD },
978 { "lamy", 0x9a, INSTR_RSY_AARD }, 1133 { "lamy", 0x9a, INSTR_RSY_AARD },
979 { "stamy", 0x9b, INSTR_RSY_AARD }, 1134 { "stamy", 0x9b, INSTR_RSY_AARD },
1135 { "asi", 0x6a, INSTR_SIY_IRD },
1136 { "agsi", 0x7a, INSTR_SIY_IRD },
1137 { "alsi", 0x6e, INSTR_SIY_IRD },
1138 { "algsi", 0x7e, INSTR_SIY_IRD },
1139 { "ecag", 0x4c, INSTR_RSY_RRRD },
980#endif 1140#endif
981 { "rll", 0x1d, INSTR_RSY_RRRD }, 1141 { "rll", 0x1d, INSTR_RSY_RRRD },
982 { "mvclu", 0x8e, INSTR_RSY_RRRD }, 1142 { "mvclu", 0x8e, INSTR_RSY_RRRD },
@@ -988,6 +1148,30 @@ static struct insn opcode_ec[] = {
988#ifdef CONFIG_64BIT 1148#ifdef CONFIG_64BIT
989 { "brxhg", 0x44, INSTR_RIE_RRP }, 1149 { "brxhg", 0x44, INSTR_RIE_RRP },
990 { "brxlg", 0x45, INSTR_RIE_RRP }, 1150 { "brxlg", 0x45, INSTR_RIE_RRP },
1151 { "crb", 0xf6, INSTR_RRS_RRRDU },
1152 { "cgrb", 0xe4, INSTR_RRS_RRRDU },
1153 { "crj", 0x76, INSTR_RIE_RRPU },
1154 { "cgrj", 0x64, INSTR_RIE_RRPU },
1155 { "cib", 0xfe, INSTR_RIS_RURDI },
1156 { "cgib", 0xfc, INSTR_RIS_RURDI },
1157 { "cij", 0x7e, INSTR_RIE_RUPI },
1158 { "cgij", 0x7c, INSTR_RIE_RUPI },
1159 { "cit", 0x72, INSTR_RIE_R0IU },
1160 { "cgit", 0x70, INSTR_RIE_R0IU },
1161 { "clrb", 0xf7, INSTR_RRS_RRRDU },
1162 { "clgrb", 0xe5, INSTR_RRS_RRRDU },
1163 { "clrj", 0x77, INSTR_RIE_RRPU },
1164 { "clgrj", 0x65, INSTR_RIE_RRPU },
1165 { "clib", 0xff, INSTR_RIS_RURDU },
1166 { "clgib", 0xfd, INSTR_RIS_RURDU },
1167 { "clij", 0x7f, INSTR_RIE_RUPU },
1168 { "clgij", 0x7d, INSTR_RIE_RUPU },
1169 { "clfit", 0x73, INSTR_RIE_R0UU },
1170 { "clgit", 0x71, INSTR_RIE_R0UU },
1171 { "rnsbg", 0x54, INSTR_RIE_RRUUU },
1172 { "rxsbg", 0x57, INSTR_RIE_RRUUU },
1173 { "rosbg", 0x56, INSTR_RIE_RRUUU },
1174 { "risbg", 0x55, INSTR_RIE_RRUUU },
991#endif 1175#endif
992 { "", 0, INSTR_INVALID } 1176 { "", 0, INSTR_INVALID }
993}; 1177};
@@ -1004,6 +1188,16 @@ static struct insn opcode_ed[] = {
1004 { "ldy", 0x65, INSTR_RXY_FRRD }, 1188 { "ldy", 0x65, INSTR_RXY_FRRD },
1005 { "stey", 0x66, INSTR_RXY_FRRD }, 1189 { "stey", 0x66, INSTR_RXY_FRRD },
1006 { "stdy", 0x67, INSTR_RXY_FRRD }, 1190 { "stdy", 0x67, INSTR_RXY_FRRD },
1191 { "sldt", 0x40, INSTR_RXF_FRRDF },
1192 { "slxt", 0x48, INSTR_RXF_FRRDF },
1193 { "srdt", 0x41, INSTR_RXF_FRRDF },
1194 { "srxt", 0x49, INSTR_RXF_FRRDF },
1195 { "tdcet", 0x50, INSTR_RXE_FRRD },
1196 { "tdcdt", 0x54, INSTR_RXE_FRRD },
1197 { "tdcxt", 0x58, INSTR_RXE_FRRD },
1198 { "tdget", 0x51, INSTR_RXE_FRRD },
1199 { "tdgdt", 0x55, INSTR_RXE_FRRD },
1200 { "tdgxt", 0x59, INSTR_RXE_FRRD },
1007#endif 1201#endif
1008 { "ldeb", 0x04, INSTR_RXE_FRRD }, 1202 { "ldeb", 0x04, INSTR_RXE_FRRD },
1009 { "lxdb", 0x05, INSTR_RXE_FRRD }, 1203 { "lxdb", 0x05, INSTR_RXE_FRRD },
@@ -1037,6 +1231,7 @@ static struct insn opcode_ed[] = {
1037 { "mae", 0x2e, INSTR_RXF_FRRDF }, 1231 { "mae", 0x2e, INSTR_RXF_FRRDF },
1038 { "mse", 0x2f, INSTR_RXF_FRRDF }, 1232 { "mse", 0x2f, INSTR_RXF_FRRDF },
1039 { "sqe", 0x34, INSTR_RXE_FRRD }, 1233 { "sqe", 0x34, INSTR_RXE_FRRD },
1234 { "sqd", 0x35, INSTR_RXE_FRRD },
1040 { "mee", 0x37, INSTR_RXE_FRRD }, 1235 { "mee", 0x37, INSTR_RXE_FRRD },
1041 { "mad", 0x3e, INSTR_RXF_FRRDF }, 1236 { "mad", 0x3e, INSTR_RXF_FRRDF },
1042 { "msd", 0x3f, INSTR_RXF_FRRDF }, 1237 { "msd", 0x3f, INSTR_RXF_FRRDF },
@@ -1117,6 +1312,12 @@ static struct insn *find_insn(unsigned char *code)
1117 case 0xc2: 1312 case 0xc2:
1118 table = opcode_c2; 1313 table = opcode_c2;
1119 break; 1314 break;
1315 case 0xc4:
1316 table = opcode_c4;
1317 break;
1318 case 0xc6:
1319 table = opcode_c6;
1320 break;
1120 case 0xc8: 1321 case 0xc8:
1121 table = opcode_c8; 1322 table = opcode_c8;
1122 break; 1323 break;
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index e49e9e0c69fd..2d92c2cf92d7 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -82,7 +82,8 @@ asm(
82 " lm 6,15,24(15)\n" 82 " lm 6,15,24(15)\n"
83#endif 83#endif
84 " br 14\n" 84 " br 14\n"
85 " .size savesys_ipl_nss, .-savesys_ipl_nss\n"); 85 " .size savesys_ipl_nss, .-savesys_ipl_nss\n"
86 " .previous\n");
86 87
87static __initdata char upper_command_line[COMMAND_LINE_SIZE]; 88static __initdata char upper_command_line[COMMAND_LINE_SIZE];
88 89
@@ -214,10 +215,13 @@ static __initdata struct sysinfo_3_2_2 vmms __aligned(PAGE_SIZE);
214 215
215static noinline __init void detect_machine_type(void) 216static noinline __init void detect_machine_type(void)
216{ 217{
217 /* No VM information? Looks like LPAR */ 218 /* Check current-configuration-level */
218 if (stsi(&vmms, 3, 2, 2) == -ENOSYS) 219 if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) {
220 S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR;
219 return; 221 return;
220 if (!vmms.count) 222 }
223 /* Get virtual-machine cpu information. */
224 if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count)
221 return; 225 return;
222 226
223 /* Running under KVM? If not we assume z/VM */ 227 /* Running under KVM? If not we assume z/VM */
@@ -402,8 +406,19 @@ static void __init append_to_cmdline(size_t (*ipl_data)(char *, size_t))
402 406
403static void __init setup_boot_command_line(void) 407static void __init setup_boot_command_line(void)
404{ 408{
409 int i;
410
411 /* convert arch command line to ascii */
412 for (i = 0; i < ARCH_COMMAND_LINE_SIZE; i++)
413 if (COMMAND_LINE[i] & 0x80)
414 break;
415 if (i < ARCH_COMMAND_LINE_SIZE)
416 EBCASC(COMMAND_LINE, ARCH_COMMAND_LINE_SIZE);
417 COMMAND_LINE[ARCH_COMMAND_LINE_SIZE-1] = 0;
418
405 /* copy arch command line */ 419 /* copy arch command line */
406 strlcpy(boot_command_line, COMMAND_LINE, ARCH_COMMAND_LINE_SIZE); 420 strlcpy(boot_command_line, strstrip(COMMAND_LINE),
421 ARCH_COMMAND_LINE_SIZE);
407 422
408 /* append IPL PARM data to the boot command line */ 423 /* append IPL PARM data to the boot command line */
409 if (MACHINE_IS_VM) 424 if (MACHINE_IS_VM)
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 48215d15762b..6af7045280a8 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -13,7 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/cache.h> 15#include <asm/cache.h>
16#include <asm/lowcore.h>
17#include <asm/errno.h> 16#include <asm/errno.h>
18#include <asm/ptrace.h> 17#include <asm/ptrace.h>
19#include <asm/thread_info.h> 18#include <asm/thread_info.h>
@@ -571,6 +570,7 @@ pgm_svcper:
571 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 570 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
572 oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP 571 oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
573 TRACE_IRQS_ON 572 TRACE_IRQS_ON
573 lm %r2,%r6,SP_R2(%r15) # load svc arguments
574 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 574 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
575 b BASED(sysc_do_svc) 575 b BASED(sysc_do_svc)
576 576
@@ -964,7 +964,7 @@ cleanup_critical:
964 clc 4(4,%r12),BASED(cleanup_table_io_work_loop) 964 clc 4(4,%r12),BASED(cleanup_table_io_work_loop)
965 bl BASED(0f) 965 bl BASED(0f)
966 clc 4(4,%r12),BASED(cleanup_table_io_work_loop+4) 966 clc 4(4,%r12),BASED(cleanup_table_io_work_loop+4)
967 bl BASED(cleanup_io_return) 967 bl BASED(cleanup_io_work_loop)
9680: 9680:
969 br %r14 969 br %r14
970 970
@@ -1039,6 +1039,12 @@ cleanup_sysc_leave_insn:
1039 1039
1040cleanup_io_return: 1040cleanup_io_return:
1041 mvc __LC_RETURN_PSW(4),0(%r12) 1041 mvc __LC_RETURN_PSW(4),0(%r12)
1042 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_return)
1043 la %r12,__LC_RETURN_PSW
1044 br %r14
1045
1046cleanup_io_work_loop:
1047 mvc __LC_RETURN_PSW(4),0(%r12)
1042 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_work_loop) 1048 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_work_loop)
1043 la %r12,__LC_RETURN_PSW 1049 la %r12,__LC_RETURN_PSW
1044 br %r14 1050 br %r14
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index e1e5e767ab56..eb15c12ec158 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -24,17 +24,13 @@ int __cpuinit start_secondary(void *cpuvoid);
24void __init startup_init(void); 24void __init startup_init(void);
25void die(const char * str, struct pt_regs * regs, long err); 25void die(const char * str, struct pt_regs * regs, long err);
26 26
27struct new_utsname; 27struct s390_mmap_arg_struct;
28struct mmap_arg_struct;
29struct fadvise64_64_args; 28struct fadvise64_64_args;
30struct old_sigaction; 29struct old_sigaction;
31struct sel_arg_struct;
32 30
33long sys_mmap2(struct mmap_arg_struct __user *arg); 31long sys_mmap2(struct s390_mmap_arg_struct __user *arg);
34long sys_s390_old_mmap(struct mmap_arg_struct __user *arg); 32long sys_s390_ipc(uint call, int first, unsigned long second,
35long sys_ipc(uint call, int first, unsigned long second,
36 unsigned long third, void __user *ptr); 33 unsigned long third, void __user *ptr);
37long sys_s390_newuname(struct new_utsname __user *name);
38long sys_s390_personality(unsigned long personality); 34long sys_s390_personality(unsigned long personality);
39long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low, 35long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
40 size_t len, int advice); 36 size_t len, int advice);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9aff1d449b6e..52106d53271c 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -9,11 +9,9 @@
9 * Heiko Carstens <heiko.carstens@de.ibm.com> 9 * Heiko Carstens <heiko.carstens@de.ibm.com>
10 */ 10 */
11 11
12#include <linux/sys.h>
13#include <linux/linkage.h> 12#include <linux/linkage.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <asm/cache.h> 14#include <asm/cache.h>
16#include <asm/lowcore.h>
17#include <asm/errno.h> 15#include <asm/errno.h>
18#include <asm/ptrace.h> 16#include <asm/ptrace.h>
19#include <asm/thread_info.h> 17#include <asm/thread_info.h>
@@ -549,6 +547,7 @@ pgm_svcper:
549 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 547 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
550 oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP 548 oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
551 TRACE_IRQS_ON 549 TRACE_IRQS_ON
550 lmg %r2,%r6,SP_R2(%r15) # load svc arguments
552 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 551 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
553 j sysc_do_svc 552 j sysc_do_svc
554 553
@@ -947,7 +946,7 @@ cleanup_critical:
947 clc 8(8,%r12),BASED(cleanup_table_io_work_loop) 946 clc 8(8,%r12),BASED(cleanup_table_io_work_loop)
948 jl 0f 947 jl 0f
949 clc 8(8,%r12),BASED(cleanup_table_io_work_loop+8) 948 clc 8(8,%r12),BASED(cleanup_table_io_work_loop+8)
950 jl cleanup_io_return 949 jl cleanup_io_work_loop
9510: 9500:
952 br %r14 951 br %r14
953 952
@@ -1022,6 +1021,12 @@ cleanup_sysc_leave_insn:
1022 1021
1023cleanup_io_return: 1022cleanup_io_return:
1024 mvc __LC_RETURN_PSW(8),0(%r12) 1023 mvc __LC_RETURN_PSW(8),0(%r12)
1024 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_return)
1025 la %r12,__LC_RETURN_PSW
1026 br %r14
1027
1028cleanup_io_work_loop:
1029 mvc __LC_RETURN_PSW(8),0(%r12)
1025 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_work_loop) 1030 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_work_loop)
1026 la %r12,__LC_RETURN_PSW 1031 la %r12,__LC_RETURN_PSW
1027 br %r14 1032 br %r14
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index f5fe34dd821b..6a83d0581317 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -13,7 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <trace/syscall.h> 15#include <trace/syscall.h>
16#include <asm/lowcore.h> 16#include <asm/asm-offsets.h>
17 17
18#ifdef CONFIG_DYNAMIC_FTRACE 18#ifdef CONFIG_DYNAMIC_FTRACE
19 19
@@ -200,76 +200,3 @@ out:
200 return parent; 200 return parent;
201} 201}
202#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 202#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
203
204#ifdef CONFIG_FTRACE_SYSCALLS
205
206extern unsigned long __start_syscalls_metadata[];
207extern unsigned long __stop_syscalls_metadata[];
208extern unsigned int sys_call_table[];
209
210static struct syscall_metadata **syscalls_metadata;
211
212struct syscall_metadata *syscall_nr_to_meta(int nr)
213{
214 if (!syscalls_metadata || nr >= NR_syscalls || nr < 0)
215 return NULL;
216
217 return syscalls_metadata[nr];
218}
219
220int syscall_name_to_nr(char *name)
221{
222 int i;
223
224 if (!syscalls_metadata)
225 return -1;
226 for (i = 0; i < NR_syscalls; i++)
227 if (syscalls_metadata[i])
228 if (!strcmp(syscalls_metadata[i]->name, name))
229 return i;
230 return -1;
231}
232
233void set_syscall_enter_id(int num, int id)
234{
235 syscalls_metadata[num]->enter_id = id;
236}
237
238void set_syscall_exit_id(int num, int id)
239{
240 syscalls_metadata[num]->exit_id = id;
241}
242
243static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
244{
245 struct syscall_metadata *start;
246 struct syscall_metadata *stop;
247 char str[KSYM_SYMBOL_LEN];
248
249 start = (struct syscall_metadata *)__start_syscalls_metadata;
250 stop = (struct syscall_metadata *)__stop_syscalls_metadata;
251 kallsyms_lookup(syscall, NULL, NULL, NULL, str);
252
253 for ( ; start < stop; start++) {
254 if (start->name && !strcmp(start->name + 3, str + 3))
255 return start;
256 }
257 return NULL;
258}
259
260static int __init arch_init_ftrace_syscalls(void)
261{
262 struct syscall_metadata *meta;
263 int i;
264 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls,
265 GFP_KERNEL);
266 if (!syscalls_metadata)
267 return -ENOMEM;
268 for (i = 0; i < NR_syscalls; i++) {
269 meta = find_syscall_meta((unsigned long)sys_call_table[i]);
270 syscalls_metadata[i] = meta;
271 }
272 return 0;
273}
274arch_initcall(arch_init_ftrace_syscalls);
275#endif
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index c52b4f7742fa..9d1f76702d47 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 1999,2009 2 * Copyright IBM Corp. 1999,2010
3 * 3 *
4 * Author(s): Hartmut Penner <hp@de.ibm.com> 4 * Author(s): Hartmut Penner <hp@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
@@ -22,12 +22,9 @@
22 */ 22 */
23 23
24#include <linux/init.h> 24#include <linux/init.h>
25#include <asm/setup.h>
26#include <asm/lowcore.h>
27#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
28#include <asm/thread_info.h> 26#include <asm/thread_info.h>
29#include <asm/page.h> 27#include <asm/page.h>
30#include <asm/cpu.h>
31 28
32#ifdef CONFIG_64BIT 29#ifdef CONFIG_64BIT
33#define ARCH_OFFSET 4 30#define ARCH_OFFSET 4
@@ -288,19 +285,7 @@ iplstart:
288 bz .Lagain1 # skip dateset trailer 285 bz .Lagain1 # skip dateset trailer
289 la %r5,0(%r4,%r2) 286 la %r5,0(%r4,%r2)
290 lr %r3,%r2 287 lr %r3,%r2
291.Lidebc: 288 la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
292 tm 0(%r5),0x80 # high order bit set ?
293 bo .Ldocv # yes -> convert from EBCDIC
294 ahi %r5,-1
295 bct %r3,.Lidebc
296 b .Lnocv
297.Ldocv:
298 l %r3,.Lcvtab
299 tr 0(256,%r4),0(%r3) # convert parameters to ascii
300 tr 256(256,%r4),0(%r3)
301 tr 512(256,%r4),0(%r3)
302 tr 768(122,%r4),0(%r3)
303.Lnocv: la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
304 mvc 0(256,%r3),0(%r4) 289 mvc 0(256,%r3),0(%r4)
305 mvc 256(256,%r3),256(%r4) 290 mvc 256(256,%r3),256(%r4)
306 mvc 512(256,%r3),512(%r4) 291 mvc 512(256,%r3),512(%r4)
@@ -384,7 +369,6 @@ iplstart:
384.Linitrd:.long _end + 0x400000 # default address of initrd 369.Linitrd:.long _end + 0x400000 # default address of initrd
385.Lparm: .long PARMAREA 370.Lparm: .long PARMAREA
386.Lstartup: .long startup 371.Lstartup: .long startup
387.Lcvtab:.long _ebcasc # ebcdic to ascii table
388.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40 372.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
389 .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6 373 .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
390 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" 374 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold"
@@ -417,13 +401,10 @@ start:
417.sk8x8: 401.sk8x8:
418 mvc 0(240,%r8),0(%r9) # copy iplparms into buffer 402 mvc 0(240,%r8),0(%r9) # copy iplparms into buffer
419.gotr: 403.gotr:
420 l %r10,.tbl # EBCDIC to ASCII table
421 tr 0(240,%r8),0(%r10)
422 slr %r0,%r0 404 slr %r0,%r0
423 st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11) 405 st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11)
424 st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11) 406 st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11)
425 j startup # continue with startup 407 j startup # continue with startup
426.tbl: .long _ebcasc # translate table
427.cmd: .long COMMAND_LINE # address of command line buffer 408.cmd: .long COMMAND_LINE # address of command line buffer
428.parm: .long PARMAREA 409.parm: .long PARMAREA
429.lowcase: 410.lowcase:
@@ -467,16 +448,15 @@ start:
467# or linload or SALIPL 448# or linload or SALIPL
468# 449#
469 .org 0x10000 450 .org 0x10000
470startup:basr %r13,0 # get base 451 .globl startup
452startup:
453 basr %r13,0 # get base
471.LPG0: 454.LPG0:
472 xc 0x200(256),0x200 # partially clear lowcore 455 xc 0x200(256),0x200 # partially clear lowcore
473 xc 0x300(256),0x300 456 xc 0x300(256),0x300
474 l %r1,5f-.LPG0(%r13) 457 stck __LC_LAST_UPDATE_CLOCK
475 stck 0(%r1) 458 spt 5f-.LPG0(%r13)
476 spt 6f-.LPG0(%r13) 459 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
477 mvc __LC_LAST_UPDATE_CLOCK(8),0(%r1)
478 mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
479 mvc __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
480#ifndef CONFIG_MARCH_G5 460#ifndef CONFIG_MARCH_G5
481 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 461 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
482 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST 462 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
@@ -494,7 +474,6 @@ startup:basr %r13,0 # get base
494 cl %r0,2f+12-.LPG0(%r13) 474 cl %r0,2f+12-.LPG0(%r13)
495 je 3f 475 je 3f
4961: l %r15,.Lstack-.LPG0(%r13) 4761: l %r15,.Lstack-.LPG0(%r13)
497 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
498 ahi %r15,-96 477 ahi %r15,-96
499 la %r2,.Lals_string-.LPG0(%r13) 478 la %r2,.Lals_string-.LPG0(%r13)
500 l %r3,.Lsclp_print-.LPG0(%r13) 479 l %r3,.Lsclp_print-.LPG0(%r13)
@@ -505,7 +484,7 @@ startup:basr %r13,0 # get base
505.Lsclp_print: 484.Lsclp_print:
506 .long _sclp_print_early 485 .long _sclp_print_early
507.Lstack: 486.Lstack:
508 .long init_thread_union 487 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
509 .align 16 488 .align 16
5102: .long 0x000a0000,0x8badcccc 4892: .long 0x000a0000,0x8badcccc
511#if defined(CONFIG_64BIT) 490#if defined(CONFIG_64BIT)
@@ -532,13 +511,25 @@ startup:basr %r13,0 # get base
5323: 5113:
533#endif 512#endif
534 513
514#ifdef CONFIG_64BIT
515 mvi __LC_AR_MODE_ID,1 # set esame flag
516 slr %r0,%r0 # set cpuid to zero
517 lhi %r1,2 # mode 2 = esame (dump)
518 sigp %r1,%r0,0x12 # switch to esame mode
519 sam64 # switch to 64 bit mode
520 larl %r13,4f
521 lmh %r0,%r15,0(%r13) # clear high-order half
522 jg startup_continue
5234: .fill 16,4,0x0
524#else
525 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
535 l %r13,4f-.LPG0(%r13) 526 l %r13,4f-.LPG0(%r13)
536 b 0(%r13) 527 b 0(%r13)
537 .align 4 528 .align 8
5384: .long startup_continue 5294: .long startup_continue
5395: .long sched_clock_base_cc 530#endif
540 .align 8 531 .align 8
5416: .long 0x7fffffff,0xffffffff 5325: .long 0x7fffffff,0xffffffff
542 533
543# 534#
544# params at 10400 (setup.h) 535# params at 10400 (setup.h)
@@ -552,8 +543,4 @@ startup:basr %r13,0 # get base
552 .byte "root=/dev/ram0 ro" 543 .byte "root=/dev/ram0 ro"
553 .byte 0 544 .byte 0
554 545
555#ifdef CONFIG_64BIT 546 .org 0x11000
556#include "head64.S"
557#else
558#include "head31.S"
559#endif
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index 602b508cd4c4..b8f8dc126102 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/head31.S 2 * arch/s390/kernel/head31.S
3 * 3 *
4 * Copyright (C) IBM Corp. 2005,2006 4 * Copyright (C) IBM Corp. 2005,2010
5 * 5 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 6 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 7 * Martin Schwidefsky <schwidefsky@de.ibm.com>
@@ -10,13 +10,19 @@
10 * 10 *
11 */ 11 */
12 12
13 .org 0x11000 13#include <linux/init.h>
14#include <asm/asm-offsets.h>
15#include <asm/thread_info.h>
16#include <asm/page.h>
14 17
18__HEAD
19 .globl startup_continue
15startup_continue: 20startup_continue:
16 basr %r13,0 # get base 21 basr %r13,0 # get base
17.LPG1: 22.LPG1:
18 23
19 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) 24 l %r1,.Lbase_cc-.LPG1(%r13)
25 mvc 0(8,%r1),__LC_LAST_UPDATE_CLOCK
20 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 26 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
21 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 27 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
22 # move IPL device to lowcore 28 # move IPL device to lowcore
@@ -69,12 +75,14 @@ startup_continue:
69.Lduald:.rept 8 75.Lduald:.rept 8
70 .long 0x80000000,0,0,0 # invalid access-list entries 76 .long 0x80000000,0,0,0 # invalid access-list entries
71 .endr 77 .endr
78.Lbase_cc:
79 .long sched_clock_base_cc
72 80
73 .org 0x12000
74 .globl _ehead 81 .globl _ehead
75_ehead: 82_ehead:
83
76#ifdef CONFIG_SHARED_KERNEL 84#ifdef CONFIG_SHARED_KERNEL
77 .org 0x100000 85 .org 0x100000 - 0x11000 # head.o ends at 0x11000
78#endif 86#endif
79 87
80# 88#
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 6a250808092b..cdef68717416 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/head64.S 2 * arch/s390/kernel/head64.S
3 * 3 *
4 * Copyright (C) IBM Corp. 1999,2006 4 * Copyright (C) IBM Corp. 1999,2010
5 * 5 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 6 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 7 * Martin Schwidefsky <schwidefsky@de.ibm.com>
@@ -10,79 +10,17 @@
10 * 10 *
11 */ 11 */
12 12
13 .org 0x11000 13#include <linux/init.h>
14#include <asm/asm-offsets.h>
15#include <asm/thread_info.h>
16#include <asm/page.h>
14 17
18__HEAD
19 .globl startup_continue
15startup_continue: 20startup_continue:
16 basr %r13,0 # get base 21 larl %r1,sched_clock_base_cc
17.LPG1: sll %r13,1 # remove high order bit 22 mvc 0(8,%r1),__LC_LAST_UPDATE_CLOCK
18 srl %r13,1 23 larl %r13,.LPG1 # get base
19
20#ifdef CONFIG_ZFCPDUMP
21
22 # check if we have been ipled using zfcp dump:
23
24 tm 0xb9,0x01 # test if subchannel is enabled
25 jno .nodump # subchannel disabled
26 l %r1,0xb8
27 la %r5,.Lipl_schib-.LPG1(%r13)
28 stsch 0(%r5) # get schib of subchannel
29 jne .nodump # schib not available
30 tm 5(%r5),0x01 # devno valid?
31 jno .nodump
32 tm 4(%r5),0x80 # qdio capable device?
33 jno .nodump
34 l %r2,20(%r0) # address of ipl parameter block
35 lhi %r3,0
36 ic %r3,0x148(%r2) # get opt field
37 chi %r3,0x20 # load with dump?
38 jne .nodump
39
40 # store all prefix registers in case of load with dump:
41
42 la %r7,0 # base register for 0 page
43 la %r8,0 # first cpu
44 l %r11,.Lpref_arr_ptr-.LPG1(%r13) # address of prefix array
45 ahi %r11,4 # skip boot cpu
46 lr %r12,%r11
47 ahi %r12,(CONFIG_NR_CPUS*4) # end of prefix array
48 stap .Lcurrent_cpu+2-.LPG1(%r13) # store current cpu addr
491:
50 cl %r8,.Lcurrent_cpu-.LPG1(%r13) # is ipl cpu ?
51 je 4f # if yes get next cpu
522:
53 lr %r9,%r7
54 sigp %r9,%r8,0x9 # stop & store status of cpu
55 brc 8,3f # accepted
56 brc 4,4f # status stored: next cpu
57 brc 2,2b # busy: try again
58 brc 1,4f # not op: next cpu
593:
60 mvc 0(4,%r11),264(%r7) # copy prefix register to prefix array
61 ahi %r11,4 # next element in prefix array
62 clr %r11,%r12
63 je 5f # no more space in prefix array
644:
65 ahi %r8,1 # next cpu (r8 += 1)
66 chi %r8,MAX_CPU_ADDRESS # is last possible cpu ?
67 jle 1b # jump if not last cpu
685:
69 lhi %r1,2 # mode 2 = esame (dump)
70 j 6f
71 .align 4
72.Lipl_schib:
73 .rept 13
74 .long 0
75 .endr
76.nodump:
77 lhi %r1,1 # mode 1 = esame (normal ipl)
786:
79#else
80 lhi %r1,1 # mode 1 = esame (normal ipl)
81#endif /* CONFIG_ZFCPDUMP */
82 mvi __LC_AR_MODE_ID,1 # set esame flag
83 slr %r0,%r0 # set cpuid to zero
84 sigp %r1,%r0,0x12 # switch to esame mode
85 sam64 # switch to 64 bit mode
86 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 24 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
87 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 25 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
88 # move IPL device to lowcore 26 # move IPL device to lowcore
@@ -106,6 +44,7 @@ startup_continue:
106 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, 44 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
107 # virtual and never return ... 45 # virtual and never return ...
108 .align 16 46 .align 16
47.LPG1:
109.Lentry:.quad 0x0000000180000000,_stext 48.Lentry:.quad 0x0000000180000000,_stext
110.Lctl: .quad 0x04350002 # cr0: various things 49.Lctl: .quad 0x04350002 # cr0: various things
111 .quad 0 # cr1: primary space segment table 50 .quad 0 # cr1: primary space segment table
@@ -127,12 +66,6 @@ startup_continue:
127.L4malign:.quad 0xffffffffffc00000 66.L4malign:.quad 0xffffffffffc00000
128.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 67.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
129.Lnop: .long 0x07000700 68.Lnop: .long 0x07000700
130#ifdef CONFIG_ZFCPDUMP
131.Lcurrent_cpu:
132 .long 0x0
133.Lpref_arr_ptr:
134 .long zfcpdump_prefix_array
135#endif /* CONFIG_ZFCPDUMP */
136.Lparmaddr: 69.Lparmaddr:
137 .quad PARMAREA 70 .quad PARMAREA
138 .align 64 71 .align 64
@@ -143,11 +76,11 @@ startup_continue:
143 .long 0x80000000,0,0,0 # invalid access-list entries 76 .long 0x80000000,0,0,0 # invalid access-list entries
144 .endr 77 .endr
145 78
146 .org 0x12000
147 .globl _ehead 79 .globl _ehead
148_ehead: 80_ehead:
81
149#ifdef CONFIG_SHARED_KERNEL 82#ifdef CONFIG_SHARED_KERNEL
150 .org 0x100000 83 .org 0x100000 - 0x11000 # head.o ends at 0x11000
151#endif 84#endif
152 85
153# 86#
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 4890ac6d7faa..72c8b0d070c8 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -15,6 +15,7 @@
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/ctype.h> 16#include <linux/ctype.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/gfp.h>
18#include <asm/ipl.h> 19#include <asm/ipl.h>
19#include <asm/smp.h> 20#include <asm/smp.h>
20#include <asm/setup.h> 21#include <asm/setup.h>
@@ -221,7 +222,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
221 const char *buf, size_t len) \ 222 const char *buf, size_t len) \
222{ \ 223{ \
223 strncpy(_value, buf, sizeof(_value) - 1); \ 224 strncpy(_value, buf, sizeof(_value) - 1); \
224 strstrip(_value); \ 225 strim(_value); \
225 return len; \ 226 return len; \
226} \ 227} \
227static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 228static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -472,7 +473,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
472 return sprintf(page, "#unknown#\n"); 473 return sprintf(page, "#unknown#\n");
473 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); 474 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN);
474 EBCASC(loadparm, LOADPARM_LEN); 475 EBCASC(loadparm, LOADPARM_LEN);
475 strstrip(loadparm); 476 strim(loadparm);
476 return sprintf(page, "%s\n", loadparm); 477 return sprintf(page, "%s\n", loadparm);
477} 478}
478 479
@@ -553,7 +554,7 @@ out:
553 return rc; 554 return rc;
554} 555}
555 556
556static void ipl_run(struct shutdown_trigger *trigger) 557static void __ipl_run(void *unused)
557{ 558{
558 diag308(DIAG308_IPL, NULL); 559 diag308(DIAG308_IPL, NULL);
559 if (MACHINE_IS_VM) 560 if (MACHINE_IS_VM)
@@ -562,6 +563,11 @@ static void ipl_run(struct shutdown_trigger *trigger)
562 reipl_ccw_dev(&ipl_info.data.ccw.dev_id); 563 reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
563} 564}
564 565
566static void ipl_run(struct shutdown_trigger *trigger)
567{
568 smp_switch_to_ipl_cpu(__ipl_run, NULL);
569}
570
565static int __init ipl_init(void) 571static int __init ipl_init(void)
566{ 572{
567 int rc; 573 int rc;
@@ -776,7 +782,7 @@ static void reipl_get_ascii_loadparm(char *loadparm,
776 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); 782 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN);
777 EBCASC(loadparm, LOADPARM_LEN); 783 EBCASC(loadparm, LOADPARM_LEN);
778 loadparm[LOADPARM_LEN] = 0; 784 loadparm[LOADPARM_LEN] = 0;
779 strstrip(loadparm); 785 strim(loadparm);
780} 786}
781 787
782static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb, 788static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb,
@@ -1039,7 +1045,7 @@ static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
1039 sprintf(dst + pos, " PARM %s", vmparm); 1045 sprintf(dst + pos, " PARM %s", vmparm);
1040} 1046}
1041 1047
1042static void reipl_run(struct shutdown_trigger *trigger) 1048static void __reipl_run(void *unused)
1043{ 1049{
1044 struct ccw_dev_id devid; 1050 struct ccw_dev_id devid;
1045 static char buf[128]; 1051 static char buf[128];
@@ -1087,6 +1093,11 @@ static void reipl_run(struct shutdown_trigger *trigger)
1087 disabled_wait((unsigned long) __builtin_return_address(0)); 1093 disabled_wait((unsigned long) __builtin_return_address(0));
1088} 1094}
1089 1095
1096static void reipl_run(struct shutdown_trigger *trigger)
1097{
1098 smp_switch_to_ipl_cpu(__reipl_run, NULL);
1099}
1100
1090static void reipl_block_ccw_init(struct ipl_parameter_block *ipb) 1101static void reipl_block_ccw_init(struct ipl_parameter_block *ipb)
1091{ 1102{
1092 ipb->hdr.len = IPL_PARM_BLK_CCW_LEN; 1103 ipb->hdr.len = IPL_PARM_BLK_CCW_LEN;
@@ -1369,20 +1380,18 @@ static struct kobj_attribute dump_type_attr =
1369 1380
1370static struct kset *dump_kset; 1381static struct kset *dump_kset;
1371 1382
1372static void dump_run(struct shutdown_trigger *trigger) 1383static void __dump_run(void *unused)
1373{ 1384{
1374 struct ccw_dev_id devid; 1385 struct ccw_dev_id devid;
1375 static char buf[100]; 1386 static char buf[100];
1376 1387
1377 switch (dump_method) { 1388 switch (dump_method) {
1378 case DUMP_METHOD_CCW_CIO: 1389 case DUMP_METHOD_CCW_CIO:
1379 smp_send_stop();
1380 devid.devno = dump_block_ccw->ipl_info.ccw.devno; 1390 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1381 devid.ssid = 0; 1391 devid.ssid = 0;
1382 reipl_ccw_dev(&devid); 1392 reipl_ccw_dev(&devid);
1383 break; 1393 break;
1384 case DUMP_METHOD_CCW_VM: 1394 case DUMP_METHOD_CCW_VM:
1385 smp_send_stop();
1386 sprintf(buf, "STORE STATUS"); 1395 sprintf(buf, "STORE STATUS");
1387 __cpcmd(buf, NULL, 0, NULL); 1396 __cpcmd(buf, NULL, 0, NULL);
1388 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno); 1397 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
@@ -1396,10 +1405,17 @@ static void dump_run(struct shutdown_trigger *trigger)
1396 diag308(DIAG308_SET, dump_block_fcp); 1405 diag308(DIAG308_SET, dump_block_fcp);
1397 diag308(DIAG308_DUMP, NULL); 1406 diag308(DIAG308_DUMP, NULL);
1398 break; 1407 break;
1399 case DUMP_METHOD_NONE: 1408 default:
1400 return; 1409 break;
1401 } 1410 }
1402 printk(KERN_EMERG "Dump failed!\n"); 1411}
1412
1413static void dump_run(struct shutdown_trigger *trigger)
1414{
1415 if (dump_method == DUMP_METHOD_NONE)
1416 return;
1417 smp_send_stop();
1418 smp_switch_to_ipl_cpu(__dump_run, NULL);
1403} 1419}
1404 1420
1405static int __init dump_ccw_init(void) 1421static int __init dump_ccw_init(void)
@@ -1577,7 +1593,7 @@ static void vmcmd_run(struct shutdown_trigger *trigger)
1577static int vmcmd_init(void) 1593static int vmcmd_init(void)
1578{ 1594{
1579 if (!MACHINE_IS_VM) 1595 if (!MACHINE_IS_VM)
1580 return -ENOTSUPP; 1596 return -EOPNOTSUPP;
1581 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj); 1597 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj);
1582 if (!vmcmd_kset) 1598 if (!vmcmd_kset)
1583 return -ENOMEM; 1599 return -ENOMEM;
@@ -1595,7 +1611,7 @@ static void stop_run(struct shutdown_trigger *trigger)
1595{ 1611{
1596 if (strcmp(trigger->name, ON_PANIC_STR) == 0) 1612 if (strcmp(trigger->name, ON_PANIC_STR) == 0)
1597 disabled_wait((unsigned long) __builtin_return_address(0)); 1613 disabled_wait((unsigned long) __builtin_return_address(0));
1598 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy) 1614 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
1599 cpu_relax(); 1615 cpu_relax();
1600 for (;;); 1616 for (;;);
1601} 1617}
@@ -1902,7 +1918,6 @@ void __init ipl_update_parameters(void)
1902void __init ipl_save_parameters(void) 1918void __init ipl_save_parameters(void)
1903{ 1919{
1904 struct cio_iplinfo iplinfo; 1920 struct cio_iplinfo iplinfo;
1905 unsigned int *ipl_ptr;
1906 void *src, *dst; 1921 void *src, *dst;
1907 1922
1908 if (cio_get_iplinfo(&iplinfo)) 1923 if (cio_get_iplinfo(&iplinfo))
@@ -1913,11 +1928,10 @@ void __init ipl_save_parameters(void)
1913 if (!iplinfo.is_qdio) 1928 if (!iplinfo.is_qdio)
1914 return; 1929 return;
1915 ipl_flags |= IPL_PARMBLOCK_VALID; 1930 ipl_flags |= IPL_PARMBLOCK_VALID;
1916 ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR; 1931 src = (void *)(unsigned long)S390_lowcore.ipl_parmblock_ptr;
1917 src = (void *)(unsigned long)*ipl_ptr;
1918 dst = (void *)IPL_PARMBLOCK_ORIGIN; 1932 dst = (void *)IPL_PARMBLOCK_ORIGIN;
1919 memmove(dst, src, PAGE_SIZE); 1933 memmove(dst, src, PAGE_SIZE);
1920 *ipl_ptr = IPL_PARMBLOCK_ORIGIN; 1934 S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
1921} 1935}
1922 1936
1923static LIST_HEAD(rcall); 1937static LIST_HEAD(rcall);
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 86783efa24ee..3d34eef5a2c3 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -29,6 +29,7 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/sections.h> 30#include <asm/sections.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/slab.h>
32 33
33DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 34DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
34DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 35DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 131d7ee8b416..a922d51df6bf 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -54,11 +54,11 @@ void machine_shutdown(void)
54{ 54{
55} 55}
56 56
57void machine_kexec(struct kimage *image) 57static void __machine_kexec(void *data)
58{ 58{
59 relocate_kernel_t data_mover; 59 relocate_kernel_t data_mover;
60 struct kimage *image = data;
60 61
61 smp_send_stop();
62 pfault_fini(); 62 pfault_fini();
63 s390_reset_system(); 63 s390_reset_system();
64 64
@@ -68,3 +68,9 @@ void machine_kexec(struct kimage *image)
68 (*data_mover)(&image->head, image->start); 68 (*data_mover)(&image->head, image->start);
69 for (;;); 69 for (;;);
70} 70}
71
72void machine_kexec(struct kimage *image)
73{
74 smp_send_stop();
75 smp_switch_to_ipl_cpu(__machine_kexec, image);
76}
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 5417eb57271a..1039fdea15b5 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -16,9 +16,9 @@
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/slab.h>
19#include <linux/unistd.h> 20#include <linux/unistd.h>
20#include <linux/ptrace.h> 21#include <linux/ptrace.h>
21#include <linux/slab.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/user.h> 23#include <linux/user.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
@@ -153,8 +153,6 @@ void exit_thread(void)
153 153
154void flush_thread(void) 154void flush_thread(void)
155{ 155{
156 clear_used_math();
157 clear_tsk_thread_flag(current, TIF_USEDFPU);
158} 156}
159 157
160void release_thread(struct task_struct *dead_task) 158void release_thread(struct task_struct *dead_task)
@@ -217,6 +215,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
217 p->thread.mm_segment = get_fs(); 215 p->thread.mm_segment = get_fs();
218 /* Don't copy debug registers */ 216 /* Don't copy debug registers */
219 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); 217 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info));
218 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
220 /* Initialize per thread user and system timer values */ 219 /* Initialize per thread user and system timer values */
221 ti = task_thread_info(p); 220 ti = task_thread_info(p);
222 ti->user_timer = 0; 221 ti->user_timer = 0;
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 653c6a178740..9f654da4cecc 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -65,6 +65,7 @@ FixPerRegisters(struct task_struct *task)
65{ 65{
66 struct pt_regs *regs; 66 struct pt_regs *regs;
67 per_struct *per_info; 67 per_struct *per_info;
68 per_cr_words cr_words;
68 69
69 regs = task_pt_regs(task); 70 regs = task_pt_regs(task);
70 per_info = (per_struct *) &task->thread.per_info; 71 per_info = (per_struct *) &task->thread.per_info;
@@ -98,6 +99,13 @@ FixPerRegisters(struct task_struct *task)
98 per_info->control_regs.bits.storage_alt_space_ctl = 1; 99 per_info->control_regs.bits.storage_alt_space_ctl = 1;
99 else 100 else
100 per_info->control_regs.bits.storage_alt_space_ctl = 0; 101 per_info->control_regs.bits.storage_alt_space_ctl = 0;
102
103 if (task == current) {
104 __ctl_store(cr_words, 9, 11);
105 if (memcmp(&cr_words, &per_info->control_regs.words,
106 sizeof(cr_words)) != 0)
107 __ctl_load(per_info->control_regs.words, 9, 11);
108 }
101} 109}
102 110
103void user_enable_single_step(struct task_struct *task) 111void user_enable_single_step(struct task_struct *task)
@@ -632,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
632 640
633asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 641asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
634{ 642{
635 long ret; 643 long ret = 0;
636 644
637 /* Do the secure computing check first. */ 645 /* Do the secure computing check first. */
638 secure_computing(regs->gprs[2]); 646 secure_computing(regs->gprs[2]);
@@ -641,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
641 * The sysc_tracesys code in entry.S stored the system 649 * The sysc_tracesys code in entry.S stored the system
642 * call number to gprs[2]. 650 * call number to gprs[2].
643 */ 651 */
644 ret = regs->gprs[2];
645 if (test_thread_flag(TIF_SYSCALL_TRACE) && 652 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
646 (tracehook_report_syscall_entry(regs) || 653 (tracehook_report_syscall_entry(regs) ||
647 regs->gprs[2] >= NR_syscalls)) { 654 regs->gprs[2] >= NR_syscalls)) {
@@ -663,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
663 regs->gprs[2], regs->orig_gpr2, 670 regs->gprs[2], regs->orig_gpr2,
664 regs->gprs[3], regs->gprs[4], 671 regs->gprs[3], regs->gprs[4],
665 regs->gprs[5]); 672 regs->gprs[5]);
666 return ret; 673 return ret ?: regs->gprs[2];
667} 674}
668 675
669asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) 676asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
@@ -959,7 +966,7 @@ static const struct user_regset s390_compat_regsets[] = {
959 .set = s390_fpregs_set, 966 .set = s390_fpregs_set,
960 }, 967 },
961 [REGSET_GENERAL_EXTENDED] = { 968 [REGSET_GENERAL_EXTENDED] = {
962 .core_note_type = NT_PRXSTATUS, 969 .core_note_type = NT_S390_HIGH_GPRS,
963 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), 970 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t),
964 .size = sizeof(compat_long_t), 971 .size = sizeof(compat_long_t),
965 .align = sizeof(compat_long_t), 972 .align = sizeof(compat_long_t),
@@ -984,3 +991,61 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
984#endif 991#endif
985 return &user_s390_view; 992 return &user_s390_view;
986} 993}
994
995static const char *gpr_names[NUM_GPRS] = {
996 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
997 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
998};
999
1000unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset)
1001{
1002 if (offset >= NUM_GPRS)
1003 return 0;
1004 return regs->gprs[offset];
1005}
1006
1007int regs_query_register_offset(const char *name)
1008{
1009 unsigned long offset;
1010
1011 if (!name || *name != 'r')
1012 return -EINVAL;
1013 if (strict_strtoul(name + 1, 10, &offset))
1014 return -EINVAL;
1015 if (offset >= NUM_GPRS)
1016 return -EINVAL;
1017 return offset;
1018}
1019
1020const char *regs_query_register_name(unsigned int offset)
1021{
1022 if (offset >= NUM_GPRS)
1023 return NULL;
1024 return gpr_names[offset];
1025}
1026
1027static int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
1028{
1029 unsigned long ksp = kernel_stack_pointer(regs);
1030
1031 return (addr & ~(THREAD_SIZE - 1)) == (ksp & ~(THREAD_SIZE - 1));
1032}
1033
1034/**
1035 * regs_get_kernel_stack_nth() - get Nth entry of the stack
1036 * @regs:pt_regs which contains kernel stack pointer.
1037 * @n:stack entry number.
1038 *
1039 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
1040 * is specifined by @regs. If the @n th entry is NOT in the kernel stack,
1041 * this returns 0.
1042 */
1043unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
1044{
1045 unsigned long addr;
1046
1047 addr = kernel_stack_pointer(regs) + n * sizeof(long);
1048 if (!regs_within_kernel_stack(regs, addr))
1049 return 0;
1050 return *(unsigned long *)addr;
1051}
diff --git a/arch/s390/kernel/reipl.S b/arch/s390/kernel/reipl.S
index 2f481cc3d1c9..cb899d9f8505 100644
--- a/arch/s390/kernel/reipl.S
+++ b/arch/s390/kernel/reipl.S
@@ -6,7 +6,7 @@
6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com) 6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
7 */ 7 */
8 8
9#include <asm/lowcore.h> 9#include <asm/asm-offsets.h>
10 10
11# 11#
12# do_reipl_asm 12# do_reipl_asm
diff --git a/arch/s390/kernel/reipl64.S b/arch/s390/kernel/reipl64.S
index 774147824c3d..5e73dee63baa 100644
--- a/arch/s390/kernel/reipl64.S
+++ b/arch/s390/kernel/reipl64.S
@@ -4,7 +4,7 @@
4 * Denis Joseph Barrow, 4 * Denis Joseph Barrow,
5 */ 5 */
6 6
7#include <asm/lowcore.h> 7#include <asm/asm-offsets.h>
8 8
9# 9#
10# do_reipl_asm 10# do_reipl_asm
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 0de305b598ce..59618bcd99b7 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -126,6 +126,8 @@ void __irq_entry do_extint(struct pt_regs *regs, unsigned short code)
126 /* Serve timer interrupts first. */ 126 /* Serve timer interrupts first. */
127 clock_comparator_work(); 127 clock_comparator_work();
128 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 128 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
129 if (code != 0x1004)
130 __get_cpu_var(s390_idle).nohz_delay = 1;
129 index = ext_hash(code); 131 index = ext_hash(code);
130 for (p = ext_int_hash[index]; p; p = p->next) { 132 for (p = ext_int_hash[index]; p; p = p->next) {
131 if (likely(p->code == code)) 133 if (likely(p->code == code))
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index e27ca63076d1..2e82fdd89320 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -9,8 +9,10 @@
9 */ 9 */
10 10
11LC_EXT_NEW_PSW = 0x58 # addr of ext int handler 11LC_EXT_NEW_PSW = 0x58 # addr of ext int handler
12LC_EXT_NEW_PSW_64 = 0x1b0 # addr of ext int handler 64 bit
12LC_EXT_INT_PARAM = 0x80 # addr of ext int parameter 13LC_EXT_INT_PARAM = 0x80 # addr of ext int parameter
13LC_EXT_INT_CODE = 0x86 # addr of ext int code 14LC_EXT_INT_CODE = 0x86 # addr of ext int code
15LC_AR_MODE_ID = 0xa3
14 16
15# 17#
16# Subroutine which waits synchronously until either an external interruption 18# Subroutine which waits synchronously until either an external interruption
@@ -30,8 +32,16 @@ _sclp_wait_int:
30.LbaseS1: 32.LbaseS1:
31 ahi %r15,-96 # create stack frame 33 ahi %r15,-96 # create stack frame
32 la %r8,LC_EXT_NEW_PSW # register int handler 34 la %r8,LC_EXT_NEW_PSW # register int handler
33 mvc .LoldpswS1-.LbaseS1(8,%r13),0(%r8) 35 la %r9,.LextpswS1-.LbaseS1(%r13)
34 mvc 0(8,%r8),.LextpswS1-.LbaseS1(%r13) 36#ifdef CONFIG_64BIT
37 tm LC_AR_MODE_ID,1
38 jno .Lesa1
39 la %r8,LC_EXT_NEW_PSW_64 # register int handler 64 bit
40 la %r9,.LextpswS1_64-.LbaseS1(%r13)
41.Lesa1:
42#endif
43 mvc .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
44 mvc 0(16,%r8),0(%r9)
35 lhi %r6,0x0200 # cr mask for ext int (cr0.54) 45 lhi %r6,0x0200 # cr mask for ext int (cr0.54)
36 ltr %r2,%r2 46 ltr %r2,%r2
37 jz .LsetctS1 47 jz .LsetctS1
@@ -64,15 +74,19 @@ _sclp_wait_int:
64.LtimeoutS1: 74.LtimeoutS1:
65 lctl %c0,%c0,.LctlS1-.LbaseS1(%r13) # restore interrupt setting 75 lctl %c0,%c0,.LctlS1-.LbaseS1(%r13) # restore interrupt setting
66 # restore old handler 76 # restore old handler
67 mvc 0(8,%r8),.LoldpswS1-.LbaseS1(%r13) 77 mvc 0(16,%r8),.LoldpswS1-.LbaseS1(%r13)
68 lm %r6,%r15,120(%r15) # restore registers 78 lm %r6,%r15,120(%r15) # restore registers
69 br %r14 # return to caller 79 br %r14 # return to caller
70 80
71 .align 8 81 .align 8
72.LoldpswS1: 82.LoldpswS1:
73 .long 0, 0 # old ext int PSW 83 .long 0, 0, 0, 0 # old ext int PSW
74.LextpswS1: 84.LextpswS1:
75 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int 85 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
86#ifdef CONFIG_64BIT
87.LextpswS1_64:
88 .quad 0x0000000180000000, .LwaitS1 # PSW to handle ext int, 64 bit
89#endif
76.LwaitpswS1: 90.LwaitpswS1:
77 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int 91 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
78.LtimeS1: 92.LtimeS1:
@@ -221,7 +235,7 @@ _sclp_print:
221 lh %r9,0(%r8) # update sccb length 235 lh %r9,0(%r8) # update sccb length
222 ar %r9,%r6 236 ar %r9,%r6
223 sth %r9,0(%r8) 237 sth %r9,0(%r8)
224 ar %r7,%r6 # update current mto adress 238 ar %r7,%r6 # update current mto address
225 ltr %r0,%r0 # more characters? 239 ltr %r0,%r0 # more characters?
226 jnz .LinitmtoS4 240 jnz .LinitmtoS4
227 l %r2,.LwritedataS4-.LbaseS4(%r13)# write data 241 l %r2,.LwritedataS4-.LbaseS4(%r13)# write data
@@ -250,6 +264,13 @@ _sclp_print:
250_sclp_print_early: 264_sclp_print_early:
251 stm %r6,%r15,24(%r15) # save registers 265 stm %r6,%r15,24(%r15) # save registers
252 ahi %r15,-96 # create stack frame 266 ahi %r15,-96 # create stack frame
267#ifdef CONFIG_64BIT
268 tm LC_AR_MODE_ID,1
269 jno .Lesa2
270 ahi %r15,-80
271 stmh %r6,%r15,96(%r15) # store upper register halves
272.Lesa2:
273#endif
253 lr %r10,%r2 # save string pointer 274 lr %r10,%r2 # save string pointer
254 lhi %r2,0 275 lhi %r2,0
255 bras %r14,_sclp_setup # enable console 276 bras %r14,_sclp_setup # enable console
@@ -262,6 +283,13 @@ _sclp_print_early:
262 lhi %r2,1 283 lhi %r2,1
263 bras %r14,_sclp_setup # disable console 284 bras %r14,_sclp_setup # disable console
264.LendS5: 285.LendS5:
286#ifdef CONFIG_64BIT
287 tm LC_AR_MODE_ID,1
288 jno .Lesa3
289 lmh %r6,%r15,96(%r15) # store upper register halves
290 ahi %r15,80
291.Lesa3:
292#endif
265 lm %r6,%r15,120(%r15) # restore registers 293 lm %r6,%r15,120(%r15) # restore registers
266 br %r14 294 br %r14
267 295
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 061479ff029f..91625f759ccd 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -25,7 +25,6 @@
25#include <linux/stddef.h> 25#include <linux/stddef.h>
26#include <linux/unistd.h> 26#include <linux/unistd.h>
27#include <linux/ptrace.h> 27#include <linux/ptrace.h>
28#include <linux/slab.h>
29#include <linux/user.h> 28#include <linux/user.h>
30#include <linux/tty.h> 29#include <linux/tty.h>
31#include <linux/ioport.h> 30#include <linux/ioport.h>
@@ -87,7 +86,6 @@ unsigned long elf_hwcap = 0;
87char elf_platform[ELF_PLATFORM_SIZE]; 86char elf_platform[ELF_PLATFORM_SIZE];
88 87
89struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 88struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
90volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
91 89
92int __initdata memory_end_set; 90int __initdata memory_end_set;
93unsigned long __initdata memory_end; 91unsigned long __initdata memory_end;
@@ -124,12 +122,6 @@ void __cpuinit cpu_init(void)
124 */ 122 */
125 get_cpu_id(&S390_lowcore.cpu_id); 123 get_cpu_id(&S390_lowcore.cpu_id);
126 124
127 /*
128 * Force FPU initialization:
129 */
130 clear_thread_flag(TIF_USEDFPU);
131 clear_used_math();
132
133 atomic_inc(&init_mm.mm_count); 125 atomic_inc(&init_mm.mm_count);
134 current->active_mm = &init_mm; 126 current->active_mm = &init_mm;
135 BUG_ON(current->mm); 127 BUG_ON(current->mm);
@@ -305,9 +297,8 @@ static int __init early_parse_mem(char *p)
305} 297}
306early_param("mem", early_parse_mem); 298early_param("mem", early_parse_mem);
307 299
308#ifdef CONFIG_S390_SWITCH_AMODE 300unsigned int user_mode = HOME_SPACE_MODE;
309unsigned int switch_amode = 0; 301EXPORT_SYMBOL_GPL(user_mode);
310EXPORT_SYMBOL_GPL(switch_amode);
311 302
312static int set_amode_and_uaccess(unsigned long user_amode, 303static int set_amode_and_uaccess(unsigned long user_amode,
313 unsigned long user32_amode) 304 unsigned long user32_amode)
@@ -340,23 +331,29 @@ static int set_amode_and_uaccess(unsigned long user_amode,
340 */ 331 */
341static int __init early_parse_switch_amode(char *p) 332static int __init early_parse_switch_amode(char *p)
342{ 333{
343 switch_amode = 1; 334 if (user_mode != SECONDARY_SPACE_MODE)
335 user_mode = PRIMARY_SPACE_MODE;
344 return 0; 336 return 0;
345} 337}
346early_param("switch_amode", early_parse_switch_amode); 338early_param("switch_amode", early_parse_switch_amode);
347 339
348#else /* CONFIG_S390_SWITCH_AMODE */ 340static int __init early_parse_user_mode(char *p)
349static inline int set_amode_and_uaccess(unsigned long user_amode,
350 unsigned long user32_amode)
351{ 341{
342 if (p && strcmp(p, "primary") == 0)
343 user_mode = PRIMARY_SPACE_MODE;
344#ifdef CONFIG_S390_EXEC_PROTECT
345 else if (p && strcmp(p, "secondary") == 0)
346 user_mode = SECONDARY_SPACE_MODE;
347#endif
348 else if (!p || strcmp(p, "home") == 0)
349 user_mode = HOME_SPACE_MODE;
350 else
351 return 1;
352 return 0; 352 return 0;
353} 353}
354#endif /* CONFIG_S390_SWITCH_AMODE */ 354early_param("user_mode", early_parse_user_mode);
355 355
356#ifdef CONFIG_S390_EXEC_PROTECT 356#ifdef CONFIG_S390_EXEC_PROTECT
357unsigned int s390_noexec = 0;
358EXPORT_SYMBOL_GPL(s390_noexec);
359
360/* 357/*
361 * Enable execute protection? 358 * Enable execute protection?
362 */ 359 */
@@ -364,8 +361,7 @@ static int __init early_parse_noexec(char *p)
364{ 361{
365 if (!strncmp(p, "off", 3)) 362 if (!strncmp(p, "off", 3))
366 return 0; 363 return 0;
367 switch_amode = 1; 364 user_mode = SECONDARY_SPACE_MODE;
368 s390_noexec = 1;
369 return 0; 365 return 0;
370} 366}
371early_param("noexec", early_parse_noexec); 367early_param("noexec", early_parse_noexec);
@@ -373,7 +369,7 @@ early_param("noexec", early_parse_noexec);
373 369
374static void setup_addressing_mode(void) 370static void setup_addressing_mode(void)
375{ 371{
376 if (s390_noexec) { 372 if (user_mode == SECONDARY_SPACE_MODE) {
377 if (set_amode_and_uaccess(PSW_ASC_SECONDARY, 373 if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
378 PSW32_ASC_SECONDARY)) 374 PSW32_ASC_SECONDARY))
379 pr_info("Execute protection active, " 375 pr_info("Execute protection active, "
@@ -381,7 +377,7 @@ static void setup_addressing_mode(void)
381 else 377 else
382 pr_info("Execute protection active, " 378 pr_info("Execute protection active, "
383 "mvcos not available\n"); 379 "mvcos not available\n");
384 } else if (switch_amode) { 380 } else if (user_mode == PRIMARY_SPACE_MODE) {
385 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) 381 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
386 pr_info("Address spaces switched, " 382 pr_info("Address spaces switched, "
387 "mvcos available\n"); 383 "mvcos available\n");
@@ -399,19 +395,16 @@ static void __init
399setup_lowcore(void) 395setup_lowcore(void)
400{ 396{
401 struct _lowcore *lc; 397 struct _lowcore *lc;
402 int lc_pages;
403 398
404 /* 399 /*
405 * Setup lowcore for boot cpu 400 * Setup lowcore for boot cpu
406 */ 401 */
407 lc_pages = sizeof(void *) == 8 ? 2 : 1; 402 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
408 lc = (struct _lowcore *) 403 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
409 __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
410 memset(lc, 0, lc_pages * PAGE_SIZE);
411 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 404 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
412 lc->restart_psw.addr = 405 lc->restart_psw.addr =
413 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 406 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
414 if (switch_amode) 407 if (user_mode != HOME_SPACE_MODE)
415 lc->restart_psw.mask |= PSW_ASC_HOME; 408 lc->restart_psw.mask |= PSW_ASC_HOME;
416 lc->external_new_psw.mask = psw_kernel_bits; 409 lc->external_new_psw.mask = psw_kernel_bits;
417 lc->external_new_psw.addr = 410 lc->external_new_psw.addr =
@@ -439,7 +432,7 @@ setup_lowcore(void)
439#ifndef CONFIG_64BIT 432#ifndef CONFIG_64BIT
440 if (MACHINE_HAS_IEEE) { 433 if (MACHINE_HAS_IEEE) {
441 lc->extended_save_area_addr = (__u32) 434 lc->extended_save_area_addr = (__u32)
442 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0); 435 __alloc_bootmem_low(PAGE_SIZE, PAGE_SIZE, 0);
443 /* enable extended save area */ 436 /* enable extended save area */
444 __ctl_set_bit(14, 29); 437 __ctl_set_bit(14, 29);
445 } 438 }
@@ -807,7 +800,7 @@ setup_arch(char **cmdline_p)
807 if (MACHINE_IS_VM) 800 if (MACHINE_IS_VM)
808 pr_info("Linux is running as a z/VM " 801 pr_info("Linux is running as a z/VM "
809 "guest operating system in 31-bit mode\n"); 802 "guest operating system in 31-bit mode\n");
810 else 803 else if (MACHINE_IS_LPAR)
811 pr_info("Linux is running natively in 31-bit mode\n"); 804 pr_info("Linux is running natively in 31-bit mode\n");
812 if (MACHINE_HAS_IEEE) 805 if (MACHINE_HAS_IEEE)
813 pr_info("The hardware system has IEEE compatible " 806 pr_info("The hardware system has IEEE compatible "
@@ -821,7 +814,7 @@ setup_arch(char **cmdline_p)
821 "guest operating system in 64-bit mode\n"); 814 "guest operating system in 64-bit mode\n");
822 else if (MACHINE_IS_KVM) 815 else if (MACHINE_IS_KVM)
823 pr_info("Linux is running under KVM in 64-bit mode\n"); 816 pr_info("Linux is running under KVM in 64-bit mode\n");
824 else 817 else if (MACHINE_IS_LPAR)
825 pr_info("Linux is running natively in 64-bit mode\n"); 818 pr_info("Linux is running natively in 64-bit mode\n");
826#endif /* CONFIG_64BIT */ 819#endif /* CONFIG_64BIT */
827 820
@@ -851,7 +844,6 @@ setup_arch(char **cmdline_p)
851 setup_lowcore(); 844 setup_lowcore();
852 845
853 cpu_init(); 846 cpu_init();
854 __cpu_logical_map[0] = stap();
855 s390_init_cpu_topology(); 847 s390_init_cpu_topology();
856 848
857 /* 849 /*
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 6b4fef877f9d..6289945562b0 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -64,7 +64,7 @@ SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
64 recalc_sigpending(); 64 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 65 spin_unlock_irq(&current->sighand->siglock);
66 66
67 current->state = TASK_INTERRUPTIBLE; 67 set_current_state(TASK_INTERRUPTIBLE);
68 schedule(); 68 schedule();
69 set_thread_flag(TIF_RESTORE_SIGMASK); 69 set_thread_flag(TIF_RESTORE_SIGMASK);
70 70
@@ -500,18 +500,10 @@ void do_signal(struct pt_regs *regs)
500 clear_thread_flag(TIF_RESTORE_SIGMASK); 500 clear_thread_flag(TIF_RESTORE_SIGMASK);
501 501
502 /* 502 /*
503 * If we would have taken a single-step trap
504 * for a normal instruction, act like we took
505 * one for the handler setup.
506 */
507 if (current->thread.per_info.single_step)
508 set_thread_flag(TIF_SINGLE_STEP);
509
510 /*
511 * Let tracing know that we've done the handler setup. 503 * Let tracing know that we've done the handler setup.
512 */ 504 */
513 tracehook_signal_handler(signr, &info, &ka, regs, 505 tracehook_signal_handler(signr, &info, &ka, regs,
514 test_thread_flag(TIF_SINGLE_STEP)); 506 current->thread.per_info.single_step);
515 } 507 }
516 return; 508 return;
517 } 509 }
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 93e52039321b..e4d98de83dd8 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -36,6 +36,8 @@
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/timex.h> 37#include <linux/timex.h>
38#include <linux/bootmem.h> 38#include <linux/bootmem.h>
39#include <linux/slab.h>
40#include <asm/asm-offsets.h>
39#include <asm/ipl.h> 41#include <asm/ipl.h>
40#include <asm/setup.h> 42#include <asm/setup.h>
41#include <asm/sigp.h> 43#include <asm/sigp.h>
@@ -52,6 +54,9 @@
52#include <asm/cpu.h> 54#include <asm/cpu.h>
53#include "entry.h" 55#include "entry.h"
54 56
57/* logical cpu to cpu address */
58unsigned short __cpu_logical_map[NR_CPUS];
59
55static struct task_struct *current_set[NR_CPUS]; 60static struct task_struct *current_set[NR_CPUS];
56 61
57static u8 smp_cpu_type; 62static u8 smp_cpu_type;
@@ -69,13 +74,13 @@ static int cpu_management;
69 74
70static DEFINE_PER_CPU(struct cpu, cpu_devices); 75static DEFINE_PER_CPU(struct cpu, cpu_devices);
71 76
72static void smp_ext_bitcall(int, ec_bit_sig); 77static void smp_ext_bitcall(int, int);
73 78
74static int cpu_stopped(int cpu) 79static int raw_cpu_stopped(int cpu)
75{ 80{
76 __u32 status; 81 u32 status;
77 82
78 switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) { 83 switch (raw_sigp_ps(&status, 0, cpu, sigp_sense)) {
79 case sigp_status_stored: 84 case sigp_status_stored:
80 /* Check for stopped and check stop state */ 85 /* Check for stopped and check stop state */
81 if (status & 0x50) 86 if (status & 0x50)
@@ -87,6 +92,44 @@ static int cpu_stopped(int cpu)
87 return 0; 92 return 0;
88} 93}
89 94
95static inline int cpu_stopped(int cpu)
96{
97 return raw_cpu_stopped(cpu_logical_map(cpu));
98}
99
100void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
101{
102 struct _lowcore *lc, *current_lc;
103 struct stack_frame *sf;
104 struct pt_regs *regs;
105 unsigned long sp;
106
107 if (smp_processor_id() == 0)
108 func(data);
109 __load_psw_mask(PSW_BASE_BITS | PSW_DEFAULT_KEY);
110 /* Disable lowcore protection */
111 __ctl_clear_bit(0, 28);
112 current_lc = lowcore_ptr[smp_processor_id()];
113 lc = lowcore_ptr[0];
114 if (!lc)
115 lc = current_lc;
116 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
117 lc->restart_psw.addr = PSW_ADDR_AMODE | (unsigned long) smp_restart_cpu;
118 if (!cpu_online(0))
119 smp_switch_to_cpu(func, data, 0, stap(), __cpu_logical_map[0]);
120 while (sigp(0, sigp_stop_and_store_status) == sigp_busy)
121 cpu_relax();
122 sp = lc->panic_stack;
123 sp -= sizeof(struct pt_regs);
124 regs = (struct pt_regs *) sp;
125 memcpy(&regs->gprs, &current_lc->gpregs_save_area, sizeof(regs->gprs));
126 regs->psw = lc->psw_save_area;
127 sp -= STACK_FRAME_OVERHEAD;
128 sf = (struct stack_frame *) sp;
129 sf->back_chain = regs->gprs[15];
130 smp_switch_to_cpu(func, data, sp, stap(), __cpu_logical_map[0]);
131}
132
90void smp_send_stop(void) 133void smp_send_stop(void)
91{ 134{
92 int cpu, rc; 135 int cpu, rc;
@@ -100,7 +143,7 @@ void smp_send_stop(void)
100 if (cpu == smp_processor_id()) 143 if (cpu == smp_processor_id())
101 continue; 144 continue;
102 do { 145 do {
103 rc = signal_processor(cpu, sigp_stop); 146 rc = sigp(cpu, sigp_stop);
104 } while (rc == sigp_busy); 147 } while (rc == sigp_busy);
105 148
106 while (!cpu_stopped(cpu)) 149 while (!cpu_stopped(cpu))
@@ -136,13 +179,13 @@ static void do_ext_call_interrupt(__u16 code)
136 * Send an external call sigp to another cpu and return without waiting 179 * Send an external call sigp to another cpu and return without waiting
137 * for its completion. 180 * for its completion.
138 */ 181 */
139static void smp_ext_bitcall(int cpu, ec_bit_sig sig) 182static void smp_ext_bitcall(int cpu, int sig)
140{ 183{
141 /* 184 /*
142 * Set signaling bit in lowcore of target cpu and kick it 185 * Set signaling bit in lowcore of target cpu and kick it
143 */ 186 */
144 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 187 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
145 while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy) 188 while (sigp(cpu, sigp_emergency_signal) == sigp_busy)
146 udelay(10); 189 udelay(10);
147} 190}
148 191
@@ -236,24 +279,8 @@ void smp_ctl_clear_bit(int cr, int bit)
236} 279}
237EXPORT_SYMBOL(smp_ctl_clear_bit); 280EXPORT_SYMBOL(smp_ctl_clear_bit);
238 281
239/*
240 * In early ipl state a temp. logically cpu number is needed, so the sigp
241 * functions can be used to sense other cpus. Since NR_CPUS is >= 2 on
242 * CONFIG_SMP and the ipl cpu is logical cpu 0, it must be 1.
243 */
244#define CPU_INIT_NO 1
245
246#ifdef CONFIG_ZFCPDUMP 282#ifdef CONFIG_ZFCPDUMP
247 283
248/*
249 * zfcpdump_prefix_array holds prefix registers for the following scenario:
250 * 64 bit zfcpdump kernel and 31 bit kernel which is to be dumped. We have to
251 * save its prefix registers, since they get lost, when switching from 31 bit
252 * to 64 bit.
253 */
254unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \
255 __attribute__((__section__(".data")));
256
257static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) 284static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
258{ 285{
259 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 286 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
@@ -263,21 +290,15 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
263 "the dump\n", cpu, NR_CPUS - 1); 290 "the dump\n", cpu, NR_CPUS - 1);
264 return; 291 return;
265 } 292 }
266 zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL); 293 zfcpdump_save_areas[cpu] = kmalloc(sizeof(struct save_area), GFP_KERNEL);
267 __cpu_logical_map[CPU_INIT_NO] = (__u16) phy_cpu; 294 while (raw_sigp(phy_cpu, sigp_stop_and_store_status) == sigp_busy)
268 while (signal_processor(CPU_INIT_NO, sigp_stop_and_store_status) ==
269 sigp_busy)
270 cpu_relax(); 295 cpu_relax();
271 memcpy(zfcpdump_save_areas[cpu], 296 memcpy_real(zfcpdump_save_areas[cpu],
272 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE, 297 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE,
273 SAVE_AREA_SIZE); 298 sizeof(struct save_area));
274#ifdef CONFIG_64BIT
275 /* copy original prefix register */
276 zfcpdump_save_areas[cpu]->s390x.pref_reg = zfcpdump_prefix_array[cpu];
277#endif
278} 299}
279 300
280union save_area *zfcpdump_save_areas[NR_CPUS + 1]; 301struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
281EXPORT_SYMBOL_GPL(zfcpdump_save_areas); 302EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
282 303
283#else 304#else
@@ -386,8 +407,7 @@ static void __init smp_detect_cpus(void)
386 for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) { 407 for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) {
387 if (cpu == boot_cpu_addr) 408 if (cpu == boot_cpu_addr)
388 continue; 409 continue;
389 __cpu_logical_map[CPU_INIT_NO] = cpu; 410 if (!raw_cpu_stopped(cpu))
390 if (!cpu_stopped(CPU_INIT_NO))
391 continue; 411 continue;
392 smp_get_save_area(c_cpus, cpu); 412 smp_get_save_area(c_cpus, cpu);
393 c_cpus++; 413 c_cpus++;
@@ -410,8 +430,7 @@ static void __init smp_detect_cpus(void)
410 cpu_addr = info->cpu[cpu].address; 430 cpu_addr = info->cpu[cpu].address;
411 if (cpu_addr == boot_cpu_addr) 431 if (cpu_addr == boot_cpu_addr)
412 continue; 432 continue;
413 __cpu_logical_map[CPU_INIT_NO] = cpu_addr; 433 if (!raw_cpu_stopped(cpu_addr)) {
414 if (!cpu_stopped(CPU_INIT_NO)) {
415 s_cpus++; 434 s_cpus++;
416 continue; 435 continue;
417 } 436 }
@@ -530,18 +549,18 @@ static void smp_free_lowcore(int cpu)
530/* Upping and downing of CPUs */ 549/* Upping and downing of CPUs */
531int __cpuinit __cpu_up(unsigned int cpu) 550int __cpuinit __cpu_up(unsigned int cpu)
532{ 551{
533 struct task_struct *idle;
534 struct _lowcore *cpu_lowcore; 552 struct _lowcore *cpu_lowcore;
553 struct task_struct *idle;
535 struct stack_frame *sf; 554 struct stack_frame *sf;
536 sigp_ccode ccode;
537 u32 lowcore; 555 u32 lowcore;
556 int ccode;
538 557
539 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED) 558 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED)
540 return -EIO; 559 return -EIO;
541 if (smp_alloc_lowcore(cpu)) 560 if (smp_alloc_lowcore(cpu))
542 return -ENOMEM; 561 return -ENOMEM;
543 do { 562 do {
544 ccode = signal_processor(cpu, sigp_initial_cpu_reset); 563 ccode = sigp(cpu, sigp_initial_cpu_reset);
545 if (ccode == sigp_busy) 564 if (ccode == sigp_busy)
546 udelay(10); 565 udelay(10);
547 if (ccode == sigp_not_operational) 566 if (ccode == sigp_not_operational)
@@ -549,7 +568,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
549 } while (ccode == sigp_busy); 568 } while (ccode == sigp_busy);
550 569
551 lowcore = (u32)(unsigned long)lowcore_ptr[cpu]; 570 lowcore = (u32)(unsigned long)lowcore_ptr[cpu];
552 while (signal_processor_p(lowcore, cpu, sigp_set_prefix) == sigp_busy) 571 while (sigp_p(lowcore, cpu, sigp_set_prefix) == sigp_busy)
553 udelay(10); 572 udelay(10);
554 573
555 idle = current_set[cpu]; 574 idle = current_set[cpu];
@@ -575,7 +594,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
575 cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func; 594 cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func;
576 eieio(); 595 eieio();
577 596
578 while (signal_processor(cpu, sigp_restart) == sigp_busy) 597 while (sigp(cpu, sigp_restart) == sigp_busy)
579 udelay(10); 598 udelay(10);
580 599
581 while (!cpu_online(cpu)) 600 while (!cpu_online(cpu))
@@ -637,7 +656,7 @@ void __cpu_die(unsigned int cpu)
637 /* Wait until target cpu is down */ 656 /* Wait until target cpu is down */
638 while (!cpu_stopped(cpu)) 657 while (!cpu_stopped(cpu))
639 cpu_relax(); 658 cpu_relax();
640 while (signal_processor_p(0, cpu, sigp_set_prefix) == sigp_busy) 659 while (sigp_p(0, cpu, sigp_set_prefix) == sigp_busy)
641 udelay(10); 660 udelay(10);
642 smp_free_lowcore(cpu); 661 smp_free_lowcore(cpu);
643 pr_info("Processor %d stopped\n", cpu); 662 pr_info("Processor %d stopped\n", cpu);
@@ -646,7 +665,7 @@ void __cpu_die(unsigned int cpu)
646void cpu_die(void) 665void cpu_die(void)
647{ 666{
648 idle_task_exit(); 667 idle_task_exit();
649 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy) 668 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
650 cpu_relax(); 669 cpu_relax();
651 for (;;); 670 for (;;);
652} 671}
@@ -717,6 +736,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
717{ 736{
718} 737}
719 738
739void __init smp_setup_processor_id(void)
740{
741 S390_lowcore.cpu_nr = 0;
742 __cpu_logical_map[0] = stap();
743}
744
720/* 745/*
721 * the frequency of the profiling timer can be changed 746 * the frequency of the profiling timer can be changed
722 * by writing a multiplier value into /proc/profile. 747 * by writing a multiplier value into /proc/profile.
@@ -756,7 +781,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev,
756 get_online_cpus(); 781 get_online_cpus();
757 mutex_lock(&smp_cpu_state_mutex); 782 mutex_lock(&smp_cpu_state_mutex);
758 rc = -EBUSY; 783 rc = -EBUSY;
759 if (cpu_online(cpu)) 784 /* disallow configuration changes of online cpus and cpu 0 */
785 if (cpu_online(cpu) || cpu == 0)
760 goto out; 786 goto out;
761 rc = 0; 787 rc = 0;
762 switch (val) { 788 switch (val) {
@@ -995,7 +1021,9 @@ out:
995 return rc; 1021 return rc;
996} 1022}
997 1023
998static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf, 1024static ssize_t __ref rescan_store(struct sysdev_class *class,
1025 struct sysdev_class_attribute *attr,
1026 const char *buf,
999 size_t count) 1027 size_t count)
1000{ 1028{
1001 int rc; 1029 int rc;
@@ -1006,7 +1034,9 @@ static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
1006static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); 1034static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
1007#endif /* CONFIG_HOTPLUG_CPU */ 1035#endif /* CONFIG_HOTPLUG_CPU */
1008 1036
1009static ssize_t dispatching_show(struct sysdev_class *class, char *buf) 1037static ssize_t dispatching_show(struct sysdev_class *class,
1038 struct sysdev_class_attribute *attr,
1039 char *buf)
1010{ 1040{
1011 ssize_t count; 1041 ssize_t count;
1012 1042
@@ -1016,7 +1046,9 @@ static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
1016 return count; 1046 return count;
1017} 1047}
1018 1048
1019static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf, 1049static ssize_t dispatching_store(struct sysdev_class *dev,
1050 struct sysdev_class_attribute *attr,
1051 const char *buf,
1020 size_t count) 1052 size_t count)
1021{ 1053{
1022 int val, rc; 1054 int val, rc;
diff --git a/arch/s390/kernel/switch_cpu.S b/arch/s390/kernel/switch_cpu.S
new file mode 100644
index 000000000000..469f11b574fa
--- /dev/null
+++ b/arch/s390/kernel/switch_cpu.S
@@ -0,0 +1,58 @@
1/*
2 * 31-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <asm/asm-offsets.h>
9#include <asm/ptrace.h>
10
11# smp_switch_to_cpu switches to destination cpu and executes the passed function
12# Parameter: %r2 - function to call
13# %r3 - function parameter
14# %r4 - stack poiner
15# %r5 - current cpu
16# %r6 - destination cpu
17
18 .section .text
19 .align 4
20 .globl smp_switch_to_cpu
21smp_switch_to_cpu:
22 stm %r6,%r15,__SF_GPRS(%r15)
23 lr %r1,%r15
24 ahi %r15,-STACK_FRAME_OVERHEAD
25 st %r1,__SF_BACKCHAIN(%r15)
26 basr %r13,0
270: la %r1,.gprregs_addr-0b(%r13)
28 l %r1,0(%r1)
29 stm %r0,%r15,0(%r1)
301: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
31 brc 2,1b /* busy, try again */
322: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
33 brc 2,2b /* busy, try again */
343: j 3b
35
36 .globl smp_restart_cpu
37smp_restart_cpu:
38 basr %r13,0
390: la %r1,.gprregs_addr-0b(%r13)
40 l %r1,0(%r1)
41 lm %r0,%r15,0(%r1)
421: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
43 brc 10,1b /* busy, accepted (status 0), running */
44 tmll %r0,0x40 /* Test if calling CPU is stopped */
45 jz 1b
46 ltr %r4,%r4 /* New stack ? */
47 jz 1f
48 lr %r15,%r4
491: basr %r14,%r2
50
51.gprregs_addr:
52 .long .gprregs
53
54 .section .data,"aw",@progbits
55.gprregs:
56 .rept 16
57 .long 0
58 .endr
diff --git a/arch/s390/kernel/switch_cpu64.S b/arch/s390/kernel/switch_cpu64.S
new file mode 100644
index 000000000000..d94aacc898cb
--- /dev/null
+++ b/arch/s390/kernel/switch_cpu64.S
@@ -0,0 +1,51 @@
1/*
2 * 64-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <asm/asm-offsets.h>
9#include <asm/ptrace.h>
10
11# smp_switch_to_cpu switches to destination cpu and executes the passed function
12# Parameter: %r2 - function to call
13# %r3 - function parameter
14# %r4 - stack poiner
15# %r5 - current cpu
16# %r6 - destination cpu
17
18 .section .text
19 .align 4
20 .globl smp_switch_to_cpu
21smp_switch_to_cpu:
22 stmg %r6,%r15,__SF_GPRS(%r15)
23 lgr %r1,%r15
24 aghi %r15,-STACK_FRAME_OVERHEAD
25 stg %r1,__SF_BACKCHAIN(%r15)
26 larl %r1,.gprregs
27 stmg %r0,%r15,0(%r1)
281: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
29 brc 2,1b /* busy, try again */
302: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
31 brc 2,2b /* busy, try again */
323: j 3b
33
34 .globl smp_restart_cpu
35smp_restart_cpu:
36 larl %r1,.gprregs
37 lmg %r0,%r15,0(%r1)
381: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
39 brc 10,1b /* busy, accepted (status 0), running */
40 tmll %r0,0x40 /* Test if calling CPU is stopped */
41 jz 1b
42 ltgr %r4,%r4 /* New stack ? */
43 jz 1f
44 lgr %r15,%r4
451: basr %r14,%r2
46
47 .section .data,"aw",@progbits
48.gprregs:
49 .rept 16
50 .quad 0
51 .endr
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 0c26cc1898ec..c56d3f56d020 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -176,7 +176,7 @@ pgm_check_entry:
176 cgr %r1,%r2 176 cgr %r1,%r2
177 je restore_registers /* r1 = r2 -> nothing to do */ 177 je restore_registers /* r1 = r2 -> nothing to do */
178 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */ 178 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
179 mvc __LC_RESTART_PSW(16,%r0),0(%r4) 179 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
1803: 1803:
181 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET 181 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET
182 brc 8,4f /* accepted */ 182 brc 8,4f /* accepted */
@@ -256,6 +256,9 @@ restore_registers:
256 lghi %r2,0 256 lghi %r2,0
257 brasl %r14,arch_set_page_states 257 brasl %r14,arch_set_page_states
258 258
259 /* Reinitialize the channel subsystem */
260 brasl %r14,channel_subsystem_reinit
261
259 /* Return 0 */ 262 /* Return 0 */
260 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15) 263 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15)
261 lghi %r2,0 264 lghi %r2,0
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index e9d94f61d500..7b6b0f81a283 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -32,40 +32,13 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include "entry.h" 33#include "entry.h"
34 34
35/* common code for old and new mmaps */
36static inline long do_mmap2(
37 unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, unsigned long pgoff)
40{
41 long error = -EBADF;
42 struct file * file = NULL;
43
44 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
45 if (!(flags & MAP_ANONYMOUS)) {
46 file = fget(fd);
47 if (!file)
48 goto out;
49 }
50
51 down_write(&current->mm->mmap_sem);
52 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
53 up_write(&current->mm->mmap_sem);
54
55 if (file)
56 fput(file);
57out:
58 return error;
59}
60
61/* 35/*
62 * Perform the select(nd, in, out, ex, tv) and mmap() system 36 * Perform the mmap() system call. Linux for S/390 isn't able to handle more
63 * calls. Linux for S/390 isn't able to handle more than 5 37 * than 5 system call parameters, so this system call uses a memory block
64 * system call parameters, so these system calls used a memory 38 * for parameter passing.
65 * block for parameter passing..
66 */ 39 */
67 40
68struct mmap_arg_struct { 41struct s390_mmap_arg_struct {
69 unsigned long addr; 42 unsigned long addr;
70 unsigned long len; 43 unsigned long len;
71 unsigned long prot; 44 unsigned long prot;
@@ -74,31 +47,14 @@ struct mmap_arg_struct {
74 unsigned long offset; 47 unsigned long offset;
75}; 48};
76 49
77SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg) 50SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
78{ 51{
79 struct mmap_arg_struct a; 52 struct s390_mmap_arg_struct a;
80 int error = -EFAULT; 53 int error = -EFAULT;
81 54
82 if (copy_from_user(&a, arg, sizeof(a))) 55 if (copy_from_user(&a, arg, sizeof(a)))
83 goto out; 56 goto out;
84 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 57 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
85out:
86 return error;
87}
88
89SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
90{
91 struct mmap_arg_struct a;
92 long error = -EFAULT;
93
94 if (copy_from_user(&a, arg, sizeof(a)))
95 goto out;
96
97 error = -EINVAL;
98 if (a.offset & ~PAGE_MASK)
99 goto out;
100
101 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
102out: 58out:
103 return error; 59 return error;
104} 60}
@@ -108,7 +64,7 @@ out:
108 * 64 *
109 * This is really horribly ugly. 65 * This is really horribly ugly.
110 */ 66 */
111SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second, 67SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
112 unsigned long, third, void __user *, ptr) 68 unsigned long, third, void __user *, ptr)
113{ 69{
114 struct ipc_kludge tmp; 70 struct ipc_kludge tmp;
@@ -175,17 +131,6 @@ SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
175} 131}
176 132
177#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
178SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
179{
180 int ret = sys_newuname(name);
181
182 if (personality(current->personality) == PER_LINUX32 && !ret) {
183 ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
184 if (ret) ret = -EFAULT;
185 }
186 return ret;
187}
188
189SYSCALL_DEFINE1(s390_personality, unsigned long, personality) 134SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
190{ 135{
191 int ret; 136 int ret;
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 30eca070d426..201ce6bed34e 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) 98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) 99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ 100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
101SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */ 101SYSCALL(sys_old_mmap,sys_old_mmap,old32_mmap_wrapper) /* 90 */
102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) 102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) 103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) 104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
@@ -125,12 +125,12 @@ NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index b5e75e1061c8..a0ffc7717ed6 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/slab.h>
14#include <asm/ebcdic.h> 15#include <asm/ebcdic.h>
15#include <asm/sysinfo.h> 16#include <asm/sysinfo.h>
16#include <asm/cpcmd.h> 17#include <asm/cpcmd.h>
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 34162a0b2caa..d906bf19c14a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -36,6 +36,7 @@
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/clocksource.h> 37#include <linux/clocksource.h>
38#include <linux/clockchips.h> 38#include <linux/clockchips.h>
39#include <linux/gfp.h>
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/delay.h> 41#include <asm/delay.h>
41#include <asm/s390_ext.h> 42#include <asm/s390_ext.h>
@@ -51,14 +52,6 @@
51#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) 52#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ)
52#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) 53#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
53 54
54/*
55 * Create a small time difference between the timer interrupts
56 * on the different cpus to avoid lock contention.
57 */
58#define CPU_DEVIATION (smp_processor_id() << 12)
59
60#define TICK_SIZE tick
61
62u64 sched_clock_base_cc = -1; /* Force to data section. */ 55u64 sched_clock_base_cc = -1; /* Force to data section. */
63EXPORT_SYMBOL_GPL(sched_clock_base_cc); 56EXPORT_SYMBOL_GPL(sched_clock_base_cc);
64 57
@@ -81,15 +74,15 @@ unsigned long long monotonic_clock(void)
81} 74}
82EXPORT_SYMBOL(monotonic_clock); 75EXPORT_SYMBOL(monotonic_clock);
83 76
84void tod_to_timeval(__u64 todval, struct timespec *xtime) 77void tod_to_timeval(__u64 todval, struct timespec *xt)
85{ 78{
86 unsigned long long sec; 79 unsigned long long sec;
87 80
88 sec = todval >> 12; 81 sec = todval >> 12;
89 do_div(sec, 1000000); 82 do_div(sec, 1000000);
90 xtime->tv_sec = sec; 83 xt->tv_sec = sec;
91 todval -= (sec * 1000000) << 12; 84 todval -= (sec * 1000000) << 12;
92 xtime->tv_nsec = ((todval * 1000) >> 12); 85 xt->tv_nsec = ((todval * 1000) >> 12);
93} 86}
94EXPORT_SYMBOL(tod_to_timeval); 87EXPORT_SYMBOL(tod_to_timeval);
95 88
@@ -214,7 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
214 return &clocksource_tod; 207 return &clocksource_tod;
215} 208}
216 209
217void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) 210void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
211 u32 mult)
218{ 212{
219 if (clock != &clocksource_tod) 213 if (clock != &clocksource_tod)
220 return; 214 return;
@@ -223,10 +217,11 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
223 ++vdso_data->tb_update_count; 217 ++vdso_data->tb_update_count;
224 smp_wmb(); 218 smp_wmb();
225 vdso_data->xtime_tod_stamp = clock->cycle_last; 219 vdso_data->xtime_tod_stamp = clock->cycle_last;
226 vdso_data->xtime_clock_sec = xtime.tv_sec; 220 vdso_data->xtime_clock_sec = wall_time->tv_sec;
227 vdso_data->xtime_clock_nsec = xtime.tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
228 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
229 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
224 vdso_data->ntp_mult = mult;
230 smp_wmb(); 225 smp_wmb();
231 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
232} 227}
@@ -334,7 +329,7 @@ int get_sync_clock(unsigned long long *clock)
334 sw0 = atomic_read(sw_ptr); 329 sw0 = atomic_read(sw_ptr);
335 *clock = get_clock(); 330 *clock = get_clock();
336 sw1 = atomic_read(sw_ptr); 331 sw1 = atomic_read(sw_ptr);
337 put_cpu_var(clock_sync_sync); 332 put_cpu_var(clock_sync_word);
338 if (sw0 == sw1 && (sw0 & 0x80000000U)) 333 if (sw0 == sw1 && (sw0 & 0x80000000U))
339 /* Success: time is in sync. */ 334 /* Success: time is in sync. */
340 return 0; 335 return 0;
@@ -384,7 +379,7 @@ static inline int check_sync_clock(void)
384 379
385 sw_ptr = &get_cpu_var(clock_sync_word); 380 sw_ptr = &get_cpu_var(clock_sync_word);
386 rc = (atomic_read(sw_ptr) & 0x80000000U) != 0; 381 rc = (atomic_read(sw_ptr) & 0x80000000U) != 0;
387 put_cpu_var(clock_sync_sync); 382 put_cpu_var(clock_sync_word);
388 return rc; 383 return rc;
389} 384}
390 385
@@ -1123,14 +1118,18 @@ static struct sys_device etr_port1_dev = {
1123/* 1118/*
1124 * ETR class attributes 1119 * ETR class attributes
1125 */ 1120 */
1126static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf) 1121static ssize_t etr_stepping_port_show(struct sysdev_class *class,
1122 struct sysdev_class_attribute *attr,
1123 char *buf)
1127{ 1124{
1128 return sprintf(buf, "%i\n", etr_port0.esw.p); 1125 return sprintf(buf, "%i\n", etr_port0.esw.p);
1129} 1126}
1130 1127
1131static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); 1128static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1132 1129
1133static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf) 1130static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
1131 struct sysdev_class_attribute *attr,
1132 char *buf)
1134{ 1133{
1135 char *mode_str; 1134 char *mode_str;
1136 1135
@@ -1591,7 +1590,9 @@ static struct sysdev_class stp_sysclass = {
1591 .name = "stp", 1590 .name = "stp",
1592}; 1591};
1593 1592
1594static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf) 1593static ssize_t stp_ctn_id_show(struct sysdev_class *class,
1594 struct sysdev_class_attribute *attr,
1595 char *buf)
1595{ 1596{
1596 if (!stp_online) 1597 if (!stp_online)
1597 return -ENODATA; 1598 return -ENODATA;
@@ -1601,7 +1602,9 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
1601 1602
1602static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); 1603static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1603 1604
1604static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf) 1605static ssize_t stp_ctn_type_show(struct sysdev_class *class,
1606 struct sysdev_class_attribute *attr,
1607 char *buf)
1605{ 1608{
1606 if (!stp_online) 1609 if (!stp_online)
1607 return -ENODATA; 1610 return -ENODATA;
@@ -1610,7 +1613,9 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
1610 1613
1611static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); 1614static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1612 1615
1613static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf) 1616static ssize_t stp_dst_offset_show(struct sysdev_class *class,
1617 struct sysdev_class_attribute *attr,
1618 char *buf)
1614{ 1619{
1615 if (!stp_online || !(stp_info.vbits & 0x2000)) 1620 if (!stp_online || !(stp_info.vbits & 0x2000))
1616 return -ENODATA; 1621 return -ENODATA;
@@ -1619,7 +1624,9 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
1619 1624
1620static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); 1625static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1621 1626
1622static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf) 1627static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
1628 struct sysdev_class_attribute *attr,
1629 char *buf)
1623{ 1630{
1624 if (!stp_online || !(stp_info.vbits & 0x8000)) 1631 if (!stp_online || !(stp_info.vbits & 0x8000))
1625 return -ENODATA; 1632 return -ENODATA;
@@ -1628,7 +1635,9 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
1628 1635
1629static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); 1636static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1630 1637
1631static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf) 1638static ssize_t stp_stratum_show(struct sysdev_class *class,
1639 struct sysdev_class_attribute *attr,
1640 char *buf)
1632{ 1641{
1633 if (!stp_online) 1642 if (!stp_online)
1634 return -ENODATA; 1643 return -ENODATA;
@@ -1637,7 +1646,9 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
1637 1646
1638static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); 1647static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
1639 1648
1640static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf) 1649static ssize_t stp_time_offset_show(struct sysdev_class *class,
1650 struct sysdev_class_attribute *attr,
1651 char *buf)
1641{ 1652{
1642 if (!stp_online || !(stp_info.vbits & 0x0800)) 1653 if (!stp_online || !(stp_info.vbits & 0x0800))
1643 return -ENODATA; 1654 return -ENODATA;
@@ -1646,7 +1657,9 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
1646 1657
1647static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); 1658static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1648 1659
1649static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf) 1660static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
1661 struct sysdev_class_attribute *attr,
1662 char *buf)
1650{ 1663{
1651 if (!stp_online || !(stp_info.vbits & 0x4000)) 1664 if (!stp_online || !(stp_info.vbits & 0x4000))
1652 return -ENODATA; 1665 return -ENODATA;
@@ -1656,7 +1669,9 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
1656static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, 1669static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
1657 stp_time_zone_offset_show, NULL); 1670 stp_time_zone_offset_show, NULL);
1658 1671
1659static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf) 1672static ssize_t stp_timing_mode_show(struct sysdev_class *class,
1673 struct sysdev_class_attribute *attr,
1674 char *buf)
1660{ 1675{
1661 if (!stp_online) 1676 if (!stp_online)
1662 return -ENODATA; 1677 return -ENODATA;
@@ -1665,7 +1680,9 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
1665 1680
1666static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); 1681static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1667 1682
1668static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf) 1683static ssize_t stp_timing_state_show(struct sysdev_class *class,
1684 struct sysdev_class_attribute *attr,
1685 char *buf)
1669{ 1686{
1670 if (!stp_online) 1687 if (!stp_online)
1671 return -ENODATA; 1688 return -ENODATA;
@@ -1674,12 +1691,15 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
1674 1691
1675static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); 1692static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1676 1693
1677static ssize_t stp_online_show(struct sysdev_class *class, char *buf) 1694static ssize_t stp_online_show(struct sysdev_class *class,
1695 struct sysdev_class_attribute *attr,
1696 char *buf)
1678{ 1697{
1679 return sprintf(buf, "%i\n", stp_online); 1698 return sprintf(buf, "%i\n", stp_online);
1680} 1699}
1681 1700
1682static ssize_t stp_online_store(struct sysdev_class *class, 1701static ssize_t stp_online_store(struct sysdev_class *class,
1702 struct sysdev_class_attribute *attr,
1683 const char *buf, size_t count) 1703 const char *buf, size_t count)
1684{ 1704{
1685 unsigned int value; 1705 unsigned int value;
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 3c72c9cf22b6..247b4c2d1e51 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -114,7 +114,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core)
114 114
115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; 115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin;
116 for_each_present_cpu(lcpu) { 116 for_each_present_cpu(lcpu) {
117 if (__cpu_logical_map[lcpu] == rcpu) { 117 if (cpu_logical_map(lcpu) == rcpu) {
118 cpu_set(lcpu, core->mask); 118 cpu_set(lcpu, core->mask);
119 smp_cpu_polarization[lcpu] = tl_cpu->pp; 119 smp_cpu_polarization[lcpu] = tl_cpu->pp;
120 } 120 }
@@ -165,10 +165,11 @@ static void tl_to_cores(struct tl_info *info)
165 default: 165 default:
166 clear_cores(); 166 clear_cores();
167 machine_has_topology = 0; 167 machine_has_topology = 0;
168 return; 168 goto out;
169 } 169 }
170 tle = next_tle(tle); 170 tle = next_tle(tle);
171 } 171 }
172out:
172 spin_unlock_irq(&topology_lock); 173 spin_unlock_irq(&topology_lock);
173} 174}
174 175
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index c2e42cc65ce7..6e7ad63854c0 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -18,7 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/ptrace.h> 21#include <linux/tracehook.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/smp.h> 24#include <linux/smp.h>
@@ -382,7 +382,7 @@ void __kprobes do_single_step(struct pt_regs *regs)
382 SIGTRAP) == NOTIFY_STOP){ 382 SIGTRAP) == NOTIFY_STOP){
383 return; 383 return;
384 } 384 }
385 if ((current->ptrace & PT_PTRACED) != 0) 385 if (tracehook_consider_fatal_signal(current, SIGTRAP))
386 force_sig(SIGTRAP, current); 386 force_sig(SIGTRAP, current);
387} 387}
388 388
@@ -483,7 +483,7 @@ static void illegal_op(struct pt_regs * regs, long interruption_code)
483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) 483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
484 return; 484 return;
485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { 485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
486 if (current->ptrace & PT_PTRACED) 486 if (tracehook_consider_fatal_signal(current, SIGTRAP))
487 force_sig(SIGTRAP, current); 487 force_sig(SIGTRAP, current);
488 else 488 else
489 signal = SIGILL; 489 signal = SIGILL;
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index adfb32aa6d59..6bc9c197aa91 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -23,6 +23,7 @@
23#include <linux/security.h> 23#include <linux/security.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/compat.h> 25#include <linux/compat.h>
26#include <asm/asm-offsets.h>
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
@@ -86,7 +87,8 @@ static void vdso_init_data(struct vdso_data *vd)
86 unsigned int facility_list; 87 unsigned int facility_list;
87 88
88 facility_list = stfl(); 89 facility_list = stfl();
89 vd->ectg_available = switch_amode && (facility_list & 1); 90 vd->ectg_available =
91 user_mode != HOME_SPACE_MODE && (facility_list & 1);
90} 92}
91 93
92#ifdef CONFIG_64BIT 94#ifdef CONFIG_64BIT
@@ -114,7 +116,7 @@ int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore)
114 116
115 lowcore->vdso_per_cpu_data = __LC_PASTE; 117 lowcore->vdso_per_cpu_data = __LC_PASTE;
116 118
117 if (!switch_amode || !vdso_enabled) 119 if (user_mode == HOME_SPACE_MODE || !vdso_enabled)
118 return 0; 120 return 0;
119 121
120 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER); 122 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER);
@@ -160,7 +162,7 @@ void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore)
160 unsigned long segment_table, page_table, page_frame; 162 unsigned long segment_table, page_table, page_frame;
161 u32 *psal, *aste; 163 u32 *psal, *aste;
162 164
163 if (!switch_amode || !vdso_enabled) 165 if (user_mode == HOME_SPACE_MODE || !vdso_enabled)
164 return; 166 return;
165 167
166 psal = (u32 *)(addr_t) lowcore->paste[4]; 168 psal = (u32 *)(addr_t) lowcore->paste[4];
@@ -184,7 +186,7 @@ static void __vdso_init_cr5(void *dummy)
184 186
185static void vdso_init_cr5(void) 187static void vdso_init_cr5(void)
186{ 188{
187 if (switch_amode && vdso_enabled) 189 if (user_mode != HOME_SPACE_MODE && vdso_enabled)
188 on_each_cpu(__vdso_init_cr5, NULL, 1); 190 on_each_cpu(__vdso_init_cr5, NULL, 1);
189} 191}
190#endif /* CONFIG_64BIT */ 192#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 4a98909a8310..969643954273 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -38,13 +38,13 @@ __kernel_clock_gettime:
38 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 38 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
39 brc 3,2f 39 brc 3,2f
40 ahi %r0,-1 40 ahi %r0,-1
412: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 412: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
42 lr %r2,%r0 42 lr %r2,%r0
43 lhi %r0,1000 43 l %r0,__VDSO_NTP_MULT(%r5)
44 ltr %r1,%r1 44 ltr %r1,%r1
45 mr %r0,%r0 45 mr %r0,%r0
46 jnm 3f 46 jnm 3f
47 ahi %r0,1000 47 a %r0,__VDSO_NTP_MULT(%r5)
483: alr %r0,%r2 483: alr %r0,%r2
49 srdl %r0,12 49 srdl %r0,12
50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
@@ -86,13 +86,13 @@ __kernel_clock_gettime:
86 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 86 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
87 brc 3,12f 87 brc 3,12f
88 ahi %r0,-1 88 ahi %r0,-1
8912: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 8912: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
90 lr %r2,%r0 90 lr %r2,%r0
91 lhi %r0,1000 91 l %r0,__VDSO_NTP_MULT(%r5)
92 ltr %r1,%r1 92 ltr %r1,%r1
93 mr %r0,%r0 93 mr %r0,%r0
94 jnm 13f 94 jnm 13f
95 ahi %r0,1000 95 a %r0,__VDSO_NTP_MULT(%r5)
9613: alr %r0,%r2 9613: alr %r0,%r2
97 srdl %r0,12 97 srdl %r0,12
98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
index ad8acfc949fb..2d3633175e3b 100644
--- a/arch/s390/kernel/vdso32/gettimeofday.S
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -35,13 +35,13 @@ __kernel_gettimeofday:
35 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 35 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
36 brc 3,3f 36 brc 3,3f
37 ahi %r0,-1 37 ahi %r0,-1
383: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 383: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
39 st %r0,24(%r15) 39 st %r0,24(%r15)
40 lhi %r0,1000 40 l %r0,__VDSO_NTP_MULT(%r5)
41 ltr %r1,%r1 41 ltr %r1,%r1
42 mr %r0,%r0 42 mr %r0,%r0
43 jnm 4f 43 jnm 4f
44 ahi %r0,1000 44 a %r0,__VDSO_NTP_MULT(%r5)
454: al %r0,24(%r15) 454: al %r0,24(%r15)
46 srdl %r0,12 46 srdl %r0,12
47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 49106c6e6f88..f40467884a03 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -36,7 +36,7 @@ __kernel_clock_gettime:
36 stck 48(%r15) /* Store TOD clock */ 36 stck 48(%r15) /* Store TOD clock */
37 lg %r1,48(%r15) 37 lg %r1,48(%r15)
38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
39 mghi %r1,1000 39 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
42 lg %r0,__VDSO_XTIME_SEC(%r5) 42 lg %r0,__VDSO_XTIME_SEC(%r5)
@@ -64,7 +64,7 @@ __kernel_clock_gettime:
64 stck 48(%r15) /* Store TOD clock */ 64 stck 48(%r15) /* Store TOD clock */
65 lg %r1,48(%r15) 65 lg %r1,48(%r15)
66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
67 mghi %r1,1000 67 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
70 lg %r0,__VDSO_XTIME_SEC(%r5) 70 lg %r0,__VDSO_XTIME_SEC(%r5)
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
index f873e75634e1..36ee674722ec 100644
--- a/arch/s390/kernel/vdso64/gettimeofday.S
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -31,7 +31,7 @@ __kernel_gettimeofday:
31 stck 48(%r15) /* Store TOD clock */ 31 stck 48(%r15) /* Store TOD clock */
32 lg %r1,48(%r15) 32 lg %r1,48(%r15)
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
34 mghi %r1,1000 34 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */ 36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */
37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */ 37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c41bb0d416e1..b59a812a010e 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -167,6 +167,8 @@ void vtime_stop_cpu(void)
167 /* Wait for external, I/O or machine check interrupt. */ 167 /* Wait for external, I/O or machine check interrupt. */
168 psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT; 168 psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT;
169 169
170 idle->nohz_delay = 0;
171
170 /* Check if the CPU timer needs to be reprogrammed. */ 172 /* Check if the CPU timer needs to be reprogrammed. */
171 if (vq->do_spt) { 173 if (vq->do_spt) {
172 __u64 vmax = VTIMER_MAX_SLICE; 174 __u64 vmax = VTIMER_MAX_SLICE;
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index bf164fc21864..a7251580891c 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -20,7 +20,6 @@ config KVM
20 depends on HAVE_KVM && EXPERIMENTAL 20 depends on HAVE_KVM && EXPERIMENTAL
21 select PREEMPT_NOTIFIERS 21 select PREEMPT_NOTIFIERS
22 select ANON_INODES 22 select ANON_INODES
23 select S390_SWITCH_AMODE
24 ---help--- 23 ---help---
25 Support hosting paravirtualized guest machines using the SIE 24 Support hosting paravirtualized guest machines using the SIE
26 virtualization capability on the mainframe. This should work 25 virtualization capability on the mainframe. This should work
@@ -36,6 +35,7 @@ config KVM
36 35
37# OK, it's a little counter-intuitive to do this, but it puts it neatly under 36# OK, it's a little counter-intuitive to do this, but it puts it neatly under
38# the virtualization menu. 37# the virtualization menu.
38source drivers/vhost/Kconfig
39source drivers/virtio/Kconfig 39source drivers/virtio/Kconfig
40 40
41endif # VIRTUALIZATION 41endif # VIRTUALIZATION
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 8300309698fa..9e4c84187cf5 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -39,7 +39,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
39 vcpu->run->s390_reset_flags = 0; 39 vcpu->run->s390_reset_flags = 0;
40 break; 40 break;
41 default: 41 default:
42 return -ENOTSUPP; 42 return -EOPNOTSUPP;
43 } 43 }
44 44
45 atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); 45 atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
@@ -62,6 +62,6 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
62 case 0x308: 62 case 0x308:
63 return __diag_ipl_functions(vcpu); 63 return __diag_ipl_functions(vcpu);
64 default: 64 default:
65 return -ENOTSUPP; 65 return -EOPNOTSUPP;
66 } 66 }
67} 67}
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index ba9d8a7bc1ac..3ddc30895e31 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -32,7 +32,7 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
32 32
33 vcpu->stat.instruction_lctlg++; 33 vcpu->stat.instruction_lctlg++;
34 if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f) 34 if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f)
35 return -ENOTSUPP; 35 return -EOPNOTSUPP;
36 36
37 useraddr = disp2; 37 useraddr = disp2;
38 if (base2) 38 if (base2)
@@ -138,7 +138,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
138 rc = __kvm_s390_vcpu_store_status(vcpu, 138 rc = __kvm_s390_vcpu_store_status(vcpu,
139 KVM_S390_STORE_STATUS_NOADDR); 139 KVM_S390_STORE_STATUS_NOADDR);
140 if (rc >= 0) 140 if (rc >= 0)
141 rc = -ENOTSUPP; 141 rc = -EOPNOTSUPP;
142 } 142 }
143 143
144 if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) { 144 if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) {
@@ -150,7 +150,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
150 if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { 150 if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
151 vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP; 151 vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP;
152 VCPU_EVENT(vcpu, 3, "%s", "cpu stopped"); 152 VCPU_EVENT(vcpu, 3, "%s", "cpu stopped");
153 rc = -ENOTSUPP; 153 rc = -EOPNOTSUPP;
154 } 154 }
155 155
156 spin_unlock_bh(&vcpu->arch.local_int.lock); 156 spin_unlock_bh(&vcpu->arch.local_int.lock);
@@ -171,9 +171,9 @@ static int handle_validity(struct kvm_vcpu *vcpu)
171 2*PAGE_SIZE); 171 2*PAGE_SIZE);
172 if (rc) 172 if (rc)
173 /* user will receive sigsegv, exit to user */ 173 /* user will receive sigsegv, exit to user */
174 rc = -ENOTSUPP; 174 rc = -EOPNOTSUPP;
175 } else 175 } else
176 rc = -ENOTSUPP; 176 rc = -EOPNOTSUPP;
177 177
178 if (rc) 178 if (rc)
179 VCPU_EVENT(vcpu, 2, "unhandled validity intercept code %d", 179 VCPU_EVENT(vcpu, 2, "unhandled validity intercept code %d",
@@ -189,7 +189,7 @@ static int handle_instruction(struct kvm_vcpu *vcpu)
189 handler = instruction_handlers[vcpu->arch.sie_block->ipa >> 8]; 189 handler = instruction_handlers[vcpu->arch.sie_block->ipa >> 8];
190 if (handler) 190 if (handler)
191 return handler(vcpu); 191 return handler(vcpu);
192 return -ENOTSUPP; 192 return -EOPNOTSUPP;
193} 193}
194 194
195static int handle_prog(struct kvm_vcpu *vcpu) 195static int handle_prog(struct kvm_vcpu *vcpu)
@@ -206,14 +206,14 @@ static int handle_instruction_and_prog(struct kvm_vcpu *vcpu)
206 rc = handle_instruction(vcpu); 206 rc = handle_instruction(vcpu);
207 rc2 = handle_prog(vcpu); 207 rc2 = handle_prog(vcpu);
208 208
209 if (rc == -ENOTSUPP) 209 if (rc == -EOPNOTSUPP)
210 vcpu->arch.sie_block->icptcode = 0x04; 210 vcpu->arch.sie_block->icptcode = 0x04;
211 if (rc) 211 if (rc)
212 return rc; 212 return rc;
213 return rc2; 213 return rc2;
214} 214}
215 215
216static const intercept_handler_t intercept_funcs[0x48 >> 2] = { 216static const intercept_handler_t intercept_funcs[] = {
217 [0x00 >> 2] = handle_noop, 217 [0x00 >> 2] = handle_noop,
218 [0x04 >> 2] = handle_instruction, 218 [0x04 >> 2] = handle_instruction,
219 [0x08 >> 2] = handle_prog, 219 [0x08 >> 2] = handle_prog,
@@ -230,10 +230,10 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
230 intercept_handler_t func; 230 intercept_handler_t func;
231 u8 code = vcpu->arch.sie_block->icptcode; 231 u8 code = vcpu->arch.sie_block->icptcode;
232 232
233 if (code & 3 || code > 0x48) 233 if (code & 3 || (code >> 2) >= ARRAY_SIZE(intercept_funcs))
234 return -ENOTSUPP; 234 return -EOPNOTSUPP;
235 func = intercept_funcs[code >> 2]; 235 func = intercept_funcs[code >> 2];
236 if (func) 236 if (func)
237 return func(vcpu); 237 return func(vcpu);
238 return -ENOTSUPP; 238 return -EOPNOTSUPP;
239} 239}
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 43486c2408e1..35c21bf910c5 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -10,12 +10,13 @@
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 10 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 */ 11 */
12 12
13#include <asm/lowcore.h>
14#include <asm/uaccess.h>
15#include <linux/hrtimer.h>
16#include <linux/interrupt.h> 13#include <linux/interrupt.h>
17#include <linux/kvm_host.h> 14#include <linux/kvm_host.h>
15#include <linux/hrtimer.h>
18#include <linux/signal.h> 16#include <linux/signal.h>
17#include <linux/slab.h>
18#include <asm/asm-offsets.h>
19#include <asm/uaccess.h>
19#include "kvm-s390.h" 20#include "kvm-s390.h"
20#include "gaccess.h" 21#include "gaccess.h"
21 22
@@ -187,8 +188,8 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
187 if (rc == -EFAULT) 188 if (rc == -EFAULT)
188 exception = 1; 189 exception = 1;
189 190
190 rc = put_guest_u64(vcpu, __LC_PFAULT_INTPARM, 191 rc = put_guest_u64(vcpu, __LC_EXT_PARAMS2,
191 inti->ext.ext_params2); 192 inti->ext.ext_params2);
192 if (rc == -EFAULT) 193 if (rc == -EFAULT)
193 exception = 1; 194 exception = 1;
194 break; 195 break;
@@ -342,7 +343,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
342 if (psw_interrupts_disabled(vcpu)) { 343 if (psw_interrupts_disabled(vcpu)) {
343 VCPU_EVENT(vcpu, 3, "%s", "disabled wait"); 344 VCPU_EVENT(vcpu, 3, "%s", "disabled wait");
344 __unset_cpu_idle(vcpu); 345 __unset_cpu_idle(vcpu);
345 return -ENOTSUPP; /* disabled wait */ 346 return -EOPNOTSUPP; /* disabled wait */
346 } 347 }
347 348
348 if (psw_extint_disabled(vcpu) || 349 if (psw_extint_disabled(vcpu) ||
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 07ced89740d7..49292869a5cd 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -23,6 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <asm/asm-offsets.h>
26#include <asm/lowcore.h> 27#include <asm/lowcore.h>
27#include <asm/pgtable.h> 28#include <asm/pgtable.h>
28#include <asm/nmi.h> 29#include <asm/nmi.h>
@@ -74,9 +75,10 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
74static unsigned long long *facilities; 75static unsigned long long *facilities;
75 76
76/* Section: not file related */ 77/* Section: not file related */
77void kvm_arch_hardware_enable(void *garbage) 78int kvm_arch_hardware_enable(void *garbage)
78{ 79{
79 /* every s390 is virtualization enabled ;-) */ 80 /* every s390 is virtualization enabled ;-) */
81 return 0;
80} 82}
81 83
82void kvm_arch_hardware_disable(void *garbage) 84void kvm_arch_hardware_disable(void *garbage)
@@ -116,10 +118,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
116 118
117int kvm_dev_ioctl_check_extension(long ext) 119int kvm_dev_ioctl_check_extension(long ext)
118{ 120{
121 int r;
122
119 switch (ext) { 123 switch (ext) {
124 case KVM_CAP_S390_PSW:
125 r = 1;
126 break;
120 default: 127 default:
121 return 0; 128 r = 0;
122 } 129 }
130 return r;
123} 131}
124 132
125/* Section: vm related */ 133/* Section: vm related */
@@ -150,7 +158,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
150 break; 158 break;
151 } 159 }
152 default: 160 default:
153 r = -EINVAL; 161 r = -ENOTTY;
154 } 162 }
155 163
156 return r; 164 return r;
@@ -234,6 +242,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
234 kvm_free_physmem(kvm); 242 kvm_free_physmem(kvm);
235 free_page((unsigned long)(kvm->arch.sca)); 243 free_page((unsigned long)(kvm->arch.sca));
236 debug_unregister(kvm->arch.dbf); 244 debug_unregister(kvm->arch.dbf);
245 cleanup_srcu_struct(&kvm->srcu);
237 kfree(kvm); 246 kfree(kvm);
238} 247}
239 248
@@ -419,8 +428,10 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
419 vcpu_load(vcpu); 428 vcpu_load(vcpu);
420 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) 429 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
421 rc = -EBUSY; 430 rc = -EBUSY;
422 else 431 else {
423 vcpu->arch.sie_block->gpsw = psw; 432 vcpu->run->psw_mask = psw.mask;
433 vcpu->run->psw_addr = psw.addr;
434 }
424 vcpu_put(vcpu); 435 vcpu_put(vcpu);
425 return rc; 436 return rc;
426} 437}
@@ -508,9 +519,6 @@ rerun_vcpu:
508 519
509 switch (kvm_run->exit_reason) { 520 switch (kvm_run->exit_reason) {
510 case KVM_EXIT_S390_SIEIC: 521 case KVM_EXIT_S390_SIEIC:
511 vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
512 vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
513 break;
514 case KVM_EXIT_UNKNOWN: 522 case KVM_EXIT_UNKNOWN:
515 case KVM_EXIT_INTR: 523 case KVM_EXIT_INTR:
516 case KVM_EXIT_S390_RESET: 524 case KVM_EXIT_S390_RESET:
@@ -519,6 +527,9 @@ rerun_vcpu:
519 BUG(); 527 BUG();
520 } 528 }
521 529
530 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
531 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
532
522 might_fault(); 533 might_fault();
523 534
524 do { 535 do {
@@ -534,12 +545,10 @@ rerun_vcpu:
534 rc = -EINTR; 545 rc = -EINTR;
535 } 546 }
536 547
537 if (rc == -ENOTSUPP) { 548 if (rc == -EOPNOTSUPP) {
538 /* intercept cannot be handled in-kernel, prepare kvm-run */ 549 /* intercept cannot be handled in-kernel, prepare kvm-run */
539 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC; 550 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
540 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode; 551 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
541 kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;
542 kvm_run->s390_sieic.addr = vcpu->arch.sie_block->gpsw.addr;
543 kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa; 552 kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa;
544 kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb; 553 kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb;
545 rc = 0; 554 rc = 0;
@@ -551,6 +560,9 @@ rerun_vcpu:
551 rc = 0; 560 rc = 0;
552 } 561 }
553 562
563 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
564 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
565
554 if (vcpu->sigset_active) 566 if (vcpu->sigset_active)
555 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 567 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
556 568
@@ -593,45 +605,45 @@ int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
593 } else 605 } else
594 prefix = 0; 606 prefix = 0;
595 607
596 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, fp_regs), 608 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
597 vcpu->arch.guest_fpregs.fprs, 128, prefix)) 609 vcpu->arch.guest_fpregs.fprs, 128, prefix))
598 return -EFAULT; 610 return -EFAULT;
599 611
600 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, gp_regs), 612 if (__guestcopy(vcpu, addr + offsetof(struct save_area, gp_regs),
601 vcpu->arch.guest_gprs, 128, prefix)) 613 vcpu->arch.guest_gprs, 128, prefix))
602 return -EFAULT; 614 return -EFAULT;
603 615
604 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, psw), 616 if (__guestcopy(vcpu, addr + offsetof(struct save_area, psw),
605 &vcpu->arch.sie_block->gpsw, 16, prefix)) 617 &vcpu->arch.sie_block->gpsw, 16, prefix))
606 return -EFAULT; 618 return -EFAULT;
607 619
608 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, pref_reg), 620 if (__guestcopy(vcpu, addr + offsetof(struct save_area, pref_reg),
609 &vcpu->arch.sie_block->prefix, 4, prefix)) 621 &vcpu->arch.sie_block->prefix, 4, prefix))
610 return -EFAULT; 622 return -EFAULT;
611 623
612 if (__guestcopy(vcpu, 624 if (__guestcopy(vcpu,
613 addr + offsetof(struct save_area_s390x, fp_ctrl_reg), 625 addr + offsetof(struct save_area, fp_ctrl_reg),
614 &vcpu->arch.guest_fpregs.fpc, 4, prefix)) 626 &vcpu->arch.guest_fpregs.fpc, 4, prefix))
615 return -EFAULT; 627 return -EFAULT;
616 628
617 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, tod_reg), 629 if (__guestcopy(vcpu, addr + offsetof(struct save_area, tod_reg),
618 &vcpu->arch.sie_block->todpr, 4, prefix)) 630 &vcpu->arch.sie_block->todpr, 4, prefix))
619 return -EFAULT; 631 return -EFAULT;
620 632
621 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, timer), 633 if (__guestcopy(vcpu, addr + offsetof(struct save_area, timer),
622 &vcpu->arch.sie_block->cputm, 8, prefix)) 634 &vcpu->arch.sie_block->cputm, 8, prefix))
623 return -EFAULT; 635 return -EFAULT;
624 636
625 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, clk_cmp), 637 if (__guestcopy(vcpu, addr + offsetof(struct save_area, clk_cmp),
626 &vcpu->arch.sie_block->ckc, 8, prefix)) 638 &vcpu->arch.sie_block->ckc, 8, prefix))
627 return -EFAULT; 639 return -EFAULT;
628 640
629 if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, acc_regs), 641 if (__guestcopy(vcpu, addr + offsetof(struct save_area, acc_regs),
630 &vcpu->arch.guest_acrs, 64, prefix)) 642 &vcpu->arch.guest_acrs, 64, prefix))
631 return -EFAULT; 643 return -EFAULT;
632 644
633 if (__guestcopy(vcpu, 645 if (__guestcopy(vcpu,
634 addr + offsetof(struct save_area_s390x, ctrl_regs), 646 addr + offsetof(struct save_area, ctrl_regs),
635 &vcpu->arch.sie_block->gcr, 128, prefix)) 647 &vcpu->arch.sie_block->gcr, 128, prefix))
636 return -EFAULT; 648 return -EFAULT;
637 return 0; 649 return 0;
@@ -679,14 +691,12 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
679} 691}
680 692
681/* Section: memory related */ 693/* Section: memory related */
682int kvm_arch_set_memory_region(struct kvm *kvm, 694int kvm_arch_prepare_memory_region(struct kvm *kvm,
683 struct kvm_userspace_memory_region *mem, 695 struct kvm_memory_slot *memslot,
684 struct kvm_memory_slot old, 696 struct kvm_memory_slot old,
685 int user_alloc) 697 struct kvm_userspace_memory_region *mem,
698 int user_alloc)
686{ 699{
687 int i;
688 struct kvm_vcpu *vcpu;
689
690 /* A few sanity checks. We can have exactly one memory slot which has 700 /* A few sanity checks. We can have exactly one memory slot which has
691 to start at guest virtual zero and which has to be located at a 701 to start at guest virtual zero and which has to be located at a
692 page boundary in userland and which has to end at a page boundary. 702 page boundary in userland and which has to end at a page boundary.
@@ -709,14 +719,23 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
709 if (!user_alloc) 719 if (!user_alloc)
710 return -EINVAL; 720 return -EINVAL;
711 721
722 return 0;
723}
724
725void kvm_arch_commit_memory_region(struct kvm *kvm,
726 struct kvm_userspace_memory_region *mem,
727 struct kvm_memory_slot old,
728 int user_alloc)
729{
730 int i;
731 struct kvm_vcpu *vcpu;
732
712 /* request update of sie control block for all available vcpus */ 733 /* request update of sie control block for all available vcpus */
713 kvm_for_each_vcpu(i, vcpu, kvm) { 734 kvm_for_each_vcpu(i, vcpu, kvm) {
714 if (test_and_set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) 735 if (test_and_set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
715 continue; 736 continue;
716 kvm_s390_inject_sigp_stop(vcpu, ACTION_RELOADVCPU_ON_STOP); 737 kvm_s390_inject_sigp_stop(vcpu, ACTION_RELOADVCPU_ON_STOP);
717 } 738 }
718
719 return 0;
720} 739}
721 740
722void kvm_arch_flush_shadow(struct kvm *kvm) 741void kvm_arch_flush_shadow(struct kvm *kvm)
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 06cce8285ba0..60f09ab3672c 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -67,10 +67,14 @@ static inline long kvm_s390_vcpu_get_memsize(struct kvm_vcpu *vcpu)
67 67
68static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu) 68static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu)
69{ 69{
70 int idx;
70 struct kvm_memory_slot *mem; 71 struct kvm_memory_slot *mem;
72 struct kvm_memslots *memslots;
71 73
72 down_read(&vcpu->kvm->slots_lock); 74 idx = srcu_read_lock(&vcpu->kvm->srcu);
73 mem = &vcpu->kvm->memslots[0]; 75 memslots = rcu_dereference(vcpu->kvm->memslots);
76
77 mem = &memslots->memslots[0];
74 78
75 vcpu->arch.sie_block->gmsor = mem->userspace_addr; 79 vcpu->arch.sie_block->gmsor = mem->userspace_addr;
76 vcpu->arch.sie_block->gmslm = 80 vcpu->arch.sie_block->gmslm =
@@ -78,7 +82,7 @@ static inline void kvm_s390_vcpu_set_mem(struct kvm_vcpu *vcpu)
78 (mem->npages << PAGE_SHIFT) + 82 (mem->npages << PAGE_SHIFT) +
79 VIRTIODESCSPACE - 1ul; 83 VIRTIODESCSPACE - 1ul;
80 84
81 up_read(&vcpu->kvm->slots_lock); 85 srcu_read_unlock(&vcpu->kvm->srcu, idx);
82} 86}
83 87
84/* implemented in priv.c */ 88/* implemented in priv.c */
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index d426aac8095d..44205507717c 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/kvm.h> 14#include <linux/kvm.h>
15#include <linux/gfp.h>
15#include <linux/errno.h> 16#include <linux/errno.h>
16#include <asm/current.h> 17#include <asm/current.h>
17#include <asm/debug.h> 18#include <asm/debug.h>
@@ -323,5 +324,5 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
323 else 324 else
324 return handler(vcpu); 325 return handler(vcpu);
325 } 326 }
326 return -ENOTSUPP; 327 return -EOPNOTSUPP;
327} 328}
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index 40c8c6748cfe..eff3c5989b46 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kvm.h> 15#include <linux/kvm.h>
16#include <linux/kvm_host.h> 16#include <linux/kvm_host.h>
17#include <linux/slab.h>
17#include "gaccess.h" 18#include "gaccess.h"
18#include "kvm-s390.h" 19#include "kvm-s390.h"
19 20
@@ -172,7 +173,7 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter)
172 rc = 0; /* order accepted */ 173 rc = 0; /* order accepted */
173 break; 174 break;
174 default: 175 default:
175 rc = -ENOTSUPP; 176 rc = -EOPNOTSUPP;
176 } 177 }
177 return rc; 178 return rc;
178} 179}
@@ -188,9 +189,9 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
188 189
189 /* make sure that the new value is valid memory */ 190 /* make sure that the new value is valid memory */
190 address = address & 0x7fffe000u; 191 address = address & 0x7fffe000u;
191 if ((copy_from_guest(vcpu, &tmp, 192 if ((copy_from_user(&tmp, (void __user *)
192 (u64) (address + vcpu->arch.sie_block->gmsor) , 1)) || 193 (address + vcpu->arch.sie_block->gmsor) , 1)) ||
193 (copy_from_guest(vcpu, &tmp, (u64) (address + 194 (copy_from_user(&tmp, (void __user *)(address +
194 vcpu->arch.sie_block->gmsor + PAGE_SIZE), 1))) { 195 vcpu->arch.sie_block->gmsor + PAGE_SIZE), 1))) {
195 *reg |= SIGP_STAT_INVALID_PARAMETER; 196 *reg |= SIGP_STAT_INVALID_PARAMETER;
196 return 1; /* invalid parameter */ 197 return 1; /* invalid parameter */
@@ -293,7 +294,7 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
293 vcpu->stat.instruction_sigp_restart++; 294 vcpu->stat.instruction_sigp_restart++;
294 /* user space must know about restart */ 295 /* user space must know about restart */
295 default: 296 default:
296 return -ENOTSUPP; 297 return -EOPNOTSUPP;
297 } 298 }
298 299
299 if (rc < 0) 300 if (rc < 0)
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 97975ec7a274..761ab8b56afc 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -3,6 +3,7 @@
3# 3#
4 4
5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
6obj-y += usercopy.o
6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o 7obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o
7lib-$(CONFIG_64BIT) += uaccess_mvcos.o 8lib-$(CONFIG_64BIT) += uaccess_mvcos.o
8lib-$(CONFIG_SMP) += spinlock.o 9lib-$(CONFIG_SMP) += spinlock.o
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index f7e0d30250b7..91754ffb9203 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -34,78 +34,99 @@ static inline void _raw_yield_cpu(int cpu)
34{ 34{
35 if (MACHINE_HAS_DIAG9C) 35 if (MACHINE_HAS_DIAG9C)
36 asm volatile("diag %0,0,0x9c" 36 asm volatile("diag %0,0,0x9c"
37 : : "d" (__cpu_logical_map[cpu])); 37 : : "d" (cpu_logical_map(cpu)));
38 else 38 else
39 _raw_yield(); 39 _raw_yield();
40} 40}
41 41
42void _raw_spin_lock_wait(raw_spinlock_t *lp) 42void arch_spin_lock_wait(arch_spinlock_t *lp)
43{ 43{
44 int count = spin_retry; 44 int count = spin_retry;
45 unsigned int cpu = ~smp_processor_id(); 45 unsigned int cpu = ~smp_processor_id();
46 unsigned int owner;
46 47
47 while (1) { 48 while (1) {
48 if (count-- <= 0) { 49 owner = lp->owner_cpu;
49 unsigned int owner = lp->owner_cpu; 50 if (!owner || smp_vcpu_scheduled(~owner)) {
50 if (owner != 0) 51 for (count = spin_retry; count > 0; count--) {
51 _raw_yield_cpu(~owner); 52 if (arch_spin_is_locked(lp))
52 count = spin_retry; 53 continue;
54 if (_raw_compare_and_swap(&lp->owner_cpu, 0,
55 cpu) == 0)
56 return;
57 }
58 if (MACHINE_IS_LPAR)
59 continue;
53 } 60 }
54 if (__raw_spin_is_locked(lp)) 61 owner = lp->owner_cpu;
55 continue; 62 if (owner)
63 _raw_yield_cpu(~owner);
56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) 64 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
57 return; 65 return;
58 } 66 }
59} 67}
60EXPORT_SYMBOL(_raw_spin_lock_wait); 68EXPORT_SYMBOL(arch_spin_lock_wait);
61 69
62void _raw_spin_lock_wait_flags(raw_spinlock_t *lp, unsigned long flags) 70void arch_spin_lock_wait_flags(arch_spinlock_t *lp, unsigned long flags)
63{ 71{
64 int count = spin_retry; 72 int count = spin_retry;
65 unsigned int cpu = ~smp_processor_id(); 73 unsigned int cpu = ~smp_processor_id();
74 unsigned int owner;
66 75
67 local_irq_restore(flags); 76 local_irq_restore(flags);
68 while (1) { 77 while (1) {
69 if (count-- <= 0) { 78 owner = lp->owner_cpu;
70 unsigned int owner = lp->owner_cpu; 79 if (!owner || smp_vcpu_scheduled(~owner)) {
71 if (owner != 0) 80 for (count = spin_retry; count > 0; count--) {
72 _raw_yield_cpu(~owner); 81 if (arch_spin_is_locked(lp))
73 count = spin_retry; 82 continue;
83 local_irq_disable();
84 if (_raw_compare_and_swap(&lp->owner_cpu, 0,
85 cpu) == 0)
86 return;
87 local_irq_restore(flags);
88 }
89 if (MACHINE_IS_LPAR)
90 continue;
74 } 91 }
75 if (__raw_spin_is_locked(lp)) 92 owner = lp->owner_cpu;
76 continue; 93 if (owner)
94 _raw_yield_cpu(~owner);
77 local_irq_disable(); 95 local_irq_disable();
78 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) 96 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
79 return; 97 return;
80 local_irq_restore(flags); 98 local_irq_restore(flags);
81 } 99 }
82} 100}
83EXPORT_SYMBOL(_raw_spin_lock_wait_flags); 101EXPORT_SYMBOL(arch_spin_lock_wait_flags);
84 102
85int _raw_spin_trylock_retry(raw_spinlock_t *lp) 103int arch_spin_trylock_retry(arch_spinlock_t *lp)
86{ 104{
87 unsigned int cpu = ~smp_processor_id(); 105 unsigned int cpu = ~smp_processor_id();
88 int count; 106 int count;
89 107
90 for (count = spin_retry; count > 0; count--) { 108 for (count = spin_retry; count > 0; count--) {
91 if (__raw_spin_is_locked(lp)) 109 if (arch_spin_is_locked(lp))
92 continue; 110 continue;
93 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) 111 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
94 return 1; 112 return 1;
95 } 113 }
96 return 0; 114 return 0;
97} 115}
98EXPORT_SYMBOL(_raw_spin_trylock_retry); 116EXPORT_SYMBOL(arch_spin_trylock_retry);
99 117
100void _raw_spin_relax(raw_spinlock_t *lock) 118void arch_spin_relax(arch_spinlock_t *lock)
101{ 119{
102 unsigned int cpu = lock->owner_cpu; 120 unsigned int cpu = lock->owner_cpu;
103 if (cpu != 0) 121 if (cpu != 0) {
104 _raw_yield_cpu(~cpu); 122 if (MACHINE_IS_VM || MACHINE_IS_KVM ||
123 !smp_vcpu_scheduled(~cpu))
124 _raw_yield_cpu(~cpu);
125 }
105} 126}
106EXPORT_SYMBOL(_raw_spin_relax); 127EXPORT_SYMBOL(arch_spin_relax);
107 128
108void _raw_read_lock_wait(raw_rwlock_t *rw) 129void _raw_read_lock_wait(arch_rwlock_t *rw)
109{ 130{
110 unsigned int old; 131 unsigned int old;
111 int count = spin_retry; 132 int count = spin_retry;
@@ -115,7 +136,7 @@ void _raw_read_lock_wait(raw_rwlock_t *rw)
115 _raw_yield(); 136 _raw_yield();
116 count = spin_retry; 137 count = spin_retry;
117 } 138 }
118 if (!__raw_read_can_lock(rw)) 139 if (!arch_read_can_lock(rw))
119 continue; 140 continue;
120 old = rw->lock & 0x7fffffffU; 141 old = rw->lock & 0x7fffffffU;
121 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 142 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
@@ -124,7 +145,7 @@ void _raw_read_lock_wait(raw_rwlock_t *rw)
124} 145}
125EXPORT_SYMBOL(_raw_read_lock_wait); 146EXPORT_SYMBOL(_raw_read_lock_wait);
126 147
127void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) 148void _raw_read_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags)
128{ 149{
129 unsigned int old; 150 unsigned int old;
130 int count = spin_retry; 151 int count = spin_retry;
@@ -135,7 +156,7 @@ void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags)
135 _raw_yield(); 156 _raw_yield();
136 count = spin_retry; 157 count = spin_retry;
137 } 158 }
138 if (!__raw_read_can_lock(rw)) 159 if (!arch_read_can_lock(rw))
139 continue; 160 continue;
140 old = rw->lock & 0x7fffffffU; 161 old = rw->lock & 0x7fffffffU;
141 local_irq_disable(); 162 local_irq_disable();
@@ -145,13 +166,13 @@ void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags)
145} 166}
146EXPORT_SYMBOL(_raw_read_lock_wait_flags); 167EXPORT_SYMBOL(_raw_read_lock_wait_flags);
147 168
148int _raw_read_trylock_retry(raw_rwlock_t *rw) 169int _raw_read_trylock_retry(arch_rwlock_t *rw)
149{ 170{
150 unsigned int old; 171 unsigned int old;
151 int count = spin_retry; 172 int count = spin_retry;
152 173
153 while (count-- > 0) { 174 while (count-- > 0) {
154 if (!__raw_read_can_lock(rw)) 175 if (!arch_read_can_lock(rw))
155 continue; 176 continue;
156 old = rw->lock & 0x7fffffffU; 177 old = rw->lock & 0x7fffffffU;
157 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 178 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
@@ -161,7 +182,7 @@ int _raw_read_trylock_retry(raw_rwlock_t *rw)
161} 182}
162EXPORT_SYMBOL(_raw_read_trylock_retry); 183EXPORT_SYMBOL(_raw_read_trylock_retry);
163 184
164void _raw_write_lock_wait(raw_rwlock_t *rw) 185void _raw_write_lock_wait(arch_rwlock_t *rw)
165{ 186{
166 int count = spin_retry; 187 int count = spin_retry;
167 188
@@ -170,7 +191,7 @@ void _raw_write_lock_wait(raw_rwlock_t *rw)
170 _raw_yield(); 191 _raw_yield();
171 count = spin_retry; 192 count = spin_retry;
172 } 193 }
173 if (!__raw_write_can_lock(rw)) 194 if (!arch_write_can_lock(rw))
174 continue; 195 continue;
175 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 196 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
176 return; 197 return;
@@ -178,7 +199,7 @@ void _raw_write_lock_wait(raw_rwlock_t *rw)
178} 199}
179EXPORT_SYMBOL(_raw_write_lock_wait); 200EXPORT_SYMBOL(_raw_write_lock_wait);
180 201
181void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) 202void _raw_write_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags)
182{ 203{
183 int count = spin_retry; 204 int count = spin_retry;
184 205
@@ -188,7 +209,7 @@ void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags)
188 _raw_yield(); 209 _raw_yield();
189 count = spin_retry; 210 count = spin_retry;
190 } 211 }
191 if (!__raw_write_can_lock(rw)) 212 if (!arch_write_can_lock(rw))
192 continue; 213 continue;
193 local_irq_disable(); 214 local_irq_disable();
194 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 215 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
@@ -197,12 +218,12 @@ void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags)
197} 218}
198EXPORT_SYMBOL(_raw_write_lock_wait_flags); 219EXPORT_SYMBOL(_raw_write_lock_wait_flags);
199 220
200int _raw_write_trylock_retry(raw_rwlock_t *rw) 221int _raw_write_trylock_retry(arch_rwlock_t *rw)
201{ 222{
202 int count = spin_retry; 223 int count = spin_retry;
203 224
204 while (count-- > 0) { 225 while (count-- > 0) {
205 if (!__raw_write_can_lock(rw)) 226 if (!arch_write_can_lock(rw))
206 continue; 227 continue;
207 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 228 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
208 return 1; 229 return 1;
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index 58da3f461214..60455f104ea3 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -162,7 +162,6 @@ static size_t clear_user_mvcos(size_t size, void __user *to)
162 return size; 162 return size;
163} 163}
164 164
165#ifdef CONFIG_S390_SWITCH_AMODE
166static size_t strnlen_user_mvcos(size_t count, const char __user *src) 165static size_t strnlen_user_mvcos(size_t count, const char __user *src)
167{ 166{
168 char buf[256]; 167 char buf[256];
@@ -200,7 +199,6 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
200 } while ((len_str == len) && (done < count)); 199 } while ((len_str == len) && (done < count));
201 return done; 200 return done;
202} 201}
203#endif /* CONFIG_S390_SWITCH_AMODE */
204 202
205struct uaccess_ops uaccess_mvcos = { 203struct uaccess_ops uaccess_mvcos = {
206 .copy_from_user = copy_from_user_mvcos_check, 204 .copy_from_user = copy_from_user_mvcos_check,
@@ -215,7 +213,6 @@ struct uaccess_ops uaccess_mvcos = {
215 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std, 213 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std,
216}; 214};
217 215
218#ifdef CONFIG_S390_SWITCH_AMODE
219struct uaccess_ops uaccess_mvcos_switch = { 216struct uaccess_ops uaccess_mvcos_switch = {
220 .copy_from_user = copy_from_user_mvcos, 217 .copy_from_user = copy_from_user_mvcos,
221 .copy_from_user_small = copy_from_user_mvcos, 218 .copy_from_user_small = copy_from_user_mvcos,
@@ -228,4 +225,3 @@ struct uaccess_ops uaccess_mvcos_switch = {
228 .futex_atomic_op = futex_atomic_op_pt, 225 .futex_atomic_op = futex_atomic_op_pt,
229 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt, 226 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt,
230}; 227};
231#endif
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index cb5d59eab0ee..404f2de296dc 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -23,86 +23,21 @@ static inline pte_t *follow_table(struct mm_struct *mm, unsigned long addr)
23 23
24 pgd = pgd_offset(mm, addr); 24 pgd = pgd_offset(mm, addr);
25 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) 25 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
26 return NULL; 26 return (pte_t *) 0x3a;
27 27
28 pud = pud_offset(pgd, addr); 28 pud = pud_offset(pgd, addr);
29 if (pud_none(*pud) || unlikely(pud_bad(*pud))) 29 if (pud_none(*pud) || unlikely(pud_bad(*pud)))
30 return NULL; 30 return (pte_t *) 0x3b;
31 31
32 pmd = pmd_offset(pud, addr); 32 pmd = pmd_offset(pud, addr);
33 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) 33 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
34 return NULL; 34 return (pte_t *) 0x10;
35 35
36 return pte_offset_map(pmd, addr); 36 return pte_offset_map(pmd, addr);
37} 37}
38 38
39static int __handle_fault(struct mm_struct *mm, unsigned long address, 39static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
40 int write_access) 40 size_t n, int write_user)
41{
42 struct vm_area_struct *vma;
43 int ret = -EFAULT;
44 int fault;
45
46 if (in_atomic())
47 return ret;
48 down_read(&mm->mmap_sem);
49 vma = find_vma(mm, address);
50 if (unlikely(!vma))
51 goto out;
52 if (unlikely(vma->vm_start > address)) {
53 if (!(vma->vm_flags & VM_GROWSDOWN))
54 goto out;
55 if (expand_stack(vma, address))
56 goto out;
57 }
58
59 if (!write_access) {
60 /* page not present, check vm flags */
61 if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
62 goto out;
63 } else {
64 if (!(vma->vm_flags & VM_WRITE))
65 goto out;
66 }
67
68survive:
69 fault = handle_mm_fault(mm, vma, address, write_access ? FAULT_FLAG_WRITE : 0);
70 if (unlikely(fault & VM_FAULT_ERROR)) {
71 if (fault & VM_FAULT_OOM)
72 goto out_of_memory;
73 else if (fault & VM_FAULT_SIGBUS)
74 goto out_sigbus;
75 BUG();
76 }
77 if (fault & VM_FAULT_MAJOR)
78 current->maj_flt++;
79 else
80 current->min_flt++;
81 ret = 0;
82out:
83 up_read(&mm->mmap_sem);
84 return ret;
85
86out_of_memory:
87 up_read(&mm->mmap_sem);
88 if (is_global_init(current)) {
89 yield();
90 down_read(&mm->mmap_sem);
91 goto survive;
92 }
93 printk("VM: killing process %s\n", current->comm);
94 return ret;
95
96out_sigbus:
97 up_read(&mm->mmap_sem);
98 current->thread.prot_addr = address;
99 current->thread.trap_no = 0x11;
100 force_sig(SIGBUS, current);
101 return ret;
102}
103
104static size_t __user_copy_pt(unsigned long uaddr, void *kptr,
105 size_t n, int write_user)
106{ 41{
107 struct mm_struct *mm = current->mm; 42 struct mm_struct *mm = current->mm;
108 unsigned long offset, pfn, done, size; 43 unsigned long offset, pfn, done, size;
@@ -114,12 +49,17 @@ retry:
114 spin_lock(&mm->page_table_lock); 49 spin_lock(&mm->page_table_lock);
115 do { 50 do {
116 pte = follow_table(mm, uaddr); 51 pte = follow_table(mm, uaddr);
117 if (!pte || !pte_present(*pte) || 52 if ((unsigned long) pte < 0x1000)
118 (write_user && !pte_write(*pte)))
119 goto fault; 53 goto fault;
54 if (!pte_present(*pte)) {
55 pte = (pte_t *) 0x11;
56 goto fault;
57 } else if (write_user && !pte_write(*pte)) {
58 pte = (pte_t *) 0x04;
59 goto fault;
60 }
120 61
121 pfn = pte_pfn(*pte); 62 pfn = pte_pfn(*pte);
122
123 offset = uaddr & (PAGE_SIZE - 1); 63 offset = uaddr & (PAGE_SIZE - 1);
124 size = min(n - done, PAGE_SIZE - offset); 64 size = min(n - done, PAGE_SIZE - offset);
125 if (write_user) { 65 if (write_user) {
@@ -137,7 +77,7 @@ retry:
137 return n - done; 77 return n - done;
138fault: 78fault:
139 spin_unlock(&mm->page_table_lock); 79 spin_unlock(&mm->page_table_lock);
140 if (__handle_fault(mm, uaddr, write_user)) 80 if (__handle_fault(uaddr, (unsigned long) pte, write_user))
141 return n - done; 81 return n - done;
142 goto retry; 82 goto retry;
143} 83}
@@ -146,30 +86,31 @@ fault:
146 * Do DAT for user address by page table walk, return kernel address. 86 * Do DAT for user address by page table walk, return kernel address.
147 * This function needs to be called with current->mm->page_table_lock held. 87 * This function needs to be called with current->mm->page_table_lock held.
148 */ 88 */
149static unsigned long __dat_user_addr(unsigned long uaddr) 89static __always_inline unsigned long __dat_user_addr(unsigned long uaddr)
150{ 90{
151 struct mm_struct *mm = current->mm; 91 struct mm_struct *mm = current->mm;
152 unsigned long pfn, ret; 92 unsigned long pfn;
153 pte_t *pte; 93 pte_t *pte;
154 int rc; 94 int rc;
155 95
156 ret = 0;
157retry: 96retry:
158 pte = follow_table(mm, uaddr); 97 pte = follow_table(mm, uaddr);
159 if (!pte || !pte_present(*pte)) 98 if ((unsigned long) pte < 0x1000)
160 goto fault; 99 goto fault;
100 if (!pte_present(*pte)) {
101 pte = (pte_t *) 0x11;
102 goto fault;
103 }
161 104
162 pfn = pte_pfn(*pte); 105 pfn = pte_pfn(*pte);
163 ret = (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1)); 106 return (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1));
164out:
165 return ret;
166fault: 107fault:
167 spin_unlock(&mm->page_table_lock); 108 spin_unlock(&mm->page_table_lock);
168 rc = __handle_fault(mm, uaddr, 0); 109 rc = __handle_fault(uaddr, (unsigned long) pte, 0);
169 spin_lock(&mm->page_table_lock); 110 spin_lock(&mm->page_table_lock);
170 if (rc) 111 if (!rc)
171 goto out; 112 goto retry;
172 goto retry; 113 return 0;
173} 114}
174 115
175size_t copy_from_user_pt(size_t n, const void __user *from, void *to) 116size_t copy_from_user_pt(size_t n, const void __user *from, void *to)
@@ -234,8 +175,12 @@ retry:
234 spin_lock(&mm->page_table_lock); 175 spin_lock(&mm->page_table_lock);
235 do { 176 do {
236 pte = follow_table(mm, uaddr); 177 pte = follow_table(mm, uaddr);
237 if (!pte || !pte_present(*pte)) 178 if ((unsigned long) pte < 0x1000)
179 goto fault;
180 if (!pte_present(*pte)) {
181 pte = (pte_t *) 0x11;
238 goto fault; 182 goto fault;
183 }
239 184
240 pfn = pte_pfn(*pte); 185 pfn = pte_pfn(*pte);
241 offset = uaddr & (PAGE_SIZE-1); 186 offset = uaddr & (PAGE_SIZE-1);
@@ -249,9 +194,8 @@ retry:
249 return done + 1; 194 return done + 1;
250fault: 195fault:
251 spin_unlock(&mm->page_table_lock); 196 spin_unlock(&mm->page_table_lock);
252 if (__handle_fault(mm, uaddr, 0)) { 197 if (__handle_fault(uaddr, (unsigned long) pte, 0))
253 return 0; 198 return 0;
254 }
255 goto retry; 199 goto retry;
256} 200}
257 201
@@ -284,7 +228,7 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
284{ 228{
285 struct mm_struct *mm = current->mm; 229 struct mm_struct *mm = current->mm;
286 unsigned long offset_from, offset_to, offset_max, pfn_from, pfn_to, 230 unsigned long offset_from, offset_to, offset_max, pfn_from, pfn_to,
287 uaddr, done, size; 231 uaddr, done, size, error_code;
288 unsigned long uaddr_from = (unsigned long) from; 232 unsigned long uaddr_from = (unsigned long) from;
289 unsigned long uaddr_to = (unsigned long) to; 233 unsigned long uaddr_to = (unsigned long) to;
290 pte_t *pte_from, *pte_to; 234 pte_t *pte_from, *pte_to;
@@ -298,17 +242,28 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
298retry: 242retry:
299 spin_lock(&mm->page_table_lock); 243 spin_lock(&mm->page_table_lock);
300 do { 244 do {
245 write_user = 0;
246 uaddr = uaddr_from;
301 pte_from = follow_table(mm, uaddr_from); 247 pte_from = follow_table(mm, uaddr_from);
302 if (!pte_from || !pte_present(*pte_from)) { 248 error_code = (unsigned long) pte_from;
303 uaddr = uaddr_from; 249 if (error_code < 0x1000)
304 write_user = 0; 250 goto fault;
251 if (!pte_present(*pte_from)) {
252 error_code = 0x11;
305 goto fault; 253 goto fault;
306 } 254 }
307 255
256 write_user = 1;
257 uaddr = uaddr_to;
308 pte_to = follow_table(mm, uaddr_to); 258 pte_to = follow_table(mm, uaddr_to);
309 if (!pte_to || !pte_present(*pte_to) || !pte_write(*pte_to)) { 259 error_code = (unsigned long) pte_to;
310 uaddr = uaddr_to; 260 if (error_code < 0x1000)
311 write_user = 1; 261 goto fault;
262 if (!pte_present(*pte_to)) {
263 error_code = 0x11;
264 goto fault;
265 } else if (!pte_write(*pte_to)) {
266 error_code = 0x04;
312 goto fault; 267 goto fault;
313 } 268 }
314 269
@@ -329,7 +284,7 @@ retry:
329 return n - done; 284 return n - done;
330fault: 285fault:
331 spin_unlock(&mm->page_table_lock); 286 spin_unlock(&mm->page_table_lock);
332 if (__handle_fault(mm, uaddr, write_user)) 287 if (__handle_fault(uaddr, error_code, write_user))
333 return n - done; 288 return n - done;
334 goto retry; 289 goto retry;
335} 290}
diff --git a/arch/s390/lib/usercopy.c b/arch/s390/lib/usercopy.c
new file mode 100644
index 000000000000..14b363fec8a2
--- /dev/null
+++ b/arch/s390/lib/usercopy.c
@@ -0,0 +1,8 @@
1#include <linux/module.h>
2#include <linux/bug.h>
3
4void copy_from_user_overflow(void)
5{
6 WARN(1, "Buffer overflow detected!\n");
7}
8EXPORT_SYMBOL(copy_from_user_overflow);
diff --git a/arch/s390/math-emu/math.c b/arch/s390/math-emu/math.c
index 3ee78ccb617d..cd4e9c168dd7 100644
--- a/arch/s390/math-emu/math.c
+++ b/arch/s390/math-emu/math.c
@@ -2088,7 +2088,7 @@ int math_emu_ldr(__u8 *opcode) {
2088 __u16 opc = *((__u16 *) opcode); 2088 __u16 opc = *((__u16 *) opcode);
2089 2089
2090 if ((opc & 0x90) == 0) { /* test if rx in {0,2,4,6} */ 2090 if ((opc & 0x90) == 0) { /* test if rx in {0,2,4,6} */
2091 /* we got an exception therfore ry can't be in {0,2,4,6} */ 2091 /* we got an exception therefore ry can't be in {0,2,4,6} */
2092 asm volatile( /* load rx from fp_regs.fprs[ry] */ 2092 asm volatile( /* load rx from fp_regs.fprs[ry] */
2093 " bras 1,0f\n" 2093 " bras 1,0f\n"
2094 " ld 0,0(%1)\n" 2094 " ld 0,0(%1)\n"
@@ -2118,7 +2118,7 @@ int math_emu_ler(__u8 *opcode) {
2118 __u16 opc = *((__u16 *) opcode); 2118 __u16 opc = *((__u16 *) opcode);
2119 2119
2120 if ((opc & 0x90) == 0) { /* test if rx in {0,2,4,6} */ 2120 if ((opc & 0x90) == 0) { /* test if rx in {0,2,4,6} */
2121 /* we got an exception therfore ry can't be in {0,2,4,6} */ 2121 /* we got an exception therefore ry can't be in {0,2,4,6} */
2122 asm volatile( /* load rx from fp_regs.fprs[ry] */ 2122 asm volatile( /* load rx from fp_regs.fprs[ry] */
2123 " bras 1,0f\n" 2123 " bras 1,0f\n"
2124 " le 0,0(%1)\n" 2124 " le 0,0(%1)\n"
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index b201135cc18c..f87b34731e1d 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -12,12 +12,14 @@
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/gfp.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/sysctl.h> 17#include <linux/sysctl.h>
17#include <linux/ctype.h> 18#include <linux/ctype.h>
18#include <linux/swap.h> 19#include <linux/swap.h>
19#include <linux/kthread.h> 20#include <linux/kthread.h>
20#include <linux/oom.h> 21#include <linux/oom.h>
22#include <linux/suspend.h>
21 23
22#include <asm/pgalloc.h> 24#include <asm/pgalloc.h>
23#include <asm/uaccess.h> 25#include <asm/uaccess.h>
@@ -44,6 +46,7 @@ static volatile long cmm_pages_target;
44static volatile long cmm_timed_pages_target; 46static volatile long cmm_timed_pages_target;
45static long cmm_timeout_pages; 47static long cmm_timeout_pages;
46static long cmm_timeout_seconds; 48static long cmm_timeout_seconds;
49static int cmm_suspended;
47 50
48static struct cmm_page_array *cmm_page_list; 51static struct cmm_page_array *cmm_page_list;
49static struct cmm_page_array *cmm_timed_page_list; 52static struct cmm_page_array *cmm_timed_page_list;
@@ -147,9 +150,9 @@ cmm_thread(void *dummy)
147 150
148 while (1) { 151 while (1) {
149 rc = wait_event_interruptible(cmm_thread_wait, 152 rc = wait_event_interruptible(cmm_thread_wait,
150 (cmm_pages != cmm_pages_target || 153 (!cmm_suspended && (cmm_pages != cmm_pages_target ||
151 cmm_timed_pages != cmm_timed_pages_target || 154 cmm_timed_pages != cmm_timed_pages_target)) ||
152 kthread_should_stop())); 155 kthread_should_stop());
153 if (kthread_should_stop() || rc == -ERESTARTSYS) { 156 if (kthread_should_stop() || rc == -ERESTARTSYS) {
154 cmm_pages_target = cmm_pages; 157 cmm_pages_target = cmm_pages;
155 cmm_timed_pages_target = cmm_timed_pages; 158 cmm_timed_pages_target = cmm_timed_pages;
@@ -343,37 +346,36 @@ static struct ctl_table cmm_table[] = {
343 { 346 {
344 .procname = "cmm_pages", 347 .procname = "cmm_pages",
345 .mode = 0644, 348 .mode = 0644,
346 .proc_handler = &cmm_pages_handler, 349 .proc_handler = cmm_pages_handler,
347 }, 350 },
348 { 351 {
349 .procname = "cmm_timed_pages", 352 .procname = "cmm_timed_pages",
350 .mode = 0644, 353 .mode = 0644,
351 .proc_handler = &cmm_pages_handler, 354 .proc_handler = cmm_pages_handler,
352 }, 355 },
353 { 356 {
354 .procname = "cmm_timeout", 357 .procname = "cmm_timeout",
355 .mode = 0644, 358 .mode = 0644,
356 .proc_handler = &cmm_timeout_handler, 359 .proc_handler = cmm_timeout_handler,
357 }, 360 },
358 { .ctl_name = 0 } 361 { }
359}; 362};
360 363
361static struct ctl_table cmm_dir_table[] = { 364static struct ctl_table cmm_dir_table[] = {
362 { 365 {
363 .ctl_name = CTL_VM,
364 .procname = "vm", 366 .procname = "vm",
365 .maxlen = 0, 367 .maxlen = 0,
366 .mode = 0555, 368 .mode = 0555,
367 .child = cmm_table, 369 .child = cmm_table,
368 }, 370 },
369 { .ctl_name = 0 } 371 { }
370}; 372};
371#endif 373#endif
372 374
373#ifdef CONFIG_CMM_IUCV 375#ifdef CONFIG_CMM_IUCV
374#define SMSG_PREFIX "CMM" 376#define SMSG_PREFIX "CMM"
375static void 377static void
376cmm_smsg_target(char *from, char *msg) 378cmm_smsg_target(const char *from, char *msg)
377{ 379{
378 long nr, seconds; 380 long nr, seconds;
379 381
@@ -411,6 +413,38 @@ cmm_smsg_target(char *from, char *msg)
411 413
412static struct ctl_table_header *cmm_sysctl_header; 414static struct ctl_table_header *cmm_sysctl_header;
413 415
416static int cmm_suspend(void)
417{
418 cmm_suspended = 1;
419 cmm_free_pages(cmm_pages, &cmm_pages, &cmm_page_list);
420 cmm_free_pages(cmm_timed_pages, &cmm_timed_pages, &cmm_timed_page_list);
421 return 0;
422}
423
424static int cmm_resume(void)
425{
426 cmm_suspended = 0;
427 cmm_kick_thread();
428 return 0;
429}
430
431static int cmm_power_event(struct notifier_block *this,
432 unsigned long event, void *ptr)
433{
434 switch (event) {
435 case PM_POST_HIBERNATION:
436 return cmm_resume();
437 case PM_HIBERNATION_PREPARE:
438 return cmm_suspend();
439 default:
440 return NOTIFY_DONE;
441 }
442}
443
444static struct notifier_block cmm_power_notifier = {
445 .notifier_call = cmm_power_event,
446};
447
414static int 448static int
415cmm_init (void) 449cmm_init (void)
416{ 450{
@@ -419,7 +453,7 @@ cmm_init (void)
419#ifdef CONFIG_CMM_PROC 453#ifdef CONFIG_CMM_PROC
420 cmm_sysctl_header = register_sysctl_table(cmm_dir_table); 454 cmm_sysctl_header = register_sysctl_table(cmm_dir_table);
421 if (!cmm_sysctl_header) 455 if (!cmm_sysctl_header)
422 goto out; 456 goto out_sysctl;
423#endif 457#endif
424#ifdef CONFIG_CMM_IUCV 458#ifdef CONFIG_CMM_IUCV
425 rc = smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 459 rc = smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
@@ -429,17 +463,21 @@ cmm_init (void)
429 rc = register_oom_notifier(&cmm_oom_nb); 463 rc = register_oom_notifier(&cmm_oom_nb);
430 if (rc < 0) 464 if (rc < 0)
431 goto out_oom_notify; 465 goto out_oom_notify;
466 rc = register_pm_notifier(&cmm_power_notifier);
467 if (rc)
468 goto out_pm;
432 init_waitqueue_head(&cmm_thread_wait); 469 init_waitqueue_head(&cmm_thread_wait);
433 init_timer(&cmm_timer); 470 init_timer(&cmm_timer);
434 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread"); 471 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread");
435 rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; 472 rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0;
436 if (!rc) 473 if (rc)
437 goto out; 474 goto out_kthread;
438 /* 475 return 0;
439 * kthread_create failed. undo all the stuff from above again.
440 */
441 unregister_oom_notifier(&cmm_oom_nb);
442 476
477out_kthread:
478 unregister_pm_notifier(&cmm_power_notifier);
479out_pm:
480 unregister_oom_notifier(&cmm_oom_nb);
443out_oom_notify: 481out_oom_notify:
444#ifdef CONFIG_CMM_IUCV 482#ifdef CONFIG_CMM_IUCV
445 smsg_unregister_callback(SMSG_PREFIX, cmm_smsg_target); 483 smsg_unregister_callback(SMSG_PREFIX, cmm_smsg_target);
@@ -447,8 +485,8 @@ out_smsg:
447#endif 485#endif
448#ifdef CONFIG_CMM_PROC 486#ifdef CONFIG_CMM_PROC
449 unregister_sysctl_table(cmm_sysctl_header); 487 unregister_sysctl_table(cmm_sysctl_header);
488out_sysctl:
450#endif 489#endif
451out:
452 return rc; 490 return rc;
453} 491}
454 492
@@ -456,6 +494,7 @@ static void
456cmm_exit(void) 494cmm_exit(void)
457{ 495{
458 kthread_stop(cmm_thread_ptr); 496 kthread_stop(cmm_thread_ptr);
497 unregister_pm_notifier(&cmm_power_notifier);
459 unregister_oom_notifier(&cmm_oom_nb); 498 unregister_oom_notifier(&cmm_oom_nb);
460 cmm_free_pages(cmm_pages, &cmm_pages, &cmm_page_list); 499 cmm_free_pages(cmm_pages, &cmm_pages, &cmm_page_list);
461 cmm_free_pages(cmm_timed_pages, &cmm_timed_pages, &cmm_timed_page_list); 500 cmm_free_pages(cmm_timed_pages, &cmm_timed_pages, &cmm_timed_page_list);
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 5c8457129603..6409fd57eb04 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -309,7 +309,7 @@ query_segment_type (struct dcss_segment *seg)
309 } 309 }
310#endif 310#endif
311 if (qout->segcnt > 6) { 311 if (qout->segcnt > 6) {
312 rc = -ENOTSUPP; 312 rc = -EOPNOTSUPP;
313 goto out_free; 313 goto out_free;
314 } 314 }
315 315
@@ -324,11 +324,11 @@ query_segment_type (struct dcss_segment *seg)
324 for (i=0; i<qout->segcnt; i++) { 324 for (i=0; i<qout->segcnt; i++) {
325 if (((qout->range[i].start & 0xff) != SEG_TYPE_EW) && 325 if (((qout->range[i].start & 0xff) != SEG_TYPE_EW) &&
326 ((qout->range[i].start & 0xff) != SEG_TYPE_EN)) { 326 ((qout->range[i].start & 0xff) != SEG_TYPE_EN)) {
327 rc = -ENOTSUPP; 327 rc = -EOPNOTSUPP;
328 goto out_free; 328 goto out_free;
329 } 329 }
330 if (start != qout->range[i].start >> PAGE_SHIFT) { 330 if (start != qout->range[i].start >> PAGE_SHIFT) {
331 rc = -ENOTSUPP; 331 rc = -EOPNOTSUPP;
332 goto out_free; 332 goto out_free;
333 } 333 }
334 start = (qout->range[i].end >> PAGE_SHIFT) + 1; 334 start = (qout->range[i].end >> PAGE_SHIFT) + 1;
@@ -357,7 +357,7 @@ query_segment_type (struct dcss_segment *seg)
357 * -ENOSYS : we are not running on VM 357 * -ENOSYS : we are not running on VM
358 * -EIO : could not perform query diagnose 358 * -EIO : could not perform query diagnose
359 * -ENOENT : no such segment 359 * -ENOENT : no such segment
360 * -ENOTSUPP: multi-part segment cannot be used with linux 360 * -EOPNOTSUPP: multi-part segment cannot be used with linux
361 * -ENOMEM : out of memory 361 * -ENOMEM : out of memory
362 * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h 362 * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h
363 */ 363 */
@@ -515,7 +515,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
515 * -ENOSYS : we are not running on VM 515 * -ENOSYS : we are not running on VM
516 * -EIO : could not perform query or load diagnose 516 * -EIO : could not perform query or load diagnose
517 * -ENOENT : no such segment 517 * -ENOENT : no such segment
518 * -ENOTSUPP: multi-part segment cannot be used with linux 518 * -EOPNOTSUPP: multi-part segment cannot be used with linux
519 * -ENOSPC : segment cannot be used (overlaps with storage) 519 * -ENOSPC : segment cannot be used (overlaps with storage)
520 * -EBUSY : segment can temporarily not be used (overlaps with dcss) 520 * -EBUSY : segment can temporarily not be used (overlaps with dcss)
521 * -ERANGE : segment cannot be used (exceeds kernel mapping range) 521 * -ERANGE : segment cannot be used (exceeds kernel mapping range)
@@ -742,7 +742,7 @@ void segment_warning(int rc, char *seg_name)
742 pr_err("Loading or querying DCSS %s resulted in a " 742 pr_err("Loading or querying DCSS %s resulted in a "
743 "hardware error\n", seg_name); 743 "hardware error\n", seg_name);
744 break; 744 break;
745 case -ENOTSUPP: 745 case -EOPNOTSUPP:
746 pr_err("DCSS %s has multiple page ranges and cannot be " 746 pr_err("DCSS %s has multiple page ranges and cannot be "
747 "loaded or queried\n", seg_name); 747 "loaded or queried\n", seg_name);
748 break; 748 break;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 6d507462967a..3040d7c78fe0 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -30,20 +30,20 @@
30#include <linux/kprobes.h> 30#include <linux/kprobes.h>
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32#include <linux/hugetlb.h> 32#include <linux/hugetlb.h>
33#include <asm/asm-offsets.h>
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
35#include <asm/s390_ext.h> 36#include <asm/s390_ext.h>
36#include <asm/mmu_context.h> 37#include <asm/mmu_context.h>
38#include <asm/compat.h>
37#include "../kernel/entry.h" 39#include "../kernel/entry.h"
38 40
39#ifndef CONFIG_64BIT 41#ifndef CONFIG_64BIT
40#define __FAIL_ADDR_MASK 0x7ffff000 42#define __FAIL_ADDR_MASK 0x7ffff000
41#define __FIXUP_MASK 0x7fffffff
42#define __SUBCODE_MASK 0x0200 43#define __SUBCODE_MASK 0x0200
43#define __PF_RES_FIELD 0ULL 44#define __PF_RES_FIELD 0ULL
44#else /* CONFIG_64BIT */ 45#else /* CONFIG_64BIT */
45#define __FAIL_ADDR_MASK -4096L 46#define __FAIL_ADDR_MASK -4096L
46#define __FIXUP_MASK ~0L
47#define __SUBCODE_MASK 0x0600 47#define __SUBCODE_MASK 0x0600
48#define __PF_RES_FIELD 0x8000000000000000ULL 48#define __PF_RES_FIELD 0x8000000000000000ULL
49#endif /* CONFIG_64BIT */ 49#endif /* CONFIG_64BIT */
@@ -52,27 +52,23 @@
52extern int sysctl_userprocess_debug; 52extern int sysctl_userprocess_debug;
53#endif 53#endif
54 54
55#ifdef CONFIG_KPROBES 55#define VM_FAULT_BADCONTEXT 0x010000
56static inline int notify_page_fault(struct pt_regs *regs, long err) 56#define VM_FAULT_BADMAP 0x020000
57#define VM_FAULT_BADACCESS 0x040000
58
59static inline int notify_page_fault(struct pt_regs *regs)
57{ 60{
58 int ret = 0; 61 int ret = 0;
59 62
60 /* kprobe_running() needs smp_processor_id() */ 63 /* kprobe_running() needs smp_processor_id() */
61 if (!user_mode(regs)) { 64 if (kprobes_built_in() && !user_mode(regs)) {
62 preempt_disable(); 65 preempt_disable();
63 if (kprobe_running() && kprobe_fault_handler(regs, 14)) 66 if (kprobe_running() && kprobe_fault_handler(regs, 14))
64 ret = 1; 67 ret = 1;
65 preempt_enable(); 68 preempt_enable();
66 } 69 }
67
68 return ret; 70 return ret;
69} 71}
70#else
71static inline int notify_page_fault(struct pt_regs *regs, long err)
72{
73 return 0;
74}
75#endif
76 72
77 73
78/* 74/*
@@ -100,57 +96,50 @@ void bust_spinlocks(int yes)
100 96
101/* 97/*
102 * Returns the address space associated with the fault. 98 * Returns the address space associated with the fault.
103 * Returns 0 for kernel space, 1 for user space and 99 * Returns 0 for kernel space and 1 for user space.
104 * 2 for code execution in user space with noexec=on.
105 */ 100 */
106static inline int check_space(struct task_struct *tsk) 101static inline int user_space_fault(unsigned long trans_exc_code)
107{ 102{
108 /* 103 /*
109 * The lowest two bits of S390_lowcore.trans_exc_code 104 * The lowest two bits of the translation exception
110 * indicate which paging table was used. 105 * identification indicate which paging table was used.
111 */ 106 */
112 int desc = S390_lowcore.trans_exc_code & 3; 107 trans_exc_code &= 3;
113 108 if (trans_exc_code == 2)
114 if (desc == 3) /* Home Segment Table Descriptor */ 109 /* Access via secondary space, set_fs setting decides */
115 return switch_amode == 0; 110 return current->thread.mm_segment.ar4;
116 if (desc == 2) /* Secondary Segment Table Descriptor */ 111 if (user_mode == HOME_SPACE_MODE)
117 return tsk->thread.mm_segment.ar4; 112 /* User space if the access has been done via home space. */
118#ifdef CONFIG_S390_SWITCH_AMODE 113 return trans_exc_code == 3;
119 if (unlikely(desc == 1)) { /* STD determined via access register */ 114 /*
120 /* %a0 always indicates primary space. */ 115 * If the user space is not the home space the kernel runs in home
121 if (S390_lowcore.exc_access_id != 0) { 116 * space. Access via secondary space has already been covered,
122 save_access_regs(tsk->thread.acrs); 117 * access via primary space or access register is from user space
123 /* 118 * and access via home space is from the kernel.
124 * An alet of 0 indicates primary space. 119 */
125 * An alet of 1 indicates secondary space. 120 return trans_exc_code != 3;
126 * Any other alet values generate an
127 * alen-translation exception.
128 */
129 if (tsk->thread.acrs[S390_lowcore.exc_access_id])
130 return tsk->thread.mm_segment.ar4;
131 }
132 }
133#endif
134 /* Primary Segment Table Descriptor */
135 return switch_amode << s390_noexec;
136} 121}
137 122
138/* 123/*
139 * Send SIGSEGV to task. This is an external routine 124 * Send SIGSEGV to task. This is an external routine
140 * to keep the stack usage of do_page_fault small. 125 * to keep the stack usage of do_page_fault small.
141 */ 126 */
142static void do_sigsegv(struct pt_regs *regs, unsigned long error_code, 127static noinline void do_sigsegv(struct pt_regs *regs, long int_code,
143 int si_code, unsigned long address) 128 int si_code, unsigned long trans_exc_code)
144{ 129{
145 struct siginfo si; 130 struct siginfo si;
131 unsigned long address;
146 132
133 address = trans_exc_code & __FAIL_ADDR_MASK;
134 current->thread.prot_addr = address;
135 current->thread.trap_no = int_code;
147#if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG) 136#if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG)
148#if defined(CONFIG_SYSCTL) 137#if defined(CONFIG_SYSCTL)
149 if (sysctl_userprocess_debug) 138 if (sysctl_userprocess_debug)
150#endif 139#endif
151 { 140 {
152 printk("User process fault: interruption code 0x%lX\n", 141 printk("User process fault: interruption code 0x%lX\n",
153 error_code); 142 int_code);
154 printk("failing address: %lX\n", address); 143 printk("failing address: %lX\n", address);
155 show_regs(regs); 144 show_regs(regs);
156 } 145 }
@@ -161,13 +150,14 @@ static void do_sigsegv(struct pt_regs *regs, unsigned long error_code,
161 force_sig_info(SIGSEGV, &si, current); 150 force_sig_info(SIGSEGV, &si, current);
162} 151}
163 152
164static void do_no_context(struct pt_regs *regs, unsigned long error_code, 153static noinline void do_no_context(struct pt_regs *regs, long int_code,
165 unsigned long address) 154 unsigned long trans_exc_code)
166{ 155{
167 const struct exception_table_entry *fixup; 156 const struct exception_table_entry *fixup;
157 unsigned long address;
168 158
169 /* Are we prepared to handle this kernel fault? */ 159 /* Are we prepared to handle this kernel fault? */
170 fixup = search_exception_tables(regs->psw.addr & __FIXUP_MASK); 160 fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN);
171 if (fixup) { 161 if (fixup) {
172 regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE; 162 regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE;
173 return; 163 return;
@@ -177,129 +167,149 @@ static void do_no_context(struct pt_regs *regs, unsigned long error_code,
177 * Oops. The kernel tried to access some bad page. We'll have to 167 * Oops. The kernel tried to access some bad page. We'll have to
178 * terminate things with extreme prejudice. 168 * terminate things with extreme prejudice.
179 */ 169 */
180 if (check_space(current) == 0) 170 address = trans_exc_code & __FAIL_ADDR_MASK;
171 if (!user_space_fault(trans_exc_code))
181 printk(KERN_ALERT "Unable to handle kernel pointer dereference" 172 printk(KERN_ALERT "Unable to handle kernel pointer dereference"
182 " at virtual kernel address %p\n", (void *)address); 173 " at virtual kernel address %p\n", (void *)address);
183 else 174 else
184 printk(KERN_ALERT "Unable to handle kernel paging request" 175 printk(KERN_ALERT "Unable to handle kernel paging request"
185 " at virtual user address %p\n", (void *)address); 176 " at virtual user address %p\n", (void *)address);
186 177
187 die("Oops", regs, error_code); 178 die("Oops", regs, int_code);
188 do_exit(SIGKILL); 179 do_exit(SIGKILL);
189} 180}
190 181
191static void do_low_address(struct pt_regs *regs, unsigned long error_code) 182static noinline void do_low_address(struct pt_regs *regs, long int_code,
183 unsigned long trans_exc_code)
192{ 184{
193 /* Low-address protection hit in kernel mode means 185 /* Low-address protection hit in kernel mode means
194 NULL pointer write access in kernel mode. */ 186 NULL pointer write access in kernel mode. */
195 if (regs->psw.mask & PSW_MASK_PSTATE) { 187 if (regs->psw.mask & PSW_MASK_PSTATE) {
196 /* Low-address protection hit in user mode 'cannot happen'. */ 188 /* Low-address protection hit in user mode 'cannot happen'. */
197 die ("Low-address protection", regs, error_code); 189 die ("Low-address protection", regs, int_code);
198 do_exit(SIGKILL); 190 do_exit(SIGKILL);
199 } 191 }
200 192
201 do_no_context(regs, error_code, 0); 193 do_no_context(regs, int_code, trans_exc_code);
202} 194}
203 195
204static void do_sigbus(struct pt_regs *regs, unsigned long error_code, 196static noinline void do_sigbus(struct pt_regs *regs, long int_code,
205 unsigned long address) 197 unsigned long trans_exc_code)
206{ 198{
207 struct task_struct *tsk = current; 199 struct task_struct *tsk = current;
208 struct mm_struct *mm = tsk->mm;
209 200
210 up_read(&mm->mmap_sem);
211 /* 201 /*
212 * Send a sigbus, regardless of whether we were in kernel 202 * Send a sigbus, regardless of whether we were in kernel
213 * or user mode. 203 * or user mode.
214 */ 204 */
215 tsk->thread.prot_addr = address; 205 tsk->thread.prot_addr = trans_exc_code & __FAIL_ADDR_MASK;
216 tsk->thread.trap_no = error_code; 206 tsk->thread.trap_no = int_code;
217 force_sig(SIGBUS, tsk); 207 force_sig(SIGBUS, tsk);
218
219 /* Kernel mode? Handle exceptions or die */
220 if (!(regs->psw.mask & PSW_MASK_PSTATE))
221 do_no_context(regs, error_code, address);
222} 208}
223 209
224#ifdef CONFIG_S390_EXEC_PROTECT 210#ifdef CONFIG_S390_EXEC_PROTECT
225static int signal_return(struct mm_struct *mm, struct pt_regs *regs, 211static noinline int signal_return(struct pt_regs *regs, long int_code,
226 unsigned long address, unsigned long error_code) 212 unsigned long trans_exc_code)
227{ 213{
228 u16 instruction; 214 u16 instruction;
229 int rc; 215 int rc;
230#ifdef CONFIG_COMPAT
231 int compat;
232#endif
233 216
234 pagefault_disable();
235 rc = __get_user(instruction, (u16 __user *) regs->psw.addr); 217 rc = __get_user(instruction, (u16 __user *) regs->psw.addr);
236 pagefault_enable();
237 if (rc)
238 return -EFAULT;
239 218
240 up_read(&mm->mmap_sem); 219 if (!rc && instruction == 0x0a77) {
241 clear_tsk_thread_flag(current, TIF_SINGLE_STEP); 220 clear_tsk_thread_flag(current, TIF_SINGLE_STEP);
242#ifdef CONFIG_COMPAT 221 if (is_compat_task())
243 compat = is_compat_task(); 222 sys32_sigreturn();
244 if (compat && instruction == 0x0a77) 223 else
245 sys32_sigreturn(); 224 sys_sigreturn();
246 else if (compat && instruction == 0x0aad) 225 } else if (!rc && instruction == 0x0aad) {
247 sys32_rt_sigreturn(); 226 clear_tsk_thread_flag(current, TIF_SINGLE_STEP);
248 else 227 if (is_compat_task())
249#endif 228 sys32_rt_sigreturn();
250 if (instruction == 0x0a77) 229 else
251 sys_sigreturn(); 230 sys_rt_sigreturn();
252 else if (instruction == 0x0aad) 231 } else
253 sys_rt_sigreturn(); 232 do_sigsegv(regs, int_code, SEGV_MAPERR, trans_exc_code);
254 else {
255 current->thread.prot_addr = address;
256 current->thread.trap_no = error_code;
257 do_sigsegv(regs, error_code, SEGV_MAPERR, address);
258 }
259 return 0; 233 return 0;
260} 234}
261#endif /* CONFIG_S390_EXEC_PROTECT */ 235#endif /* CONFIG_S390_EXEC_PROTECT */
262 236
237static noinline void do_fault_error(struct pt_regs *regs, long int_code,
238 unsigned long trans_exc_code, int fault)
239{
240 int si_code;
241
242 switch (fault) {
243 case VM_FAULT_BADACCESS:
244#ifdef CONFIG_S390_EXEC_PROTECT
245 if ((regs->psw.mask & PSW_MASK_ASC) == PSW_ASC_SECONDARY &&
246 (trans_exc_code & 3) == 0) {
247 signal_return(regs, int_code, trans_exc_code);
248 break;
249 }
250#endif /* CONFIG_S390_EXEC_PROTECT */
251 case VM_FAULT_BADMAP:
252 /* Bad memory access. Check if it is kernel or user space. */
253 if (regs->psw.mask & PSW_MASK_PSTATE) {
254 /* User mode accesses just cause a SIGSEGV */
255 si_code = (fault == VM_FAULT_BADMAP) ?
256 SEGV_MAPERR : SEGV_ACCERR;
257 do_sigsegv(regs, int_code, si_code, trans_exc_code);
258 return;
259 }
260 case VM_FAULT_BADCONTEXT:
261 do_no_context(regs, int_code, trans_exc_code);
262 break;
263 default: /* fault & VM_FAULT_ERROR */
264 if (fault & VM_FAULT_OOM)
265 pagefault_out_of_memory();
266 else if (fault & VM_FAULT_SIGBUS) {
267 do_sigbus(regs, int_code, trans_exc_code);
268 /* Kernel mode? Handle exceptions or die */
269 if (!(regs->psw.mask & PSW_MASK_PSTATE))
270 do_no_context(regs, int_code, trans_exc_code);
271 } else
272 BUG();
273 break;
274 }
275}
276
263/* 277/*
264 * This routine handles page faults. It determines the address, 278 * This routine handles page faults. It determines the address,
265 * and the problem, and then passes it off to one of the appropriate 279 * and the problem, and then passes it off to one of the appropriate
266 * routines. 280 * routines.
267 * 281 *
268 * error_code: 282 * interruption code (int_code):
269 * 04 Protection -> Write-Protection (suprression) 283 * 04 Protection -> Write-Protection (suprression)
270 * 10 Segment translation -> Not present (nullification) 284 * 10 Segment translation -> Not present (nullification)
271 * 11 Page translation -> Not present (nullification) 285 * 11 Page translation -> Not present (nullification)
272 * 3b Region third trans. -> Not present (nullification) 286 * 3b Region third trans. -> Not present (nullification)
273 */ 287 */
274static inline void 288static inline int do_exception(struct pt_regs *regs, int access,
275do_exception(struct pt_regs *regs, unsigned long error_code, int write) 289 unsigned long trans_exc_code)
276{ 290{
277 struct task_struct *tsk; 291 struct task_struct *tsk;
278 struct mm_struct *mm; 292 struct mm_struct *mm;
279 struct vm_area_struct *vma; 293 struct vm_area_struct *vma;
280 unsigned long address; 294 unsigned long address;
281 int space;
282 int si_code;
283 int fault; 295 int fault;
284 296
285 if (notify_page_fault(regs, error_code)) 297 if (notify_page_fault(regs))
286 return; 298 return 0;
287 299
288 tsk = current; 300 tsk = current;
289 mm = tsk->mm; 301 mm = tsk->mm;
290 302
291 /* get the failing address and the affected space */
292 address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK;
293 space = check_space(tsk);
294
295 /* 303 /*
296 * Verify that the fault happened in user space, that 304 * Verify that the fault happened in user space, that
297 * we are not in an interrupt and that there is a 305 * we are not in an interrupt and that there is a
298 * user context. 306 * user context.
299 */ 307 */
300 if (unlikely(space == 0 || in_atomic() || !mm)) 308 fault = VM_FAULT_BADCONTEXT;
301 goto no_context; 309 if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm))
310 goto out;
302 311
312 address = trans_exc_code & __FAIL_ADDR_MASK;
303 /* 313 /*
304 * When we get here, the fault happened in the current 314 * When we get here, the fault happened in the current
305 * task's user address space, so we can switch on the 315 * task's user address space, so we can switch on the
@@ -309,42 +319,26 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write)
309 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 319 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
310 down_read(&mm->mmap_sem); 320 down_read(&mm->mmap_sem);
311 321
312 si_code = SEGV_MAPERR; 322 fault = VM_FAULT_BADMAP;
313 vma = find_vma(mm, address); 323 vma = find_vma(mm, address);
314 if (!vma) 324 if (!vma)
315 goto bad_area; 325 goto out_up;
316 326
317#ifdef CONFIG_S390_EXEC_PROTECT 327 if (unlikely(vma->vm_start > address)) {
318 if (unlikely((space == 2) && !(vma->vm_flags & VM_EXEC))) 328 if (!(vma->vm_flags & VM_GROWSDOWN))
319 if (!signal_return(mm, regs, address, error_code)) 329 goto out_up;
320 /* 330 if (expand_stack(vma, address))
321 * signal_return() has done an up_read(&mm->mmap_sem) 331 goto out_up;
322 * if it returns 0.
323 */
324 return;
325#endif
326
327 if (vma->vm_start <= address)
328 goto good_area;
329 if (!(vma->vm_flags & VM_GROWSDOWN))
330 goto bad_area;
331 if (expand_stack(vma, address))
332 goto bad_area;
333/*
334 * Ok, we have a good vm_area for this memory access, so
335 * we can handle it..
336 */
337good_area:
338 si_code = SEGV_ACCERR;
339 if (!write) {
340 /* page not present, check vm flags */
341 if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
342 goto bad_area;
343 } else {
344 if (!(vma->vm_flags & VM_WRITE))
345 goto bad_area;
346 } 332 }
347 333
334 /*
335 * Ok, we have a good vm_area for this memory access, so
336 * we can handle it..
337 */
338 fault = VM_FAULT_BADACCESS;
339 if (unlikely(!(vma->vm_flags & access)))
340 goto out_up;
341
348 if (is_vm_hugetlb_page(vma)) 342 if (is_vm_hugetlb_page(vma))
349 address &= HPAGE_MASK; 343 address &= HPAGE_MASK;
350 /* 344 /*
@@ -352,18 +346,11 @@ good_area:
352 * make sure we exit gracefully rather than endlessly redo 346 * make sure we exit gracefully rather than endlessly redo
353 * the fault. 347 * the fault.
354 */ 348 */
355 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 349 fault = handle_mm_fault(mm, vma, address,
356 if (unlikely(fault & VM_FAULT_ERROR)) { 350 (access == VM_WRITE) ? FAULT_FLAG_WRITE : 0);
357 if (fault & VM_FAULT_OOM) { 351 if (unlikely(fault & VM_FAULT_ERROR))
358 up_read(&mm->mmap_sem); 352 goto out_up;
359 pagefault_out_of_memory(); 353
360 return;
361 } else if (fault & VM_FAULT_SIGBUS) {
362 do_sigbus(regs, error_code, address);
363 return;
364 }
365 BUG();
366 }
367 if (fault & VM_FAULT_MAJOR) { 354 if (fault & VM_FAULT_MAJOR) {
368 tsk->maj_flt++; 355 tsk->maj_flt++;
369 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 356 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
@@ -373,74 +360,69 @@ good_area:
373 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 360 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
374 regs, address); 361 regs, address);
375 } 362 }
376 up_read(&mm->mmap_sem);
377 /* 363 /*
378 * The instruction that caused the program check will 364 * The instruction that caused the program check will
379 * be repeated. Don't signal single step via SIGTRAP. 365 * be repeated. Don't signal single step via SIGTRAP.
380 */ 366 */
381 clear_tsk_thread_flag(tsk, TIF_SINGLE_STEP); 367 clear_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
382 return; 368 fault = 0;
383 369out_up:
384/*
385 * Something tried to access memory that isn't in our memory map..
386 * Fix it, but check if it's kernel or user first..
387 */
388bad_area:
389 up_read(&mm->mmap_sem); 370 up_read(&mm->mmap_sem);
390 371out:
391 /* User mode accesses just cause a SIGSEGV */ 372 return fault;
392 if (regs->psw.mask & PSW_MASK_PSTATE) {
393 tsk->thread.prot_addr = address;
394 tsk->thread.trap_no = error_code;
395 do_sigsegv(regs, error_code, si_code, address);
396 return;
397 }
398
399no_context:
400 do_no_context(regs, error_code, address);
401} 373}
402 374
403void __kprobes do_protection_exception(struct pt_regs *regs, 375void __kprobes do_protection_exception(struct pt_regs *regs, long int_code)
404 long error_code)
405{ 376{
377 unsigned long trans_exc_code = S390_lowcore.trans_exc_code;
378 int fault;
379
406 /* Protection exception is supressing, decrement psw address. */ 380 /* Protection exception is supressing, decrement psw address. */
407 regs->psw.addr -= (error_code >> 16); 381 regs->psw.addr -= (int_code >> 16);
408 /* 382 /*
409 * Check for low-address protection. This needs to be treated 383 * Check for low-address protection. This needs to be treated
410 * as a special case because the translation exception code 384 * as a special case because the translation exception code
411 * field is not guaranteed to contain valid data in this case. 385 * field is not guaranteed to contain valid data in this case.
412 */ 386 */
413 if (unlikely(!(S390_lowcore.trans_exc_code & 4))) { 387 if (unlikely(!(trans_exc_code & 4))) {
414 do_low_address(regs, error_code); 388 do_low_address(regs, int_code, trans_exc_code);
415 return; 389 return;
416 } 390 }
417 do_exception(regs, 4, 1); 391 fault = do_exception(regs, VM_WRITE, trans_exc_code);
392 if (unlikely(fault))
393 do_fault_error(regs, 4, trans_exc_code, fault);
418} 394}
419 395
420void __kprobes do_dat_exception(struct pt_regs *regs, long error_code) 396void __kprobes do_dat_exception(struct pt_regs *regs, long int_code)
421{ 397{
422 do_exception(regs, error_code & 0xff, 0); 398 unsigned long trans_exc_code = S390_lowcore.trans_exc_code;
399 int access, fault;
400
401 access = VM_READ | VM_EXEC | VM_WRITE;
402#ifdef CONFIG_S390_EXEC_PROTECT
403 if ((regs->psw.mask & PSW_MASK_ASC) == PSW_ASC_SECONDARY &&
404 (trans_exc_code & 3) == 0)
405 access = VM_EXEC;
406#endif
407 fault = do_exception(regs, access, trans_exc_code);
408 if (unlikely(fault))
409 do_fault_error(regs, int_code & 255, trans_exc_code, fault);
423} 410}
424 411
425#ifdef CONFIG_64BIT 412#ifdef CONFIG_64BIT
426void __kprobes do_asce_exception(struct pt_regs *regs, unsigned long error_code) 413void __kprobes do_asce_exception(struct pt_regs *regs, long int_code)
427{ 414{
428 struct mm_struct *mm; 415 unsigned long trans_exc_code = S390_lowcore.trans_exc_code;
416 struct mm_struct *mm = current->mm;
429 struct vm_area_struct *vma; 417 struct vm_area_struct *vma;
430 unsigned long address;
431 int space;
432
433 mm = current->mm;
434 address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK;
435 space = check_space(current);
436 418
437 if (unlikely(space == 0 || in_atomic() || !mm)) 419 if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm))
438 goto no_context; 420 goto no_context;
439 421
440 local_irq_enable(); 422 local_irq_enable();
441 423
442 down_read(&mm->mmap_sem); 424 down_read(&mm->mmap_sem);
443 vma = find_vma(mm, address); 425 vma = find_vma(mm, trans_exc_code & __FAIL_ADDR_MASK);
444 up_read(&mm->mmap_sem); 426 up_read(&mm->mmap_sem);
445 427
446 if (vma) { 428 if (vma) {
@@ -450,17 +432,38 @@ void __kprobes do_asce_exception(struct pt_regs *regs, unsigned long error_code)
450 432
451 /* User mode accesses just cause a SIGSEGV */ 433 /* User mode accesses just cause a SIGSEGV */
452 if (regs->psw.mask & PSW_MASK_PSTATE) { 434 if (regs->psw.mask & PSW_MASK_PSTATE) {
453 current->thread.prot_addr = address; 435 do_sigsegv(regs, int_code, SEGV_MAPERR, trans_exc_code);
454 current->thread.trap_no = error_code;
455 do_sigsegv(regs, error_code, SEGV_MAPERR, address);
456 return; 436 return;
457 } 437 }
458 438
459no_context: 439no_context:
460 do_no_context(regs, error_code, address); 440 do_no_context(regs, int_code, trans_exc_code);
461} 441}
462#endif 442#endif
463 443
444int __handle_fault(unsigned long uaddr, unsigned long int_code, int write_user)
445{
446 struct pt_regs regs;
447 int access, fault;
448
449 regs.psw.mask = psw_kernel_bits;
450 if (!irqs_disabled())
451 regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT;
452 regs.psw.addr = (unsigned long) __builtin_return_address(0);
453 regs.psw.addr |= PSW_ADDR_AMODE;
454 uaddr &= PAGE_MASK;
455 access = write_user ? VM_WRITE : VM_READ;
456 fault = do_exception(&regs, access, uaddr | 2);
457 if (unlikely(fault)) {
458 if (fault & VM_FAULT_OOM) {
459 pagefault_out_of_memory();
460 fault = 0;
461 } else if (fault & VM_FAULT_SIGBUS)
462 do_sigbus(&regs, int_code, uaddr);
463 }
464 return fault ? -EFAULT : 0;
465}
466
464#ifdef CONFIG_PFAULT 467#ifdef CONFIG_PFAULT
465/* 468/*
466 * 'pfault' pseudo page faults routines. 469 * 'pfault' pseudo page faults routines.
@@ -522,7 +525,7 @@ void pfault_fini(void)
522 : : "a" (&refbk), "m" (refbk) : "cc"); 525 : : "a" (&refbk), "m" (refbk) : "cc");
523} 526}
524 527
525static void pfault_interrupt(__u16 error_code) 528static void pfault_interrupt(__u16 int_code)
526{ 529{
527 struct task_struct *tsk; 530 struct task_struct *tsk;
528 __u16 subcode; 531 __u16 subcode;
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 765647952221..acc91c75bc94 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -26,6 +26,7 @@
26#include <linux/pfn.h> 26#include <linux/pfn.h>
27#include <linux/poison.h> 27#include <linux/poison.h>
28#include <linux/initrd.h> 28#include <linux/initrd.h>
29#include <linux/gfp.h>
29#include <asm/processor.h> 30#include <asm/processor.h>
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
@@ -143,33 +144,34 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
143} 144}
144#endif 145#endif
145 146
146void free_initmem(void) 147void free_init_pages(char *what, unsigned long begin, unsigned long end)
147{ 148{
148 unsigned long addr; 149 unsigned long addr = begin;
149 150
150 addr = (unsigned long)(&__init_begin); 151 if (begin >= end)
151 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 152 return;
153 for (; addr < end; addr += PAGE_SIZE) {
152 ClearPageReserved(virt_to_page(addr)); 154 ClearPageReserved(virt_to_page(addr));
153 init_page_count(virt_to_page(addr)); 155 init_page_count(virt_to_page(addr));
154 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 156 memset((void *)(addr & PAGE_MASK), POISON_FREE_INITMEM,
157 PAGE_SIZE);
155 free_page(addr); 158 free_page(addr);
156 totalram_pages++; 159 totalram_pages++;
157 } 160 }
158 printk ("Freeing unused kernel memory: %ldk freed\n", 161 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
159 ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10); 162}
163
164void free_initmem(void)
165{
166 free_init_pages("unused kernel memory",
167 (unsigned long)&__init_begin,
168 (unsigned long)&__init_end);
160} 169}
161 170
162#ifdef CONFIG_BLK_DEV_INITRD 171#ifdef CONFIG_BLK_DEV_INITRD
163void free_initrd_mem(unsigned long start, unsigned long end) 172void free_initrd_mem(unsigned long start, unsigned long end)
164{ 173{
165 if (start < end) 174 free_init_pages("initrd memory", start, end);
166 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
167 for (; start < end; start += PAGE_SIZE) {
168 ClearPageReserved(virt_to_page(start));
169 init_page_count(virt_to_page(start));
170 free_page(start);
171 totalram_pages++;
172 }
173} 175}
174#endif 176#endif
175 177
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 81756271dc44..a8c2af8c650f 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -59,3 +59,29 @@ long probe_kernel_write(void *dst, void *src, size_t size)
59 } 59 }
60 return copied < 0 ? -EFAULT : 0; 60 return copied < 0 ? -EFAULT : 0;
61} 61}
62
63int memcpy_real(void *dest, void *src, size_t count)
64{
65 register unsigned long _dest asm("2") = (unsigned long) dest;
66 register unsigned long _len1 asm("3") = (unsigned long) count;
67 register unsigned long _src asm("4") = (unsigned long) src;
68 register unsigned long _len2 asm("5") = (unsigned long) count;
69 unsigned long flags;
70 int rc = -EFAULT;
71
72 if (!count)
73 return 0;
74 flags = __raw_local_irq_stnsm(0xf8UL);
75 asm volatile (
76 "0: mvcle %1,%2,0x0\n"
77 "1: jo 0b\n"
78 " lhi %0,0x0\n"
79 "2:\n"
80 EX_TABLE(1b,2b)
81 : "+d" (rc), "+d" (_dest), "+d" (_src), "+d" (_len1),
82 "+d" (_len2), "=m" (*((long *) dest))
83 : "m" (*((long *) src))
84 : "cc", "memory");
85 __raw_local_irq_ssm(flags);
86 return rc;
87}
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index f4558ccf02b9..869efbaed3ea 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -40,7 +40,7 @@
40 40
41static inline unsigned long mmap_base(void) 41static inline unsigned long mmap_base(void)
42{ 42{
43 unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; 43 unsigned long gap = rlimit(RLIMIT_STACK);
44 44
45 if (gap < MIN_GAP) 45 if (gap < MIN_GAP)
46 gap = MIN_GAP; 46 gap = MIN_GAP;
@@ -61,7 +61,7 @@ static inline int mmap_is_legacy(void)
61#endif 61#endif
62 return sysctl_legacy_va_layout || 62 return sysctl_legacy_va_layout ||
63 (current->personality & ADDR_COMPAT_LAYOUT) || 63 (current->personality & ADDR_COMPAT_LAYOUT) ||
64 current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; 64 rlimit(RLIMIT_STACK) == RLIM_INFINITY;
65} 65}
66 66
67#ifndef CONFIG_64BIT 67#ifndef CONFIG_64BIT
diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c
index 098923ae458f..a90d45e9dfb0 100644
--- a/arch/s390/mm/page-states.c
+++ b/arch/s390/mm/page-states.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/gfp.h>
13#include <linux/init.h> 14#include <linux/init.h>
14 15
15#define ESSA_SET_STABLE 1 16#define ESSA_SET_STABLE 1
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 2757c5616a07..8d999249d357 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -6,11 +6,11 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/gfp.h>
9#include <linux/mm.h> 10#include <linux/mm.h>
10#include <linux/swap.h> 11#include <linux/swap.h>
11#include <linux/smp.h> 12#include <linux/smp.h>
12#include <linux/highmem.h> 13#include <linux/highmem.h>
13#include <linux/slab.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/module.h> 16#include <linux/module.h>
@@ -269,7 +269,7 @@ int s390_enable_sie(void)
269 struct mm_struct *mm, *old_mm; 269 struct mm_struct *mm, *old_mm;
270 270
271 /* Do we have switched amode? If no, we cannot do sie */ 271 /* Do we have switched amode? If no, we cannot do sie */
272 if (!switch_amode) 272 if (user_mode == HOME_SPACE_MODE)
273 return -EINVAL; 273 return -EINVAL;
274 274
275 /* Do we have pgstes? if yes, we are done */ 275 /* Do we have pgstes? if yes, we are done */
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 5f91a38d7592..90165e7ca04e 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/hugetlb.h> 13#include <linux/hugetlb.h>
14#include <linux/slab.h>
14#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16#include <asm/setup.h> 17#include <asm/setup.h>