aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:38:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:38:30 -0400
commitd67c6f869c0a7f275689855161c93d714197e052 (patch)
tree17024af84087d216c62144d21a41beb74eca80dc /arch/s390
parentec31b2124158f60c515ed84bd5e40db1a883c7b6 (diff)
parent1175cdc670f2d4197b033f823b32435031a6daa8 (diff)
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: [S390] Update default configuration. [S390] use generic sys_ptrace [S390] Remove self ptrace IEEE_IP hack. [S390] Convert to SPARSEMEM & SPARSEMEM_VMEMMAP [S390] System z large page support. [S390] Convert machine feature detection code to C. [S390] vmemmap: use clear_table to initialise page tables. [S390] Move stfl to system.h and delete duplicated version. [S390] uaccess_mvcos: #ifdef config dependent code. [S390] cpu topology: Fix possible deadlock. [S390] Add topology_core_siblings to topology.h [S390] cio: Make isc handling more robust. [S390] remove -traditional [S390] Automatically detect added cpus. [S390] smp: Fix locking order. [S390] Add missing ifndef/define to include/asm-s390/sysinfo.h. [S390] Move show_regs to traps.c. [S390] cio: Use strict_strtoul() for attributes.
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig8
-rw-r--r--arch/s390/defconfig141
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/early.c125
-rw-r--r--arch/s390/kernel/head31.S61
-rw-r--r--arch/s390/kernel/head64.S64
-rw-r--r--arch/s390/kernel/process.c18
-rw-r--r--arch/s390/kernel/ptrace.c57
-rw-r--r--arch/s390/kernel/setup.c21
-rw-r--r--arch/s390/kernel/smp.c31
-rw-r--r--arch/s390/kernel/topology.c35
-rw-r--r--arch/s390/kernel/traps.c26
-rw-r--r--arch/s390/kvm/priv.c11
-rw-r--r--arch/s390/lib/Makefile2
-rw-r--r--arch/s390/lib/uaccess_mvcos.c2
-rw-r--r--arch/s390/math-emu/Makefile1
-rw-r--r--arch/s390/mm/Makefile2
-rw-r--r--arch/s390/mm/extmem.c8
-rw-r--r--arch/s390/mm/fault.c3
-rw-r--r--arch/s390/mm/hugetlbpage.c134
-rw-r--r--arch/s390/mm/init.c25
-rw-r--r--arch/s390/mm/vmem.c135
22 files changed, 513 insertions, 399 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8f5f02160ffc..29a7940f284f 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -300,6 +300,14 @@ comment "Kernel preemption"
300 300
301source "kernel/Kconfig.preempt" 301source "kernel/Kconfig.preempt"
302 302
303config ARCH_SPARSEMEM_ENABLE
304 def_bool y
305 select SPARSEMEM_VMEMMAP_ENABLE
306 select SPARSEMEM_VMEMMAP
307
308config ARCH_SPARSEMEM_DEFAULT
309 def_bool y
310
303source "mm/Kconfig" 311source "mm/Kconfig"
304 312
305comment "I/O subsystem configuration" 313comment "I/O subsystem configuration"
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index a72f208e62d0..aa341d0ea1e6 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.25-rc4 3# Linux kernel version: 2.6.25
4# Wed Mar 5 11:22:59 2008 4# Wed Apr 30 11:07:45 2008
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -14,10 +14,12 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y
14# CONFIG_ARCH_HAS_ILOG2_U64 is not set 14# CONFIG_ARCH_HAS_ILOG2_U64 is not set
15CONFIG_GENERIC_HWEIGHT=y 15CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_TIME=y 16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
17CONFIG_GENERIC_BUG=y 18CONFIG_GENERIC_BUG=y
18CONFIG_NO_IOMEM=y 19CONFIG_NO_IOMEM=y
19CONFIG_NO_DMA=y 20CONFIG_NO_DMA=y
20CONFIG_GENERIC_LOCKBREAK=y 21CONFIG_GENERIC_LOCKBREAK=y
22CONFIG_PGSTE=y
21CONFIG_S390=y 23CONFIG_S390=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 25
@@ -43,6 +45,7 @@ CONFIG_LOG_BUF_SHIFT=17
43CONFIG_CGROUPS=y 45CONFIG_CGROUPS=y
44# CONFIG_CGROUP_DEBUG is not set 46# CONFIG_CGROUP_DEBUG is not set
45CONFIG_CGROUP_NS=y 47CONFIG_CGROUP_NS=y
48# CONFIG_CGROUP_DEVICE is not set
46# CONFIG_CPUSETS is not set 49# CONFIG_CPUSETS is not set
47CONFIG_GROUP_SCHED=y 50CONFIG_GROUP_SCHED=y
48CONFIG_FAIR_GROUP_SCHED=y 51CONFIG_FAIR_GROUP_SCHED=y
@@ -65,6 +68,7 @@ CONFIG_INITRAMFS_SOURCE=""
65CONFIG_SYSCTL=y 68CONFIG_SYSCTL=y
66# CONFIG_EMBEDDED is not set 69# CONFIG_EMBEDDED is not set
67CONFIG_SYSCTL_SYSCALL=y 70CONFIG_SYSCTL_SYSCALL=y
71CONFIG_SYSCTL_SYSCALL_CHECK=y
68CONFIG_KALLSYMS=y 72CONFIG_KALLSYMS=y
69# CONFIG_KALLSYMS_ALL is not set 73# CONFIG_KALLSYMS_ALL is not set
70# CONFIG_KALLSYMS_EXTRA_PASS is not set 74# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -92,6 +96,7 @@ CONFIG_KPROBES=y
92CONFIG_KRETPROBES=y 96CONFIG_KRETPROBES=y
93CONFIG_HAVE_KPROBES=y 97CONFIG_HAVE_KPROBES=y
94CONFIG_HAVE_KRETPROBES=y 98CONFIG_HAVE_KRETPROBES=y
99# CONFIG_HAVE_DMA_ATTRS is not set
95CONFIG_PROC_PAGE_MONITOR=y 100CONFIG_PROC_PAGE_MONITOR=y
96CONFIG_SLABINFO=y 101CONFIG_SLABINFO=y
97CONFIG_RT_MUTEXES=y 102CONFIG_RT_MUTEXES=y
@@ -121,8 +126,8 @@ CONFIG_DEFAULT_DEADLINE=y
121# CONFIG_DEFAULT_CFQ is not set 126# CONFIG_DEFAULT_CFQ is not set
122# CONFIG_DEFAULT_NOOP is not set 127# CONFIG_DEFAULT_NOOP is not set
123CONFIG_DEFAULT_IOSCHED="deadline" 128CONFIG_DEFAULT_IOSCHED="deadline"
129CONFIG_PREEMPT_NOTIFIERS=y
124CONFIG_CLASSIC_RCU=y 130CONFIG_CLASSIC_RCU=y
125# CONFIG_PREEMPT_RCU is not set
126 131
127# 132#
128# Base setup 133# Base setup
@@ -131,6 +136,10 @@ CONFIG_CLASSIC_RCU=y
131# 136#
132# Processor type and features 137# Processor type and features
133# 138#
139CONFIG_TICK_ONESHOT=y
140CONFIG_NO_HZ=y
141CONFIG_HIGH_RES_TIMERS=y
142CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
134CONFIG_64BIT=y 143CONFIG_64BIT=y
135CONFIG_SMP=y 144CONFIG_SMP=y
136CONFIG_NR_CPUS=32 145CONFIG_NR_CPUS=32
@@ -161,15 +170,20 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
161# CONFIG_PREEMPT_NONE is not set 170# CONFIG_PREEMPT_NONE is not set
162# CONFIG_PREEMPT_VOLUNTARY is not set 171# CONFIG_PREEMPT_VOLUNTARY is not set
163CONFIG_PREEMPT=y 172CONFIG_PREEMPT=y
164# CONFIG_RCU_TRACE is not set 173# CONFIG_PREEMPT_RCU is not set
174CONFIG_ARCH_SPARSEMEM_ENABLE=y
175CONFIG_ARCH_SPARSEMEM_DEFAULT=y
165CONFIG_SELECT_MEMORY_MODEL=y 176CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 177# CONFIG_FLATMEM_MANUAL is not set
167# CONFIG_DISCONTIGMEM_MANUAL is not set 178# CONFIG_DISCONTIGMEM_MANUAL is not set
168# CONFIG_SPARSEMEM_MANUAL is not set 179CONFIG_SPARSEMEM_MANUAL=y
169CONFIG_FLATMEM=y 180CONFIG_SPARSEMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 181CONFIG_HAVE_MEMORY_PRESENT=y
171# CONFIG_SPARSEMEM_STATIC is not set 182# CONFIG_SPARSEMEM_STATIC is not set
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 183CONFIG_SPARSEMEM_EXTREME=y
184CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
185CONFIG_SPARSEMEM_VMEMMAP=y
186CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 187CONFIG_SPLIT_PTLOCK_CPUS=4
174CONFIG_RESOURCES_64BIT=y 188CONFIG_RESOURCES_64BIT=y
175CONFIG_ZONE_DMA_FLAG=1 189CONFIG_ZONE_DMA_FLAG=1
@@ -205,11 +219,10 @@ CONFIG_HZ_100=y
205# CONFIG_HZ_1000 is not set 219# CONFIG_HZ_1000 is not set
206CONFIG_HZ=100 220CONFIG_HZ=100
207# CONFIG_SCHED_HRTICK is not set 221# CONFIG_SCHED_HRTICK is not set
208CONFIG_NO_IDLE_HZ=y
209CONFIG_NO_IDLE_HZ_INIT=y
210CONFIG_S390_HYPFS_FS=y 222CONFIG_S390_HYPFS_FS=y
211CONFIG_KEXEC=y 223CONFIG_KEXEC=y
212# CONFIG_ZFCPDUMP is not set 224# CONFIG_ZFCPDUMP is not set
225CONFIG_S390_GUEST=y
213 226
214# 227#
215# Networking 228# Networking
@@ -272,8 +285,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
272CONFIG_INET6_XFRM_MODE_BEET=y 285CONFIG_INET6_XFRM_MODE_BEET=y
273# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 286# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
274CONFIG_IPV6_SIT=y 287CONFIG_IPV6_SIT=y
288CONFIG_IPV6_NDISC_NODETYPE=y
275# CONFIG_IPV6_TUNNEL is not set 289# CONFIG_IPV6_TUNNEL is not set
276# CONFIG_IPV6_MULTIPLE_TABLES is not set 290# CONFIG_IPV6_MULTIPLE_TABLES is not set
291# CONFIG_IPV6_MROUTE is not set
277# CONFIG_NETWORK_SECMARK is not set 292# CONFIG_NETWORK_SECMARK is not set
278CONFIG_NETFILTER=y 293CONFIG_NETFILTER=y
279# CONFIG_NETFILTER_DEBUG is not set 294# CONFIG_NETFILTER_DEBUG is not set
@@ -289,6 +304,7 @@ CONFIG_NF_CONNTRACK=m
289# CONFIG_NF_CT_ACCT is not set 304# CONFIG_NF_CT_ACCT is not set
290# CONFIG_NF_CONNTRACK_MARK is not set 305# CONFIG_NF_CONNTRACK_MARK is not set
291# CONFIG_NF_CONNTRACK_EVENTS is not set 306# CONFIG_NF_CONNTRACK_EVENTS is not set
307# CONFIG_NF_CT_PROTO_DCCP is not set
292# CONFIG_NF_CT_PROTO_SCTP is not set 308# CONFIG_NF_CT_PROTO_SCTP is not set
293# CONFIG_NF_CT_PROTO_UDPLITE is not set 309# CONFIG_NF_CT_PROTO_UDPLITE is not set
294# CONFIG_NF_CONNTRACK_AMANDA is not set 310# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -439,6 +455,7 @@ CONFIG_DASD_ECKD=y
439CONFIG_DASD_FBA=y 455CONFIG_DASD_FBA=y
440CONFIG_DASD_DIAG=y 456CONFIG_DASD_DIAG=y
441CONFIG_DASD_EER=y 457CONFIG_DASD_EER=y
458CONFIG_VIRTIO_BLK=m
442CONFIG_MISC_DEVICES=y 459CONFIG_MISC_DEVICES=y
443# CONFIG_EEPROM_93CX6 is not set 460# CONFIG_EEPROM_93CX6 is not set
444# CONFIG_ENCLOSURE_SERVICES is not set 461# CONFIG_ENCLOSURE_SERVICES is not set
@@ -533,7 +550,7 @@ CONFIG_NETDEV_10000=y
533# S/390 network device drivers 550# S/390 network device drivers
534# 551#
535CONFIG_LCS=m 552CONFIG_LCS=m
536CONFIG_CTC=m 553CONFIG_CTCM=m
537# CONFIG_NETIUCV is not set 554# CONFIG_NETIUCV is not set
538# CONFIG_SMSGIUCV is not set 555# CONFIG_SMSGIUCV is not set
539# CONFIG_CLAW is not set 556# CONFIG_CLAW is not set
@@ -547,10 +564,12 @@ CONFIG_CCWGROUP=y
547# CONFIG_NETCONSOLE is not set 564# CONFIG_NETCONSOLE is not set
548# CONFIG_NETPOLL is not set 565# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set 566# CONFIG_NET_POLL_CONTROLLER is not set
567CONFIG_VIRTIO_NET=m
550 568
551# 569#
552# Character devices 570# Character devices
553# 571#
572CONFIG_DEVKMEM=y
554CONFIG_UNIX98_PTYS=y 573CONFIG_UNIX98_PTYS=y
555CONFIG_LEGACY_PTYS=y 574CONFIG_LEGACY_PTYS=y
556CONFIG_LEGACY_PTY_COUNT=256 575CONFIG_LEGACY_PTY_COUNT=256
@@ -600,6 +619,7 @@ CONFIG_S390_VMUR=m
600# Sonics Silicon Backplane 619# Sonics Silicon Backplane
601# 620#
602# CONFIG_MEMSTICK is not set 621# CONFIG_MEMSTICK is not set
622# CONFIG_NEW_LEDS is not set
603 623
604# 624#
605# File systems 625# File systems
@@ -652,6 +672,7 @@ CONFIG_PROC_SYSCTL=y
652CONFIG_SYSFS=y 672CONFIG_SYSFS=y
653CONFIG_TMPFS=y 673CONFIG_TMPFS=y
654CONFIG_TMPFS_POSIX_ACL=y 674CONFIG_TMPFS_POSIX_ACL=y
675# CONFIG_HUGETLBFS is not set
655# CONFIG_HUGETLB_PAGE is not set 676# CONFIG_HUGETLB_PAGE is not set
656CONFIG_CONFIGFS_FS=m 677CONFIG_CONFIGFS_FS=m
657 678
@@ -678,12 +699,10 @@ CONFIG_NFS_FS=y
678CONFIG_NFS_V3=y 699CONFIG_NFS_V3=y
679# CONFIG_NFS_V3_ACL is not set 700# CONFIG_NFS_V3_ACL is not set
680# CONFIG_NFS_V4 is not set 701# CONFIG_NFS_V4 is not set
681# CONFIG_NFS_DIRECTIO is not set
682CONFIG_NFSD=y 702CONFIG_NFSD=y
683CONFIG_NFSD_V3=y 703CONFIG_NFSD_V3=y
684# CONFIG_NFSD_V3_ACL is not set 704# CONFIG_NFSD_V3_ACL is not set
685# CONFIG_NFSD_V4 is not set 705# CONFIG_NFSD_V4 is not set
686CONFIG_NFSD_TCP=y
687CONFIG_LOCKD=y 706CONFIG_LOCKD=y
688CONFIG_LOCKD_V4=y 707CONFIG_LOCKD_V4=y
689CONFIG_EXPORTFS=y 708CONFIG_EXPORTFS=y
@@ -731,6 +750,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
731# CONFIG_PRINTK_TIME is not set 750# CONFIG_PRINTK_TIME is not set
732CONFIG_ENABLE_WARN_DEPRECATED=y 751CONFIG_ENABLE_WARN_DEPRECATED=y
733CONFIG_ENABLE_MUST_CHECK=y 752CONFIG_ENABLE_MUST_CHECK=y
753CONFIG_FRAME_WARN=2048
734CONFIG_MAGIC_SYSRQ=y 754CONFIG_MAGIC_SYSRQ=y
735# CONFIG_UNUSED_SYMBOLS is not set 755# CONFIG_UNUSED_SYMBOLS is not set
736CONFIG_DEBUG_FS=y 756CONFIG_DEBUG_FS=y
@@ -754,6 +774,7 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
754CONFIG_DEBUG_BUGVERBOSE=y 774CONFIG_DEBUG_BUGVERBOSE=y
755# CONFIG_DEBUG_INFO is not set 775# CONFIG_DEBUG_INFO is not set
756# CONFIG_DEBUG_VM is not set 776# CONFIG_DEBUG_VM is not set
777# CONFIG_DEBUG_WRITECOUNT is not set
757# CONFIG_DEBUG_LIST is not set 778# CONFIG_DEBUG_LIST is not set
758# CONFIG_DEBUG_SG is not set 779# CONFIG_DEBUG_SG is not set
759# CONFIG_FRAME_POINTER is not set 780# CONFIG_FRAME_POINTER is not set
@@ -775,58 +796,88 @@ CONFIG_SAMPLES=y
775# CONFIG_SECURITY is not set 796# CONFIG_SECURITY is not set
776# CONFIG_SECURITY_FILE_CAPABILITIES is not set 797# CONFIG_SECURITY_FILE_CAPABILITIES is not set
777CONFIG_CRYPTO=y 798CONFIG_CRYPTO=y
799
800#
801# Crypto core or helper
802#
778CONFIG_CRYPTO_ALGAPI=y 803CONFIG_CRYPTO_ALGAPI=y
779CONFIG_CRYPTO_AEAD=m 804CONFIG_CRYPTO_AEAD=m
780CONFIG_CRYPTO_BLKCIPHER=y 805CONFIG_CRYPTO_BLKCIPHER=y
781CONFIG_CRYPTO_SEQIV=m
782CONFIG_CRYPTO_HASH=m 806CONFIG_CRYPTO_HASH=m
783CONFIG_CRYPTO_MANAGER=y 807CONFIG_CRYPTO_MANAGER=y
808CONFIG_CRYPTO_GF128MUL=m
809# CONFIG_CRYPTO_NULL is not set
810# CONFIG_CRYPTO_CRYPTD is not set
811CONFIG_CRYPTO_AUTHENC=m
812# CONFIG_CRYPTO_TEST is not set
813
814#
815# Authenticated Encryption with Associated Data
816#
817CONFIG_CRYPTO_CCM=m
818CONFIG_CRYPTO_GCM=m
819CONFIG_CRYPTO_SEQIV=m
820
821#
822# Block modes
823#
824CONFIG_CRYPTO_CBC=y
825CONFIG_CRYPTO_CTR=m
826CONFIG_CRYPTO_CTS=m
827CONFIG_CRYPTO_ECB=m
828# CONFIG_CRYPTO_LRW is not set
829CONFIG_CRYPTO_PCBC=m
830# CONFIG_CRYPTO_XTS is not set
831
832#
833# Hash modes
834#
784CONFIG_CRYPTO_HMAC=m 835CONFIG_CRYPTO_HMAC=m
785# CONFIG_CRYPTO_XCBC is not set 836# CONFIG_CRYPTO_XCBC is not set
786# CONFIG_CRYPTO_NULL is not set 837
838#
839# Digest
840#
841# CONFIG_CRYPTO_CRC32C is not set
787# CONFIG_CRYPTO_MD4 is not set 842# CONFIG_CRYPTO_MD4 is not set
788CONFIG_CRYPTO_MD5=m 843CONFIG_CRYPTO_MD5=m
844# CONFIG_CRYPTO_MICHAEL_MIC is not set
789CONFIG_CRYPTO_SHA1=m 845CONFIG_CRYPTO_SHA1=m
790# CONFIG_CRYPTO_SHA256 is not set 846# CONFIG_CRYPTO_SHA256 is not set
791# CONFIG_CRYPTO_SHA512 is not set 847# CONFIG_CRYPTO_SHA512 is not set
792# CONFIG_CRYPTO_WP512 is not set
793# CONFIG_CRYPTO_TGR192 is not set 848# CONFIG_CRYPTO_TGR192 is not set
794CONFIG_CRYPTO_GF128MUL=m 849# CONFIG_CRYPTO_WP512 is not set
795CONFIG_CRYPTO_ECB=m 850
796CONFIG_CRYPTO_CBC=y 851#
797CONFIG_CRYPTO_PCBC=m 852# Ciphers
798# CONFIG_CRYPTO_LRW is not set 853#
799# CONFIG_CRYPTO_XTS is not set
800CONFIG_CRYPTO_CTR=m
801CONFIG_CRYPTO_GCM=m
802CONFIG_CRYPTO_CCM=m
803# CONFIG_CRYPTO_CRYPTD is not set
804# CONFIG_CRYPTO_DES is not set
805CONFIG_CRYPTO_FCRYPT=m
806# CONFIG_CRYPTO_BLOWFISH is not set
807# CONFIG_CRYPTO_TWOFISH is not set
808# CONFIG_CRYPTO_SERPENT is not set
809# CONFIG_CRYPTO_AES is not set 854# CONFIG_CRYPTO_AES is not set
855# CONFIG_CRYPTO_ANUBIS is not set
856# CONFIG_CRYPTO_ARC4 is not set
857# CONFIG_CRYPTO_BLOWFISH is not set
858CONFIG_CRYPTO_CAMELLIA=m
810# CONFIG_CRYPTO_CAST5 is not set 859# CONFIG_CRYPTO_CAST5 is not set
811# CONFIG_CRYPTO_CAST6 is not set 860# CONFIG_CRYPTO_CAST6 is not set
812# CONFIG_CRYPTO_TEA is not set 861# CONFIG_CRYPTO_DES is not set
813# CONFIG_CRYPTO_ARC4 is not set 862CONFIG_CRYPTO_FCRYPT=m
814# CONFIG_CRYPTO_KHAZAD is not set 863# CONFIG_CRYPTO_KHAZAD is not set
815# CONFIG_CRYPTO_ANUBIS is not set
816CONFIG_CRYPTO_SEED=m
817CONFIG_CRYPTO_SALSA20=m 864CONFIG_CRYPTO_SALSA20=m
865CONFIG_CRYPTO_SEED=m
866# CONFIG_CRYPTO_SERPENT is not set
867# CONFIG_CRYPTO_TEA is not set
868# CONFIG_CRYPTO_TWOFISH is not set
869
870#
871# Compression
872#
818# CONFIG_CRYPTO_DEFLATE is not set 873# CONFIG_CRYPTO_DEFLATE is not set
819# CONFIG_CRYPTO_MICHAEL_MIC is not set
820# CONFIG_CRYPTO_CRC32C is not set
821CONFIG_CRYPTO_CAMELLIA=m
822# CONFIG_CRYPTO_TEST is not set
823CONFIG_CRYPTO_AUTHENC=m
824CONFIG_CRYPTO_LZO=m 874CONFIG_CRYPTO_LZO=m
825CONFIG_CRYPTO_HW=y 875CONFIG_CRYPTO_HW=y
826CONFIG_ZCRYPT=m 876CONFIG_ZCRYPT=m
827# CONFIG_ZCRYPT_MONOLITHIC is not set 877# CONFIG_ZCRYPT_MONOLITHIC is not set
828# CONFIG_CRYPTO_SHA1_S390 is not set 878# CONFIG_CRYPTO_SHA1_S390 is not set
829# CONFIG_CRYPTO_SHA256_S390 is not set 879# CONFIG_CRYPTO_SHA256_S390 is not set
880CONFIG_CRYPTO_SHA512_S390=m
830# CONFIG_CRYPTO_DES_S390 is not set 881# CONFIG_CRYPTO_DES_S390 is not set
831# CONFIG_CRYPTO_AES_S390 is not set 882# CONFIG_CRYPTO_AES_S390 is not set
832CONFIG_S390_PRNG=m 883CONFIG_S390_PRNG=m
@@ -835,6 +886,8 @@ CONFIG_S390_PRNG=m
835# Library routines 886# Library routines
836# 887#
837CONFIG_BITREVERSE=m 888CONFIG_BITREVERSE=m
889# CONFIG_GENERIC_FIND_FIRST_BIT is not set
890# CONFIG_GENERIC_FIND_NEXT_BIT is not set
838# CONFIG_CRC_CCITT is not set 891# CONFIG_CRC_CCITT is not set
839# CONFIG_CRC16 is not set 892# CONFIG_CRC16 is not set
840# CONFIG_CRC_ITU_T is not set 893# CONFIG_CRC_ITU_T is not set
@@ -844,3 +897,9 @@ CONFIG_LIBCRC32C=m
844CONFIG_LZO_COMPRESS=m 897CONFIG_LZO_COMPRESS=m
845CONFIG_LZO_DECOMPRESS=m 898CONFIG_LZO_DECOMPRESS=m
846CONFIG_PLIST=y 899CONFIG_PLIST=y
900CONFIG_HAVE_KVM=y
901CONFIG_VIRTUALIZATION=y
902CONFIG_KVM=m
903CONFIG_VIRTIO=y
904CONFIG_VIRTIO_RING=y
905CONFIG_VIRTIO_BALLOON=m
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 77051cd27925..6302f5082588 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7# 5#
8# Passing null pointers is ok for smp code, since we access the lowcore here. 6# Passing null pointers is ok for smp code, since we access the lowcore here.
9# 7#
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 68ec4083bf73..d0e09684b9ce 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -139,15 +139,15 @@ static noinline __init void detect_machine_type(void)
139 139
140 /* Running under z/VM ? */ 140 /* Running under z/VM ? */
141 if (cpuinfo->cpu_id.version == 0xff) 141 if (cpuinfo->cpu_id.version == 0xff)
142 machine_flags |= 1; 142 machine_flags |= MACHINE_FLAG_VM;
143 143
144 /* Running on a P/390 ? */ 144 /* Running on a P/390 ? */
145 if (cpuinfo->cpu_id.machine == 0x7490) 145 if (cpuinfo->cpu_id.machine == 0x7490)
146 machine_flags |= 4; 146 machine_flags |= MACHINE_FLAG_P390;
147 147
148 /* Running under KVM ? */ 148 /* Running under KVM ? */
149 if (cpuinfo->cpu_id.version == 0xfe) 149 if (cpuinfo->cpu_id.version == 0xfe)
150 machine_flags |= 64; 150 machine_flags |= MACHINE_FLAG_KVM;
151} 151}
152 152
153#ifdef CONFIG_64BIT 153#ifdef CONFIG_64BIT
@@ -268,6 +268,118 @@ static noinline __init void setup_lowcore_early(void)
268 s390_base_pgm_handler_fn = early_pgm_check_handler; 268 s390_base_pgm_handler_fn = early_pgm_check_handler;
269} 269}
270 270
271static noinline __init void setup_hpage(void)
272{
273#ifndef CONFIG_DEBUG_PAGEALLOC
274 unsigned int facilities;
275
276 facilities = stfl();
277 if (!(facilities & (1UL << 23)) || !(facilities & (1UL << 29)))
278 return;
279 machine_flags |= MACHINE_FLAG_HPAGE;
280 __ctl_set_bit(0, 23);
281#endif
282}
283
284static __init void detect_mvpg(void)
285{
286#ifndef CONFIG_64BIT
287 int rc;
288
289 asm volatile(
290 " la 0,0\n"
291 " mvpg %2,%2\n"
292 "0: la %0,0\n"
293 "1:\n"
294 EX_TABLE(0b,1b)
295 : "=d" (rc) : "0" (-EOPNOTSUPP), "a" (0) : "memory", "cc", "0");
296 if (!rc)
297 machine_flags |= MACHINE_FLAG_MVPG;
298#endif
299}
300
301static __init void detect_ieee(void)
302{
303#ifndef CONFIG_64BIT
304 int rc, tmp;
305
306 asm volatile(
307 " efpc %1,0\n"
308 "0: la %0,0\n"
309 "1:\n"
310 EX_TABLE(0b,1b)
311 : "=d" (rc), "=d" (tmp): "0" (-EOPNOTSUPP) : "cc");
312 if (!rc)
313 machine_flags |= MACHINE_FLAG_IEEE;
314#endif
315}
316
317static __init void detect_csp(void)
318{
319#ifndef CONFIG_64BIT
320 int rc;
321
322 asm volatile(
323 " la 0,0\n"
324 " la 1,0\n"
325 " la 2,4\n"
326 " csp 0,2\n"
327 "0: la %0,0\n"
328 "1:\n"
329 EX_TABLE(0b,1b)
330 : "=d" (rc) : "0" (-EOPNOTSUPP) : "cc", "0", "1", "2");
331 if (!rc)
332 machine_flags |= MACHINE_FLAG_CSP;
333#endif
334}
335
336static __init void detect_diag9c(void)
337{
338 unsigned int cpu_address;
339 int rc;
340
341 cpu_address = stap();
342 asm volatile(
343 " diag %2,0,0x9c\n"
344 "0: la %0,0\n"
345 "1:\n"
346 EX_TABLE(0b,1b)
347 : "=d" (rc) : "0" (-EOPNOTSUPP), "d" (cpu_address) : "cc");
348 if (!rc)
349 machine_flags |= MACHINE_FLAG_DIAG9C;
350}
351
352static __init void detect_diag44(void)
353{
354#ifdef CONFIG_64BIT
355 int rc;
356
357 asm volatile(
358 " diag 0,0,0x44\n"
359 "0: la %0,0\n"
360 "1:\n"
361 EX_TABLE(0b,1b)
362 : "=d" (rc) : "0" (-EOPNOTSUPP) : "cc");
363 if (!rc)
364 machine_flags |= MACHINE_FLAG_DIAG44;
365#endif
366}
367
368static __init void detect_machine_facilities(void)
369{
370#ifdef CONFIG_64BIT
371 unsigned int facilities;
372
373 facilities = stfl();
374 if (facilities & (1 << 28))
375 machine_flags |= MACHINE_FLAG_IDTE;
376 if (facilities & (1 << 23))
377 machine_flags |= MACHINE_FLAG_PFMF;
378 if (facilities & (1 << 4))
379 machine_flags |= MACHINE_FLAG_MVCOS;
380#endif
381}
382
271/* 383/*
272 * Save ipl parameters, clear bss memory, initialize storage keys 384 * Save ipl parameters, clear bss memory, initialize storage keys
273 * and create a kernel NSS at startup if the SAVESYS= parm is defined 385 * and create a kernel NSS at startup if the SAVESYS= parm is defined
@@ -285,6 +397,13 @@ void __init startup_init(void)
285 create_kernel_nss(); 397 create_kernel_nss();
286 sort_main_extable(); 398 sort_main_extable();
287 setup_lowcore_early(); 399 setup_lowcore_early();
400 detect_mvpg();
401 detect_ieee();
402 detect_csp();
403 detect_diag9c();
404 detect_diag44();
405 detect_machine_facilities();
406 setup_hpage();
288 sclp_read_info_early(); 407 sclp_read_info_early();
289 sclp_facilities_detect(); 408 sclp_facilities_detect();
290 memsize = sclp_memory_detect(); 409 memsize = sclp_memory_detect();
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index dc364c1419af..a816e2de32b9 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -57,61 +57,6 @@ startup_continue:
57# 57#
58 l %r14,.Lstartup_init-.LPG1(%r13) 58 l %r14,.Lstartup_init-.LPG1(%r13)
59 basr %r14,%r14 59 basr %r14,%r14
60
61 l %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags
62#
63# find out if we have an IEEE fpu
64#
65 mvc __LC_PGM_NEW_PSW(8),.Lpcfpu-.LPG1(%r13)
66 efpc %r0,0 # test IEEE extract fpc instruction
67 oi 3(%r12),2 # set IEEE fpu flag
68.Lchkfpu:
69
70#
71# find out if we have the CSP instruction
72#
73 mvc __LC_PGM_NEW_PSW(8),.Lpccsp-.LPG1(%r13)
74 la %r0,0
75 lr %r1,%r0
76 la %r2,4
77 csp %r0,%r2 # Test CSP instruction
78 oi 3(%r12),8 # set CSP flag
79.Lchkcsp:
80
81#
82# find out if we have the MVPG instruction
83#
84 mvc __LC_PGM_NEW_PSW(8),.Lpcmvpg-.LPG1(%r13)
85 sr %r0,%r0
86 la %r1,0
87 la %r2,0
88 mvpg %r1,%r2 # Test CSP instruction
89 oi 3(%r12),16 # set MVPG flag
90.Lchkmvpg:
91
92#
93# find out if we have the IDTE instruction
94#
95 mvc __LC_PGM_NEW_PSW(8),.Lpcidte-.LPG1(%r13)
96 .long 0xb2b10000 # store facility list
97 tm 0xc8,0x08 # check bit for clearing-by-ASCE
98 bno .Lchkidte-.LPG1(%r13)
99 lhi %r1,2094
100 lhi %r2,0
101 .long 0xb98e2001
102 oi 3(%r12),0x80 # set IDTE flag
103.Lchkidte:
104
105#
106# find out if the diag 0x9c is available
107#
108 mvc __LC_PGM_NEW_PSW(8),.Lpcdiag9c-.LPG1(%r13)
109 stap __LC_CPUID+4 # store cpu address
110 lh %r1,__LC_CPUID+4
111 diag %r1,0,0x9c # test diag 0x9c
112 oi 2(%r12),1 # set diag9c flag
113.Lchkdiag9c:
114
115 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space, 60 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space,
116 # virtual and never return ... 61 # virtual and never return ...
117 .align 8 62 .align 8
@@ -132,13 +77,7 @@ startup_continue:
132 .long 0 # cr13: home space segment table 77 .long 0 # cr13: home space segment table
133 .long 0xc0000000 # cr14: machine check handling off 78 .long 0xc0000000 # cr14: machine check handling off
134 .long 0 # cr15: linkage stack operations 79 .long 0 # cr15: linkage stack operations
135.Lpcfpu:.long 0x00080000,0x80000000 + .Lchkfpu
136.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp
137.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg
138.Lpcidte:.long 0x00080000,0x80000000 + .Lchkidte
139.Lpcdiag9c:.long 0x00080000,0x80000000 + .Lchkdiag9c
140.Lmchunk:.long memory_chunk 80.Lmchunk:.long memory_chunk
141.Lmflags:.long machine_flags
142.Lbss_bgn: .long __bss_start 81.Lbss_bgn: .long __bss_start
143.Lbss_end: .long _end 82.Lbss_end: .long _end
144.Lparmaddr: .long PARMAREA 83.Lparmaddr: .long PARMAREA
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 79dccd206a6e..1d06961e87b3 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -125,73 +125,11 @@ startup_continue:
125# and create a kernel NSS if the SAVESYS= parm is defined 125# and create a kernel NSS if the SAVESYS= parm is defined
126# 126#
127 brasl %r14,startup_init 127 brasl %r14,startup_init
128 # set program check new psw mask
129 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
130 larl %r12,machine_flags
131#
132# find out if we have the MVPG instruction
133#
134 la %r1,0f-.LPG1(%r13) # set program check address
135 stg %r1,__LC_PGM_NEW_PSW+8
136 sgr %r0,%r0
137 lghi %r1,0
138 lghi %r2,0
139 mvpg %r1,%r2 # test MVPG instruction
140 oi 7(%r12),16 # set MVPG flag
1410:
142
143#
144# find out if the diag 0x44 works in 64 bit mode
145#
146 la %r1,0f-.LPG1(%r13) # set program check address
147 stg %r1,__LC_PGM_NEW_PSW+8
148 diag 0,0,0x44 # test diag 0x44
149 oi 7(%r12),32 # set diag44 flag
1500:
151
152#
153# find out if we have the IDTE instruction
154#
155 la %r1,0f-.LPG1(%r13) # set program check address
156 stg %r1,__LC_PGM_NEW_PSW+8
157 .long 0xb2b10000 # store facility list
158 tm 0xc8,0x08 # check bit for clearing-by-ASCE
159 bno 0f-.LPG1(%r13)
160 lhi %r1,2048
161 lhi %r2,0
162 .long 0xb98e2001
163 oi 7(%r12),0x80 # set IDTE flag
1640:
165
166#
167# find out if the diag 0x9c is available
168#
169 la %r1,0f-.LPG1(%r13) # set program check address
170 stg %r1,__LC_PGM_NEW_PSW+8
171 stap __LC_CPUID+4 # store cpu address
172 lh %r1,__LC_CPUID+4
173 diag %r1,0,0x9c # test diag 0x9c
174 oi 6(%r12),1 # set diag9c flag
1750:
176
177#
178# find out if we have the MVCOS instruction
179#
180 la %r1,0f-.LPG1(%r13) # set program check address
181 stg %r1,__LC_PGM_NEW_PSW+8
182 .short 0xc800 # mvcos 0(%r0),0(%r0),%r0
183 .short 0x0000
184 .short 0x0000
1850: tm 0x8f,0x13 # special-operation exception?
186 bno 1f-.LPG1(%r13) # if yes, MVCOS is present
187 oi 6(%r12),2 # set MVCOS flag
1881:
189
190 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, 128 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
191 # virtual and never return ... 129 # virtual and never return ...
192 .align 16 130 .align 16
193.Lentry:.quad 0x0000000180000000,_stext 131.Lentry:.quad 0x0000000180000000,_stext
194.Lctl: .quad 0x04b50002 # cr0: various things 132.Lctl: .quad 0x04350002 # cr0: various things
195 .quad 0 # cr1: primary space segment table 133 .quad 0 # cr1: primary space segment table
196 .quad .Lduct # cr2: dispatchable unit control table 134 .quad .Lduct # cr2: dispatchable unit control table
197 .quad 0 # cr3: instruction authorization 135 .quad 0 # cr3: instruction authorization
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index c1aff194141d..7920861109d2 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -180,24 +180,6 @@ void cpu_idle(void)
180 } 180 }
181} 181}
182 182
183void show_regs(struct pt_regs *regs)
184{
185 print_modules();
186 printk("CPU: %d %s %s %.*s\n",
187 task_thread_info(current)->cpu, print_tainted(),
188 init_utsname()->release,
189 (int)strcspn(init_utsname()->version, " "),
190 init_utsname()->version);
191 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
192 current->comm, current->pid, current,
193 (void *) current->thread.ksp);
194 show_registers(regs);
195 /* Show stack backtrace if pt_regs is from kernel mode */
196 if (!(regs->psw.mask & PSW_MASK_PSTATE))
197 show_trace(NULL, (unsigned long *) regs->gprs[15]);
198 show_last_breaking_event(regs);
199}
200
201extern void kernel_thread_starter(void); 183extern void kernel_thread_starter(void);
202 184
203asm( 185asm(
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 58a064296987..7f4270163744 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -607,38 +607,8 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
607} 607}
608#endif 608#endif
609 609
610#define PT32_IEEE_IP 0x13c 610long arch_ptrace(struct task_struct *child, long request, long addr, long data)
611
612static int
613do_ptrace(struct task_struct *child, long request, long addr, long data)
614{ 611{
615 int ret;
616
617 if (request == PTRACE_ATTACH)
618 return ptrace_attach(child);
619
620 /*
621 * Special cases to get/store the ieee instructions pointer.
622 */
623 if (child == current) {
624 if (request == PTRACE_PEEKUSR && addr == PT_IEEE_IP)
625 return peek_user(child, addr, data);
626 if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
627 return poke_user(child, addr, data);
628#ifdef CONFIG_COMPAT
629 if (request == PTRACE_PEEKUSR &&
630 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
631 return peek_user_emu31(child, addr, data);
632 if (request == PTRACE_POKEUSR &&
633 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
634 return poke_user_emu31(child, addr, data);
635#endif
636 }
637
638 ret = ptrace_check_attach(child, request == PTRACE_KILL);
639 if (ret < 0)
640 return ret;
641
642 switch (request) { 612 switch (request) {
643 case PTRACE_SYSCALL: 613 case PTRACE_SYSCALL:
644 /* continue and stop at next (return from) syscall */ 614 /* continue and stop at next (return from) syscall */
@@ -693,31 +663,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
693 return -EIO; 663 return -EIO;
694} 664}
695 665
696asmlinkage long
697sys_ptrace(long request, long pid, long addr, long data)
698{
699 struct task_struct *child;
700 int ret;
701
702 lock_kernel();
703 if (request == PTRACE_TRACEME) {
704 ret = ptrace_traceme();
705 goto out;
706 }
707
708 child = ptrace_get_task_struct(pid);
709 if (IS_ERR(child)) {
710 ret = PTR_ERR(child);
711 goto out;
712 }
713
714 ret = do_ptrace(child, request, addr, data);
715 put_task_struct(child);
716out:
717 unlock_kernel();
718 return ret;
719}
720
721asmlinkage void 666asmlinkage void
722syscall_trace(struct pt_regs *regs, int entryexit) 667syscall_trace(struct pt_regs *regs, int entryexit)
723{ 668{
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index a9d18aafa5f4..2bc70b6e876a 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(uaccess);
73unsigned int console_mode = 0; 73unsigned int console_mode = 0;
74unsigned int console_devno = -1; 74unsigned int console_devno = -1;
75unsigned int console_irq = -1; 75unsigned int console_irq = -1;
76unsigned long machine_flags = 0; 76unsigned long machine_flags;
77unsigned long elf_hwcap = 0; 77unsigned long elf_hwcap = 0;
78char elf_platform[ELF_PLATFORM_SIZE]; 78char elf_platform[ELF_PLATFORM_SIZE];
79 79
@@ -683,15 +683,6 @@ setup_memory(void)
683#endif 683#endif
684} 684}
685 685
686static __init unsigned int stfl(void)
687{
688 asm volatile(
689 " .insn s,0xb2b10000,0(0)\n" /* stfl */
690 "0:\n"
691 EX_TABLE(0b,0b));
692 return S390_lowcore.stfl_fac_list;
693}
694
695static int __init __stfle(unsigned long long *list, int doublewords) 686static int __init __stfle(unsigned long long *list, int doublewords)
696{ 687{
697 typedef struct { unsigned long long _[doublewords]; } addrtype; 688 typedef struct { unsigned long long _[doublewords]; } addrtype;
@@ -758,6 +749,9 @@ static void __init setup_hwcaps(void)
758 elf_hwcap |= 1UL << 6; 749 elf_hwcap |= 1UL << 6;
759 } 750 }
760 751
752 if (MACHINE_HAS_HPAGE)
753 elf_hwcap |= 1UL << 7;
754
761 switch (cpuinfo->cpu_id.machine) { 755 switch (cpuinfo->cpu_id.machine) {
762 case 0x9672: 756 case 0x9672:
763#if !defined(CONFIG_64BIT) 757#if !defined(CONFIG_64BIT)
@@ -881,8 +875,9 @@ void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
881 875
882static int show_cpuinfo(struct seq_file *m, void *v) 876static int show_cpuinfo(struct seq_file *m, void *v)
883{ 877{
884 static const char *hwcap_str[7] = { 878 static const char *hwcap_str[8] = {
885 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp" 879 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
880 "edat"
886 }; 881 };
887 struct cpuinfo_S390 *cpuinfo; 882 struct cpuinfo_S390 *cpuinfo;
888 unsigned long n = (unsigned long) v - 1; 883 unsigned long n = (unsigned long) v - 1;
@@ -897,7 +892,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
897 num_online_cpus(), loops_per_jiffy/(500000/HZ), 892 num_online_cpus(), loops_per_jiffy/(500000/HZ),
898 (loops_per_jiffy/(5000/HZ))%100); 893 (loops_per_jiffy/(5000/HZ))%100);
899 seq_puts(m, "features\t: "); 894 seq_puts(m, "features\t: ");
900 for (i = 0; i < 7; i++) 895 for (i = 0; i < 8; i++)
901 if (hwcap_str[i] && (elf_hwcap & (1UL << i))) 896 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
902 seq_printf(m, "%s ", hwcap_str[i]); 897 seq_printf(m, "%s ", hwcap_str[i]);
903 seq_puts(m, "\n"); 898 seq_puts(m, "\n");
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 0dfa988c1b26..0aeb290060d9 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -505,7 +505,7 @@ out:
505 return rc; 505 return rc;
506} 506}
507 507
508static int smp_rescan_cpus(void) 508static int __smp_rescan_cpus(void)
509{ 509{
510 cpumask_t avail; 510 cpumask_t avail;
511 511
@@ -570,7 +570,7 @@ out:
570 kfree(info); 570 kfree(info);
571 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus); 571 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus);
572 get_online_cpus(); 572 get_online_cpus();
573 smp_rescan_cpus(); 573 __smp_rescan_cpus();
574 put_online_cpus(); 574 put_online_cpus();
575} 575}
576 576
@@ -890,8 +890,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
890 if (val != 0 && val != 1) 890 if (val != 0 && val != 1)
891 return -EINVAL; 891 return -EINVAL;
892 892
893 mutex_lock(&smp_cpu_state_mutex);
894 get_online_cpus(); 893 get_online_cpus();
894 mutex_lock(&smp_cpu_state_mutex);
895 rc = -EBUSY; 895 rc = -EBUSY;
896 if (cpu_online(cpu)) 896 if (cpu_online(cpu))
897 goto out; 897 goto out;
@@ -919,8 +919,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
919 break; 919 break;
920 } 920 }
921out: 921out:
922 put_online_cpus();
923 mutex_unlock(&smp_cpu_state_mutex); 922 mutex_unlock(&smp_cpu_state_mutex);
923 put_online_cpus();
924 return rc ? rc : count; 924 return rc ? rc : count;
925} 925}
926static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 926static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
@@ -1088,17 +1088,17 @@ out:
1088} 1088}
1089 1089
1090#ifdef CONFIG_HOTPLUG_CPU 1090#ifdef CONFIG_HOTPLUG_CPU
1091static ssize_t __ref rescan_store(struct sys_device *dev, 1091
1092 const char *buf, size_t count) 1092int smp_rescan_cpus(void)
1093{ 1093{
1094 cpumask_t newcpus; 1094 cpumask_t newcpus;
1095 int cpu; 1095 int cpu;
1096 int rc; 1096 int rc;
1097 1097
1098 mutex_lock(&smp_cpu_state_mutex);
1099 get_online_cpus(); 1098 get_online_cpus();
1099 mutex_lock(&smp_cpu_state_mutex);
1100 newcpus = cpu_present_map; 1100 newcpus = cpu_present_map;
1101 rc = smp_rescan_cpus(); 1101 rc = __smp_rescan_cpus();
1102 if (rc) 1102 if (rc)
1103 goto out; 1103 goto out;
1104 cpus_andnot(newcpus, cpu_present_map, newcpus); 1104 cpus_andnot(newcpus, cpu_present_map, newcpus);
@@ -1109,10 +1109,19 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
1109 } 1109 }
1110 rc = 0; 1110 rc = 0;
1111out: 1111out:
1112 put_online_cpus();
1113 mutex_unlock(&smp_cpu_state_mutex); 1112 mutex_unlock(&smp_cpu_state_mutex);
1113 put_online_cpus();
1114 if (!cpus_empty(newcpus)) 1114 if (!cpus_empty(newcpus))
1115 topology_schedule_update(); 1115 topology_schedule_update();
1116 return rc;
1117}
1118
1119static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf,
1120 size_t count)
1121{
1122 int rc;
1123
1124 rc = smp_rescan_cpus();
1116 return rc ? rc : count; 1125 return rc ? rc : count;
1117} 1126}
1118static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); 1127static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
@@ -1139,16 +1148,16 @@ static ssize_t dispatching_store(struct sys_device *dev, const char *buf,
1139 if (val != 0 && val != 1) 1148 if (val != 0 && val != 1)
1140 return -EINVAL; 1149 return -EINVAL;
1141 rc = 0; 1150 rc = 0;
1142 mutex_lock(&smp_cpu_state_mutex);
1143 get_online_cpus(); 1151 get_online_cpus();
1152 mutex_lock(&smp_cpu_state_mutex);
1144 if (cpu_management == val) 1153 if (cpu_management == val)
1145 goto out; 1154 goto out;
1146 rc = topology_set_cpu_management(val); 1155 rc = topology_set_cpu_management(val);
1147 if (!rc) 1156 if (!rc)
1148 cpu_management = val; 1157 cpu_management = val;
1149out: 1158out:
1150 put_online_cpus();
1151 mutex_unlock(&smp_cpu_state_mutex); 1159 mutex_unlock(&smp_cpu_state_mutex);
1160 put_online_cpus();
1152 return rc ? rc : count; 1161 return rc ? rc : count;
1153} 1162}
1154static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store); 1163static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 12b39b3d9c38..661a07217057 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -9,6 +9,7 @@
9#include <linux/device.h> 9#include <linux/device.h>
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/kthread.h>
12#include <linux/workqueue.h> 13#include <linux/workqueue.h>
13#include <linux/cpu.h> 14#include <linux/cpu.h>
14#include <linux/smp.h> 15#include <linux/smp.h>
@@ -66,6 +67,8 @@ static struct timer_list topology_timer;
66static void set_topology_timer(void); 67static void set_topology_timer(void);
67static DECLARE_WORK(topology_work, topology_work_fn); 68static DECLARE_WORK(topology_work, topology_work_fn);
68 69
70cpumask_t cpu_core_map[NR_CPUS];
71
69cpumask_t cpu_coregroup_map(unsigned int cpu) 72cpumask_t cpu_coregroup_map(unsigned int cpu)
70{ 73{
71 struct core_info *core = &core_info; 74 struct core_info *core = &core_info;
@@ -199,6 +202,14 @@ int topology_set_cpu_management(int fc)
199 return rc; 202 return rc;
200} 203}
201 204
205static void update_cpu_core_map(void)
206{
207 int cpu;
208
209 for_each_present_cpu(cpu)
210 cpu_core_map[cpu] = cpu_coregroup_map(cpu);
211}
212
202void arch_update_cpu_topology(void) 213void arch_update_cpu_topology(void)
203{ 214{
204 struct tl_info *info = tl_info; 215 struct tl_info *info = tl_info;
@@ -206,20 +217,33 @@ void arch_update_cpu_topology(void)
206 int cpu; 217 int cpu;
207 218
208 if (!machine_has_topology) { 219 if (!machine_has_topology) {
220 update_cpu_core_map();
209 topology_update_polarization_simple(); 221 topology_update_polarization_simple();
210 return; 222 return;
211 } 223 }
212 stsi(info, 15, 1, 2); 224 stsi(info, 15, 1, 2);
213 tl_to_cores(info); 225 tl_to_cores(info);
226 update_cpu_core_map();
214 for_each_online_cpu(cpu) { 227 for_each_online_cpu(cpu) {
215 sysdev = get_cpu_sysdev(cpu); 228 sysdev = get_cpu_sysdev(cpu);
216 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 229 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
217 } 230 }
218} 231}
219 232
220static void topology_work_fn(struct work_struct *work) 233static int topology_kthread(void *data)
221{ 234{
222 arch_reinit_sched_domains(); 235 arch_reinit_sched_domains();
236 return 0;
237}
238
239static void topology_work_fn(struct work_struct *work)
240{
241 /* We can't call arch_reinit_sched_domains() from a multi-threaded
242 * workqueue context since it may deadlock in case of cpu hotplug.
243 * So we have to create a kernel thread in order to call
244 * arch_reinit_sched_domains().
245 */
246 kthread_run(topology_kthread, NULL, "topology_update");
223} 247}
224 248
225void topology_schedule_update(void) 249void topology_schedule_update(void)
@@ -251,20 +275,23 @@ static int __init init_topology_update(void)
251{ 275{
252 int rc; 276 int rc;
253 277
278 rc = 0;
254 if (!machine_has_topology) { 279 if (!machine_has_topology) {
255 topology_update_polarization_simple(); 280 topology_update_polarization_simple();
256 return 0; 281 goto out;
257 } 282 }
258 init_timer_deferrable(&topology_timer); 283 init_timer_deferrable(&topology_timer);
259 if (machine_has_topology_irq) { 284 if (machine_has_topology_irq) {
260 rc = register_external_interrupt(0x2005, topology_interrupt); 285 rc = register_external_interrupt(0x2005, topology_interrupt);
261 if (rc) 286 if (rc)
262 return rc; 287 goto out;
263 ctl_set_bit(0, 8); 288 ctl_set_bit(0, 8);
264 } 289 }
265 else 290 else
266 set_topology_timer(); 291 set_topology_timer();
267 return 0; 292out:
293 update_cpu_core_map();
294 return rc;
268} 295}
269__initcall(init_topology_update); 296__initcall(init_topology_update);
270 297
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 57b607b61100..4584d81984c0 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -113,7 +113,7 @@ __show_trace(unsigned long sp, unsigned long low, unsigned long high)
113 } 113 }
114} 114}
115 115
116void show_trace(struct task_struct *task, unsigned long *stack) 116static void show_trace(struct task_struct *task, unsigned long *stack)
117{ 117{
118 register unsigned long __r15 asm ("15"); 118 register unsigned long __r15 asm ("15");
119 unsigned long sp; 119 unsigned long sp;
@@ -161,14 +161,14 @@ void show_stack(struct task_struct *task, unsigned long *sp)
161 show_trace(task, sp); 161 show_trace(task, sp);
162} 162}
163 163
164#ifdef CONFIG_64BIT 164static void show_last_breaking_event(struct pt_regs *regs)
165void show_last_breaking_event(struct pt_regs *regs)
166{ 165{
166#ifdef CONFIG_64BIT
167 printk("Last Breaking-Event-Address:\n"); 167 printk("Last Breaking-Event-Address:\n");
168 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN); 168 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN);
169 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN); 169 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN);
170}
171#endif 170#endif
171}
172 172
173/* 173/*
174 * The architecture-independent dump_stack generator 174 * The architecture-independent dump_stack generator
@@ -223,6 +223,24 @@ void show_registers(struct pt_regs *regs)
223 show_code(regs); 223 show_code(regs);
224} 224}
225 225
226void show_regs(struct pt_regs *regs)
227{
228 print_modules();
229 printk("CPU: %d %s %s %.*s\n",
230 task_thread_info(current)->cpu, print_tainted(),
231 init_utsname()->release,
232 (int)strcspn(init_utsname()->version, " "),
233 init_utsname()->version);
234 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
235 current->comm, current->pid, current,
236 (void *) current->thread.ksp);
237 show_registers(regs);
238 /* Show stack backtrace if pt_regs is from kernel mode */
239 if (!(regs->psw.mask & PSW_MASK_PSTATE))
240 show_trace(NULL, (unsigned long *) regs->gprs[15]);
241 show_last_breaking_event(regs);
242}
243
226/* This is called from fs/proc/array.c */ 244/* This is called from fs/proc/array.c */
227void task_show_regs(struct seq_file *m, struct task_struct *task) 245void task_show_regs(struct seq_file *m, struct task_struct *task)
228{ 246{
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 1465946325c5..c02286c6a931 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -151,18 +151,9 @@ static int handle_chsc(struct kvm_vcpu *vcpu)
151 return 0; 151 return 0;
152} 152}
153 153
154static unsigned int kvm_stfl(void)
155{
156 asm volatile(
157 " .insn s,0xb2b10000,0(0)\n" /* stfl */
158 "0:\n"
159 EX_TABLE(0b, 0b));
160 return S390_lowcore.stfl_fac_list;
161}
162
163static int handle_stfl(struct kvm_vcpu *vcpu) 154static int handle_stfl(struct kvm_vcpu *vcpu)
164{ 155{
165 unsigned int facility_list = kvm_stfl(); 156 unsigned int facility_list = stfl();
166 int rc; 157 int rc;
167 158
168 vcpu->stat.instruction_stfl++; 159 vcpu->stat.instruction_stfl++;
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 52084436ab69..ab6735df2d21 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -2,8 +2,6 @@
2# Makefile for s390-specific library files.. 2# Makefile for s390-specific library files..
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
8obj-$(CONFIG_32BIT) += div64.o qrnnd.o 6obj-$(CONFIG_32BIT) += div64.o qrnnd.o
9lib-$(CONFIG_64BIT) += uaccess_mvcos.o 7lib-$(CONFIG_64BIT) += uaccess_mvcos.o
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index 6d8772339d76..3f15aaf54855 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -162,6 +162,7 @@ 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
165static size_t strnlen_user_mvcos(size_t count, const char __user *src) 166static size_t strnlen_user_mvcos(size_t count, const char __user *src)
166{ 167{
167 char buf[256]; 168 char buf[256];
@@ -199,6 +200,7 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
199 } while ((len_str == len) && (done < count)); 200 } while ((len_str == len) && (done < count));
200 return done; 201 return done;
201} 202}
203#endif /* CONFIG_S390_SWITCH_AMODE */
202 204
203struct uaccess_ops uaccess_mvcos = { 205struct uaccess_ops uaccess_mvcos = {
204 .copy_from_user = copy_from_user_mvcos_check, 206 .copy_from_user = copy_from_user_mvcos_check,
diff --git a/arch/s390/math-emu/Makefile b/arch/s390/math-emu/Makefile
index 73b3e72efc46..c84890341052 100644
--- a/arch/s390/math-emu/Makefile
+++ b/arch/s390/math-emu/Makefile
@@ -5,4 +5,3 @@
5obj-$(CONFIG_MATHEMU) := math.o 5obj-$(CONFIG_MATHEMU) := math.o
6 6
7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w 7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w
8EXTRA_AFLAGS := -traditional
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile
index 66401930f83e..fb988a48a754 100644
--- a/arch/s390/mm/Makefile
+++ b/arch/s390/mm/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o 5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o
6obj-$(CONFIG_CMM) += cmm.o 6obj-$(CONFIG_CMM) += cmm.o
7 7obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index ed2af0a3303b..f231f5ec74b6 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -287,7 +287,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
287 if (rc < 0) 287 if (rc < 0)
288 goto out_free; 288 goto out_free;
289 289
290 rc = add_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 290 rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
291 291
292 if (rc) 292 if (rc)
293 goto out_free; 293 goto out_free;
@@ -351,7 +351,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
351 release_resource(seg->res); 351 release_resource(seg->res);
352 kfree(seg->res); 352 kfree(seg->res);
353 out_shared: 353 out_shared:
354 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 354 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
355 out_free: 355 out_free:
356 kfree(seg); 356 kfree(seg);
357 out: 357 out:
@@ -474,7 +474,7 @@ segment_modify_shared (char *name, int do_nonshared)
474 rc = 0; 474 rc = 0;
475 goto out_unlock; 475 goto out_unlock;
476 out_del: 476 out_del:
477 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 477 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
478 list_del(&seg->list); 478 list_del(&seg->list);
479 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 479 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
480 kfree(seg); 480 kfree(seg);
@@ -508,7 +508,7 @@ segment_unload(char *name)
508 goto out_unlock; 508 goto out_unlock;
509 release_resource(seg->res); 509 release_resource(seg->res);
510 kfree(seg->res); 510 kfree(seg->res);
511 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 511 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
512 list_del(&seg->list); 512 list_del(&seg->list);
513 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 513 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
514 kfree(seg); 514 kfree(seg);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 2650f46001d0..4d537205e83c 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -28,6 +28,7 @@
28#include <linux/hardirq.h> 28#include <linux/hardirq.h>
29#include <linux/kprobes.h> 29#include <linux/kprobes.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/hugetlb.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
33#include <asm/s390_ext.h> 34#include <asm/s390_ext.h>
@@ -367,6 +368,8 @@ good_area:
367 } 368 }
368 369
369survive: 370survive:
371 if (is_vm_hugetlb_page(vma))
372 address &= HPAGE_MASK;
370 /* 373 /*
371 * If for any reason at all we couldn't handle the fault, 374 * If for any reason at all we couldn't handle the fault,
372 * make sure we exit gracefully rather than endlessly redo 375 * make sure we exit gracefully rather than endlessly redo
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
new file mode 100644
index 000000000000..f4b6124fdb75
--- /dev/null
+++ b/arch/s390/mm/hugetlbpage.c
@@ -0,0 +1,134 @@
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright 2007 IBM Corp.
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#include <linux/mm.h>
9#include <linux/hugetlb.h>
10
11
12void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
13 pte_t *pteptr, pte_t pteval)
14{
15 pmd_t *pmdp = (pmd_t *) pteptr;
16 pte_t shadow_pteval = pteval;
17 unsigned long mask;
18
19 if (!MACHINE_HAS_HPAGE) {
20 pteptr = (pte_t *) pte_page(pteval)[1].index;
21 mask = pte_val(pteval) &
22 (_SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO);
23 pte_val(pteval) = (_SEGMENT_ENTRY + __pa(pteptr)) | mask;
24 if (mm->context.noexec) {
25 pteptr += PTRS_PER_PTE;
26 pte_val(shadow_pteval) =
27 (_SEGMENT_ENTRY + __pa(pteptr)) | mask;
28 }
29 }
30
31 pmd_val(*pmdp) = pte_val(pteval);
32 if (mm->context.noexec) {
33 pmdp = get_shadow_table(pmdp);
34 pmd_val(*pmdp) = pte_val(shadow_pteval);
35 }
36}
37
38int arch_prepare_hugepage(struct page *page)
39{
40 unsigned long addr = page_to_phys(page);
41 pte_t pte;
42 pte_t *ptep;
43 int i;
44
45 if (MACHINE_HAS_HPAGE)
46 return 0;
47
48 ptep = (pte_t *) pte_alloc_one(&init_mm, address);
49 if (!ptep)
50 return -ENOMEM;
51
52 pte = mk_pte(page, PAGE_RW);
53 for (i = 0; i < PTRS_PER_PTE; i++) {
54 set_pte_at(&init_mm, addr + i * PAGE_SIZE, ptep + i, pte);
55 pte_val(pte) += PAGE_SIZE;
56 }
57 page[1].index = (unsigned long) ptep;
58 return 0;
59}
60
61void arch_release_hugepage(struct page *page)
62{
63 pte_t *ptep;
64
65 if (MACHINE_HAS_HPAGE)
66 return;
67
68 ptep = (pte_t *) page[1].index;
69 if (!ptep)
70 return;
71 pte_free(&init_mm, ptep);
72 page[1].index = 0;
73}
74
75pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
76{
77 pgd_t *pgdp;
78 pud_t *pudp;
79 pmd_t *pmdp = NULL;
80
81 pgdp = pgd_offset(mm, addr);
82 pudp = pud_alloc(mm, pgdp, addr);
83 if (pudp)
84 pmdp = pmd_alloc(mm, pudp, addr);
85 return (pte_t *) pmdp;
86}
87
88pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
89{
90 pgd_t *pgdp;
91 pud_t *pudp;
92 pmd_t *pmdp = NULL;
93
94 pgdp = pgd_offset(mm, addr);
95 if (pgd_present(*pgdp)) {
96 pudp = pud_offset(pgdp, addr);
97 if (pud_present(*pudp))
98 pmdp = pmd_offset(pudp, addr);
99 }
100 return (pte_t *) pmdp;
101}
102
103int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
104{
105 return 0;
106}
107
108struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
109 int write)
110{
111 return ERR_PTR(-EINVAL);
112}
113
114int pmd_huge(pmd_t pmd)
115{
116 if (!MACHINE_HAS_HPAGE)
117 return 0;
118
119 return !!(pmd_val(pmd) & _SEGMENT_ENTRY_LARGE);
120}
121
122struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
123 pmd_t *pmdp, int write)
124{
125 struct page *page;
126
127 if (!MACHINE_HAS_HPAGE)
128 return NULL;
129
130 page = pmd_page(*pmdp);
131 if (page)
132 page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
133 return page;
134}
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 202c952a29b4..fa31de6ae97a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -77,28 +77,6 @@ void show_mem(void)
77 printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE)); 77 printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE));
78} 78}
79 79
80static void __init setup_ro_region(void)
81{
82 pgd_t *pgd;
83 pud_t *pud;
84 pmd_t *pmd;
85 pte_t *pte;
86 pte_t new_pte;
87 unsigned long address, end;
88
89 address = ((unsigned long)&_stext) & PAGE_MASK;
90 end = PFN_ALIGN((unsigned long)&_eshared);
91
92 for (; address < end; address += PAGE_SIZE) {
93 pgd = pgd_offset_k(address);
94 pud = pud_offset(pgd, address);
95 pmd = pmd_offset(pud, address);
96 pte = pte_offset_kernel(pmd, address);
97 new_pte = mk_pte_phys(address, __pgprot(_PAGE_RO));
98 *pte = new_pte;
99 }
100}
101
102/* 80/*
103 * paging_init() sets up the page tables 81 * paging_init() sets up the page tables
104 */ 82 */
@@ -121,7 +99,6 @@ void __init paging_init(void)
121 clear_table((unsigned long *) init_mm.pgd, pgd_type, 99 clear_table((unsigned long *) init_mm.pgd, pgd_type,
122 sizeof(unsigned long)*2048); 100 sizeof(unsigned long)*2048);
123 vmem_map_init(); 101 vmem_map_init();
124 setup_ro_region();
125 102
126 /* enable virtual mapping in kernel mode */ 103 /* enable virtual mapping in kernel mode */
127 __ctl_load(S390_lowcore.kernel_asce, 1, 1); 104 __ctl_load(S390_lowcore.kernel_asce, 1, 1);
@@ -129,6 +106,8 @@ void __init paging_init(void)
129 __ctl_load(S390_lowcore.kernel_asce, 13, 13); 106 __ctl_load(S390_lowcore.kernel_asce, 13, 13);
130 __raw_local_irq_ssm(ssm_mask); 107 __raw_local_irq_ssm(ssm_mask);
131 108
109 sparse_memory_present_with_active_regions(MAX_NUMNODES);
110 sparse_init();
132 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 111 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
133#ifdef CONFIG_ZONE_DMA 112#ifdef CONFIG_ZONE_DMA
134 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS); 113 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS);
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 35d90a4720fd..beccacf907f3 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -10,10 +10,12 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
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 <asm/pgalloc.h> 14#include <asm/pgalloc.h>
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include <asm/sections.h>
17 19
18static DEFINE_MUTEX(vmem_mutex); 20static DEFINE_MUTEX(vmem_mutex);
19 21
@@ -25,43 +27,6 @@ struct memory_segment {
25 27
26static LIST_HEAD(mem_segs); 28static LIST_HEAD(mem_segs);
27 29
28void __meminit memmap_init(unsigned long size, int nid, unsigned long zone,
29 unsigned long start_pfn)
30{
31 struct page *start, *end;
32 struct page *map_start, *map_end;
33 int i;
34
35 start = pfn_to_page(start_pfn);
36 end = start + size;
37
38 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
39 unsigned long cstart, cend;
40
41 cstart = PFN_DOWN(memory_chunk[i].addr);
42 cend = cstart + PFN_DOWN(memory_chunk[i].size);
43
44 map_start = mem_map + cstart;
45 map_end = mem_map + cend;
46
47 if (map_start < start)
48 map_start = start;
49 if (map_end > end)
50 map_end = end;
51
52 map_start -= ((unsigned long) map_start & (PAGE_SIZE - 1))
53 / sizeof(struct page);
54 map_end += ((PFN_ALIGN((unsigned long) map_end)
55 - (unsigned long) map_end)
56 / sizeof(struct page));
57
58 if (map_start < map_end)
59 memmap_init_zone((unsigned long)(map_end - map_start),
60 nid, zone, page_to_pfn(map_start),
61 MEMMAP_EARLY);
62 }
63}
64
65static void __ref *vmem_alloc_pages(unsigned int order) 30static void __ref *vmem_alloc_pages(unsigned int order)
66{ 31{
67 if (slab_is_available()) 32 if (slab_is_available())
@@ -77,8 +42,7 @@ static inline pud_t *vmem_pud_alloc(void)
77 pud = vmem_alloc_pages(2); 42 pud = vmem_alloc_pages(2);
78 if (!pud) 43 if (!pud)
79 return NULL; 44 return NULL;
80 pud_val(*pud) = _REGION3_ENTRY_EMPTY; 45 clear_table((unsigned long *) pud, _REGION3_ENTRY_EMPTY, PAGE_SIZE * 4);
81 memcpy(pud + 1, pud, (PTRS_PER_PUD - 1)*sizeof(pud_t));
82#endif 46#endif
83 return pud; 47 return pud;
84} 48}
@@ -91,7 +55,7 @@ static inline pmd_t *vmem_pmd_alloc(void)
91 pmd = vmem_alloc_pages(2); 55 pmd = vmem_alloc_pages(2);
92 if (!pmd) 56 if (!pmd)
93 return NULL; 57 return NULL;
94 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE*4); 58 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE * 4);
95#endif 59#endif
96 return pmd; 60 return pmd;
97} 61}
@@ -114,7 +78,7 @@ static pte_t __init_refok *vmem_pte_alloc(void)
114/* 78/*
115 * Add a physical memory range to the 1:1 mapping. 79 * Add a physical memory range to the 1:1 mapping.
116 */ 80 */
117static int vmem_add_range(unsigned long start, unsigned long size) 81static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
118{ 82{
119 unsigned long address; 83 unsigned long address;
120 pgd_t *pg_dir; 84 pgd_t *pg_dir;
@@ -141,7 +105,19 @@ static int vmem_add_range(unsigned long start, unsigned long size)
141 pud_populate_kernel(&init_mm, pu_dir, pm_dir); 105 pud_populate_kernel(&init_mm, pu_dir, pm_dir);
142 } 106 }
143 107
108 pte = mk_pte_phys(address, __pgprot(ro ? _PAGE_RO : 0));
144 pm_dir = pmd_offset(pu_dir, address); 109 pm_dir = pmd_offset(pu_dir, address);
110
111#ifdef __s390x__
112 if (MACHINE_HAS_HPAGE && !(address & ~HPAGE_MASK) &&
113 (address + HPAGE_SIZE <= start + size) &&
114 (address >= HPAGE_SIZE)) {
115 pte_val(pte) |= _SEGMENT_ENTRY_LARGE;
116 pmd_val(*pm_dir) = pte_val(pte);
117 address += HPAGE_SIZE - PAGE_SIZE;
118 continue;
119 }
120#endif
145 if (pmd_none(*pm_dir)) { 121 if (pmd_none(*pm_dir)) {
146 pt_dir = vmem_pte_alloc(); 122 pt_dir = vmem_pte_alloc();
147 if (!pt_dir) 123 if (!pt_dir)
@@ -150,7 +126,6 @@ static int vmem_add_range(unsigned long start, unsigned long size)
150 } 126 }
151 127
152 pt_dir = pte_offset_kernel(pm_dir, address); 128 pt_dir = pte_offset_kernel(pm_dir, address);
153 pte = pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL);
154 *pt_dir = pte; 129 *pt_dir = pte;
155 } 130 }
156 ret = 0; 131 ret = 0;
@@ -181,6 +156,13 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
181 pm_dir = pmd_offset(pu_dir, address); 156 pm_dir = pmd_offset(pu_dir, address);
182 if (pmd_none(*pm_dir)) 157 if (pmd_none(*pm_dir))
183 continue; 158 continue;
159
160 if (pmd_huge(*pm_dir)) {
161 pmd_clear_kernel(pm_dir);
162 address += HPAGE_SIZE - PAGE_SIZE;
163 continue;
164 }
165
184 pt_dir = pte_offset_kernel(pm_dir, address); 166 pt_dir = pte_offset_kernel(pm_dir, address);
185 *pt_dir = pte; 167 *pt_dir = pte;
186 } 168 }
@@ -190,10 +172,9 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
190/* 172/*
191 * Add a backed mem_map array to the virtual mem_map array. 173 * Add a backed mem_map array to the virtual mem_map array.
192 */ 174 */
193static int vmem_add_mem_map(unsigned long start, unsigned long size) 175int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
194{ 176{
195 unsigned long address, start_addr, end_addr; 177 unsigned long address, start_addr, end_addr;
196 struct page *map_start, *map_end;
197 pgd_t *pg_dir; 178 pgd_t *pg_dir;
198 pud_t *pu_dir; 179 pud_t *pu_dir;
199 pmd_t *pm_dir; 180 pmd_t *pm_dir;
@@ -201,11 +182,8 @@ static int vmem_add_mem_map(unsigned long start, unsigned long size)
201 pte_t pte; 182 pte_t pte;
202 int ret = -ENOMEM; 183 int ret = -ENOMEM;
203 184
204 map_start = VMEM_MAP + PFN_DOWN(start); 185 start_addr = (unsigned long) start;
205 map_end = VMEM_MAP + PFN_DOWN(start + size); 186 end_addr = (unsigned long) (start + nr);
206
207 start_addr = (unsigned long) map_start & PAGE_MASK;
208 end_addr = PFN_ALIGN((unsigned long) map_end);
209 187
210 for (address = start_addr; address < end_addr; address += PAGE_SIZE) { 188 for (address = start_addr; address < end_addr; address += PAGE_SIZE) {
211 pg_dir = pgd_offset_k(address); 189 pg_dir = pgd_offset_k(address);
@@ -249,16 +227,6 @@ out:
249 return ret; 227 return ret;
250} 228}
251 229
252static int vmem_add_mem(unsigned long start, unsigned long size)
253{
254 int ret;
255
256 ret = vmem_add_mem_map(start, size);
257 if (ret)
258 return ret;
259 return vmem_add_range(start, size);
260}
261
262/* 230/*
263 * Add memory segment to the segment list if it doesn't overlap with 231 * Add memory segment to the segment list if it doesn't overlap with
264 * an already present segment. 232 * an already present segment.
@@ -296,7 +264,7 @@ static void __remove_shared_memory(struct memory_segment *seg)
296 vmem_remove_range(seg->start, seg->size); 264 vmem_remove_range(seg->start, seg->size);
297} 265}
298 266
299int remove_shared_memory(unsigned long start, unsigned long size) 267int vmem_remove_mapping(unsigned long start, unsigned long size)
300{ 268{
301 struct memory_segment *seg; 269 struct memory_segment *seg;
302 int ret; 270 int ret;
@@ -320,11 +288,9 @@ out:
320 return ret; 288 return ret;
321} 289}
322 290
323int add_shared_memory(unsigned long start, unsigned long size) 291int vmem_add_mapping(unsigned long start, unsigned long size)
324{ 292{
325 struct memory_segment *seg; 293 struct memory_segment *seg;
326 struct page *page;
327 unsigned long pfn, num_pfn, end_pfn;
328 int ret; 294 int ret;
329 295
330 mutex_lock(&vmem_mutex); 296 mutex_lock(&vmem_mutex);
@@ -339,24 +305,9 @@ int add_shared_memory(unsigned long start, unsigned long size)
339 if (ret) 305 if (ret)
340 goto out_free; 306 goto out_free;
341 307
342 ret = vmem_add_mem(start, size); 308 ret = vmem_add_mem(start, size, 0);
343 if (ret) 309 if (ret)
344 goto out_remove; 310 goto out_remove;
345
346 pfn = PFN_DOWN(start);
347 num_pfn = PFN_DOWN(size);
348 end_pfn = pfn + num_pfn;
349
350 page = pfn_to_page(pfn);
351 memset(page, 0, num_pfn * sizeof(struct page));
352
353 for (; pfn < end_pfn; pfn++) {
354 page = pfn_to_page(pfn);
355 init_page_count(page);
356 reset_page_mapcount(page);
357 SetPageReserved(page);
358 INIT_LIST_HEAD(&page->lru);
359 }
360 goto out; 311 goto out;
361 312
362out_remove: 313out_remove:
@@ -375,14 +326,34 @@ out:
375 */ 326 */
376void __init vmem_map_init(void) 327void __init vmem_map_init(void)
377{ 328{
329 unsigned long ro_start, ro_end;
330 unsigned long start, end;
378 int i; 331 int i;
379 332
380 INIT_LIST_HEAD(&init_mm.context.crst_list); 333 INIT_LIST_HEAD(&init_mm.context.crst_list);
381 INIT_LIST_HEAD(&init_mm.context.pgtable_list); 334 INIT_LIST_HEAD(&init_mm.context.pgtable_list);
382 init_mm.context.noexec = 0; 335 init_mm.context.noexec = 0;
383 NODE_DATA(0)->node_mem_map = VMEM_MAP; 336 ro_start = ((unsigned long)&_stext) & PAGE_MASK;
384 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) 337 ro_end = PFN_ALIGN((unsigned long)&_eshared);
385 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); 338 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
339 start = memory_chunk[i].addr;
340 end = memory_chunk[i].addr + memory_chunk[i].size;
341 if (start >= ro_end || end <= ro_start)
342 vmem_add_mem(start, end - start, 0);
343 else if (start >= ro_start && end <= ro_end)
344 vmem_add_mem(start, end - start, 1);
345 else if (start >= ro_start) {
346 vmem_add_mem(start, ro_end - start, 1);
347 vmem_add_mem(ro_end, end - ro_end, 0);
348 } else if (end < ro_end) {
349 vmem_add_mem(start, ro_start - start, 0);
350 vmem_add_mem(ro_start, end - ro_start, 1);
351 } else {
352 vmem_add_mem(start, ro_start - start, 0);
353 vmem_add_mem(ro_start, ro_end - ro_start, 1);
354 vmem_add_mem(ro_end, end - ro_end, 0);
355 }
356 }
386} 357}
387 358
388/* 359/*