aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2010-02-26 16:37:53 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-02-26 16:37:33 -0500
commit1844c9bc0b2fed3023551c1affe033ab38e90b9a (patch)
treeb9aca066ec58a0b211a4931032b74093fdb6ff49 /arch/s390
parent73bfa5f2f71efcdcaad8d18cbed96b9d7ed86948 (diff)
[S390] add support for compressed kernels
Add the "bzImage" compile target and the necessary code to generate compressed kernel images. The old style uncompressed "image" target is preserved, a simple make will build them both. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/Makefile13
-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/defconfig7
-rw-r--r--arch/s390/kernel/Makefile1
-rw-r--r--arch/s390/kernel/head.S41
-rw-r--r--arch/s390/kernel/head31.S16
-rw-r--r--arch/s390/kernel/head64.S24
-rw-r--r--arch/s390/kernel/sclp.S36
15 files changed, 488 insertions, 43 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 40334872f5ea..19deda8d8875 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -98,6 +98,9 @@ config S390
98 select HAVE_ARCH_TRACEHOOK 98 select HAVE_ARCH_TRACEHOOK
99 select INIT_ALL_POSSIBLE 99 select INIT_ALL_POSSIBLE
100 select HAVE_PERF_EVENTS 100 select HAVE_PERF_EVENTS
101 select HAVE_KERNEL_GZIP
102 select HAVE_KERNEL_BZIP2
103 select HAVE_KERNEL_LZMA
101 select ARCH_INLINE_SPIN_TRYLOCK 104 select ARCH_INLINE_SPIN_TRYLOCK
102 select ARCH_INLINE_SPIN_TRYLOCK_BH 105 select ARCH_INLINE_SPIN_TRYLOCK_BH
103 select ARCH_INLINE_SPIN_LOCK 106 select ARCH_INLINE_SPIN_LOCK
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/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..a97d69525829
--- /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 int _text;
28extern int _end;
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 free_mem_ptr = (unsigned long)&_end;
133 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
134 output = (unsigned char *) ((free_mem_end_ptr + 4095UL) & -4096UL);
135
136 check_ipl_parmblock((void *) 0, (unsigned long) output + SZ__bss_start);
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/defconfig b/arch/s390/defconfig
index b416aa11b91e..7ae71cc56973 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -36,6 +36,13 @@ CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32 36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION="" 37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y 38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_HAVE_KERNEL_GZIP=y
40CONFIG_HAVE_KERNEL_BZIP2=y
41CONFIG_HAVE_KERNEL_LZMA=y
42CONFIG_KERNEL_GZIP=y
43# CONFIG_KERNEL_BZIP2 is not set
44# CONFIG_KERNEL_LZMA is not set
45# CONFIG_KERNEL_LZO is not set
39CONFIG_SWAP=y 46CONFIG_SWAP=y
40CONFIG_SYSVIPC=y 47CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y 48CONFIG_SYSVIPC_SYSCTL=y
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 20f861256774..64230bc392fa 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -29,6 +29,7 @@ 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
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 1fb59055c7ca..ca4a62bd862f 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,11 +22,9 @@
22 */ 22 */
23 23
24#include <linux/init.h> 24#include <linux/init.h>
25#include <asm/setup.h>
26#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
27#include <asm/thread_info.h> 26#include <asm/thread_info.h>
28#include <asm/page.h> 27#include <asm/page.h>
29#include <asm/cpu.h>
30 28
31#ifdef CONFIG_64BIT 29#ifdef CONFIG_64BIT
32#define ARCH_OFFSET 4 30#define ARCH_OFFSET 4
@@ -450,16 +448,15 @@ start:
450# or linload or SALIPL 448# or linload or SALIPL
451# 449#
452 .org 0x10000 450 .org 0x10000
453startup:basr %r13,0 # get base 451 .globl startup
452startup:
453 basr %r13,0 # get base
454.LPG0: 454.LPG0:
455 xc 0x200(256),0x200 # partially clear lowcore 455 xc 0x200(256),0x200 # partially clear lowcore
456 xc 0x300(256),0x300 456 xc 0x300(256),0x300
457 l %r1,5f-.LPG0(%r13) 457 stck __LC_LAST_UPDATE_CLOCK
458 stck 0(%r1) 458 spt 5f-.LPG0(%r13)
459 spt 6f-.LPG0(%r13) 459 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
460 mvc __LC_LAST_UPDATE_CLOCK(8),0(%r1)
461 mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
462 mvc __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
463#ifndef CONFIG_MARCH_G5 460#ifndef CONFIG_MARCH_G5
464 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 461 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
465 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST 462 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
@@ -477,7 +474,6 @@ startup:basr %r13,0 # get base
477 cl %r0,2f+12-.LPG0(%r13) 474 cl %r0,2f+12-.LPG0(%r13)
478 je 3f 475 je 3f
4791: l %r15,.Lstack-.LPG0(%r13) 4761: l %r15,.Lstack-.LPG0(%r13)
480 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
481 ahi %r15,-96 477 ahi %r15,-96
482 la %r2,.Lals_string-.LPG0(%r13) 478 la %r2,.Lals_string-.LPG0(%r13)
483 l %r3,.Lsclp_print-.LPG0(%r13) 479 l %r3,.Lsclp_print-.LPG0(%r13)
@@ -488,7 +484,7 @@ startup:basr %r13,0 # get base
488.Lsclp_print: 484.Lsclp_print:
489 .long _sclp_print_early 485 .long _sclp_print_early
490.Lstack: 486.Lstack:
491 .long init_thread_union 487 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
492 .align 16 488 .align 16
4932: .long 0x000a0000,0x8badcccc 4892: .long 0x000a0000,0x8badcccc
494#if defined(CONFIG_64BIT) 490#if defined(CONFIG_64BIT)
@@ -515,13 +511,22 @@ startup:basr %r13,0 # get base
5153: 5113:
516#endif 512#endif
517 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 jg startup_continue
521#else
522 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
518 l %r13,4f-.LPG0(%r13) 523 l %r13,4f-.LPG0(%r13)
519 b 0(%r13) 524 b 0(%r13)
520 .align 4 525 .align 8
5214: .long startup_continue 5264: .long startup_continue
5225: .long sched_clock_base_cc 527#endif
523 .align 8 528 .align 8
5246: .long 0x7fffffff,0xffffffff 5295: .long 0x7fffffff,0xffffffff
525 530
526# 531#
527# params at 10400 (setup.h) 532# params at 10400 (setup.h)
@@ -535,8 +540,4 @@ startup:basr %r13,0 # get base
535 .byte "root=/dev/ram0 ro" 540 .byte "root=/dev/ram0 ro"
536 .byte 0 541 .byte 0
537 542
538#ifdef CONFIG_64BIT 543 .org 0x11000
539#include "head64.S"
540#else
541#include "head31.S"
542#endif
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index 602b508cd4c4..1bbcc499d455 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,10 +75,12 @@ 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
78#endif 86#endif
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 5419aabf8a66..39580e768658 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,18 +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 mvi __LC_AR_MODE_ID,1 # set esame flag
20 slr %r0,%r0 # set cpuid to zero
21 lhi %r1,2 # mode 2 = esame (dump)
22 sigp %r1,%r0,0x12 # switch to esame mode
23 sam64 # switch to 64 bit mode
24 llgfr %r13,%r13 # clear high-order half of base reg
25 lmh %r0,%r15,.Lzero64-.LPG1(%r13) # clear high-order half 24 lmh %r0,%r15,.Lzero64-.LPG1(%r13) # clear high-order half
26 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 25 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
27 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 26 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
@@ -46,6 +45,7 @@ startup_continue:
46 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, 45 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
47 # virtual and never return ... 46 # virtual and never return ...
48 .align 16 47 .align 16
48.LPG1:
49.Lentry:.quad 0x0000000180000000,_stext 49.Lentry:.quad 0x0000000180000000,_stext
50.Lctl: .quad 0x04350002 # cr0: various things 50.Lctl: .quad 0x04350002 # cr0: various things
51 .quad 0 # cr1: primary space segment table 51 .quad 0 # cr1: primary space segment table
@@ -78,9 +78,9 @@ startup_continue:
78 .long 0x80000000,0,0,0 # invalid access-list entries 78 .long 0x80000000,0,0,0 # invalid access-list entries
79 .endr 79 .endr
80 80
81 .org 0x12000
82 .globl _ehead 81 .globl _ehead
83_ehead: 82_ehead:
83
84#ifdef CONFIG_SHARED_KERNEL 84#ifdef CONFIG_SHARED_KERNEL
85 .org 0x100000 85 .org 0x100000
86#endif 86#endif
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index e27ca63076d1..27af3bf3a009 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:
@@ -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