summaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-13 12:43:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-13 12:43:20 -0400
commit6c21e4334adaf1ea0f74349be01adddf40e36a27 (patch)
tree2fe5b781780664caaf44d1e4893662d91e725837 /arch/s390
parent16e205cf42da1f497b10a4a24f563e6c0d574eec (diff)
parent6a3d1e81a434fc311f224b8be77258bafc18ccc6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull more s390 updates from Martin Schwidefsky: "Three notable larger changes next to the usual bug fixing: - update the email addresses in MAINTAINERS for the s390 folks to use the simpler linux.ibm.com domain instead of the old linux.vnet.ibm.com - an update for the zcrypt device driver that removes some old and obsolete interfaces and add support for up to 256 crypto adapters - a rework of the IPL aka boot code" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (23 commits) s390: correct nospec auto detection init order s390/zcrypt: Support up to 256 crypto adapters. s390/zcrypt: Remove deprecated zcrypt proc interface. s390/zcrypt: Remove deprecated ioctls. s390/zcrypt: Make ap init functions static. MAINTAINERS: update s390 maintainers email addresses s390/ipl: remove reipl_method and dump_method s390/ipl: correct kdump reipl block checksum calculation s390/ipl: remove non-existing functions declaration s390: assume diag308 set always works s390/ipl: avoid adding scpdata to cmdline during ftp/dvd boot s390/ipl: correct ipl parmblock valid checks s390/ipl: rely on diag308 store to get ipl info s390/ipl: move ipl_flags to ipl.c s390/ipl: get rid of ipl_ssid and ipl_devno s390/ipl: unite diag308 and scsi boot ipl blocks s390/ipl: ensure loadparm valid flag is set s390/qdio: lock device while installing IRQ handler s390/qdio: clear intparm during shutdown s390/ccwgroup: require at least one ccw device ...
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/boot/compressed/misc.c23
-rw-r--r--arch/s390/crypto/aes_s390.c8
-rw-r--r--arch/s390/crypto/paes_s390.c8
-rw-r--r--arch/s390/include/asm/ap.h6
-rw-r--r--arch/s390/include/asm/cio.h10
-rw-r--r--arch/s390/include/asm/ipl.h25
-rw-r--r--arch/s390/include/asm/nospec-branch.h1
-rw-r--r--arch/s390/include/asm/reset.h20
-rw-r--r--arch/s390/include/uapi/asm/zcrypt.h163
-rw-r--r--arch/s390/kernel/compat_signal.c2
-rw-r--r--arch/s390/kernel/early.c14
-rw-r--r--arch/s390/kernel/ipl.c376
-rw-r--r--arch/s390/kernel/machine_kexec.c2
-rw-r--r--arch/s390/kernel/nospec-branch.c8
-rw-r--r--arch/s390/kernel/reipl.S87
-rw-r--r--arch/s390/kernel/relocate_kernel.S54
-rw-r--r--arch/s390/kernel/setup.c3
17 files changed, 174 insertions, 636 deletions
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
index 63838a17e56a..511b2cc9b91a 100644
--- a/arch/s390/boot/compressed/misc.c
+++ b/arch/s390/boot/compressed/misc.c
@@ -119,34 +119,12 @@ static void error(char *x)
119 asm volatile("lpsw %0" : : "Q" (psw)); 119 asm volatile("lpsw %0" : : "Q" (psw));
120} 120}
121 121
122/*
123 * Safe guard the ipl parameter block against a memory area that will be
124 * overwritten. The validity check for the ipl parameter block is complex
125 * (see cio_get_iplinfo and ipl_save_parameters) but if the pointer to
126 * the ipl parameter block intersects with the passed memory area we can
127 * safely assume that we can read from that memory. In that case just copy
128 * the memory to IPL_PARMBLOCK_ORIGIN even if there is no ipl parameter
129 * block.
130 */
131static void check_ipl_parmblock(void *start, unsigned long size)
132{
133 void *src, *dst;
134
135 src = (void *)(unsigned long) S390_lowcore.ipl_parmblock_ptr;
136 if (src + PAGE_SIZE <= start || src >= start + size)
137 return;
138 dst = (void *) IPL_PARMBLOCK_ORIGIN;
139 memmove(dst, src, PAGE_SIZE);
140 S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
141}
142
143unsigned long decompress_kernel(void) 122unsigned long decompress_kernel(void)
144{ 123{
145 void *output, *kernel_end; 124 void *output, *kernel_end;
146 125
147 output = (void *) ALIGN((unsigned long) _end + HEAP_SIZE, PAGE_SIZE); 126 output = (void *) ALIGN((unsigned long) _end + HEAP_SIZE, PAGE_SIZE);
148 kernel_end = output + SZ__bss_start; 127 kernel_end = output + SZ__bss_start;
149 check_ipl_parmblock((void *) 0, (unsigned long) kernel_end);
150 128
151#ifdef CONFIG_BLK_DEV_INITRD 129#ifdef CONFIG_BLK_DEV_INITRD
152 /* 130 /*
@@ -156,7 +134,6 @@ unsigned long decompress_kernel(void)
156 * current bss section.. 134 * current bss section..
157 */ 135 */
158 if (INITRD_START && INITRD_SIZE && kernel_end > (void *) INITRD_START) { 136 if (INITRD_START && INITRD_SIZE && kernel_end > (void *) INITRD_START) {
159 check_ipl_parmblock(kernel_end, INITRD_SIZE);
160 memmove(kernel_end, (void *) INITRD_START, INITRD_SIZE); 137 memmove(kernel_end, (void *) INITRD_START, INITRD_SIZE);
161 INITRD_START = (unsigned long) kernel_end; 138 INITRD_START = (unsigned long) kernel_end;
162 } 139 }
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index fa9b7dd1a513..ad47abd08630 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -329,7 +329,7 @@ static void fallback_exit_blk(struct crypto_tfm *tfm)
329static struct crypto_alg ecb_aes_alg = { 329static struct crypto_alg ecb_aes_alg = {
330 .cra_name = "ecb(aes)", 330 .cra_name = "ecb(aes)",
331 .cra_driver_name = "ecb-aes-s390", 331 .cra_driver_name = "ecb-aes-s390",
332 .cra_priority = 400, /* combo: aes + ecb */ 332 .cra_priority = 401, /* combo: aes + ecb + 1 */
333 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | 333 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
334 CRYPTO_ALG_NEED_FALLBACK, 334 CRYPTO_ALG_NEED_FALLBACK,
335 .cra_blocksize = AES_BLOCK_SIZE, 335 .cra_blocksize = AES_BLOCK_SIZE,
@@ -426,7 +426,7 @@ static int cbc_aes_decrypt(struct blkcipher_desc *desc,
426static struct crypto_alg cbc_aes_alg = { 426static struct crypto_alg cbc_aes_alg = {
427 .cra_name = "cbc(aes)", 427 .cra_name = "cbc(aes)",
428 .cra_driver_name = "cbc-aes-s390", 428 .cra_driver_name = "cbc-aes-s390",
429 .cra_priority = 400, /* combo: aes + cbc */ 429 .cra_priority = 402, /* ecb-aes-s390 + 1 */
430 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | 430 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
431 CRYPTO_ALG_NEED_FALLBACK, 431 CRYPTO_ALG_NEED_FALLBACK,
432 .cra_blocksize = AES_BLOCK_SIZE, 432 .cra_blocksize = AES_BLOCK_SIZE,
@@ -633,7 +633,7 @@ static void xts_fallback_exit(struct crypto_tfm *tfm)
633static struct crypto_alg xts_aes_alg = { 633static struct crypto_alg xts_aes_alg = {
634 .cra_name = "xts(aes)", 634 .cra_name = "xts(aes)",
635 .cra_driver_name = "xts-aes-s390", 635 .cra_driver_name = "xts-aes-s390",
636 .cra_priority = 400, /* combo: aes + xts */ 636 .cra_priority = 402, /* ecb-aes-s390 + 1 */
637 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | 637 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
638 CRYPTO_ALG_NEED_FALLBACK, 638 CRYPTO_ALG_NEED_FALLBACK,
639 .cra_blocksize = AES_BLOCK_SIZE, 639 .cra_blocksize = AES_BLOCK_SIZE,
@@ -763,7 +763,7 @@ static int ctr_aes_decrypt(struct blkcipher_desc *desc,
763static struct crypto_alg ctr_aes_alg = { 763static struct crypto_alg ctr_aes_alg = {
764 .cra_name = "ctr(aes)", 764 .cra_name = "ctr(aes)",
765 .cra_driver_name = "ctr-aes-s390", 765 .cra_driver_name = "ctr-aes-s390",
766 .cra_priority = 400, /* combo: aes + ctr */ 766 .cra_priority = 402, /* ecb-aes-s390 + 1 */
767 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | 767 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
768 CRYPTO_ALG_NEED_FALLBACK, 768 CRYPTO_ALG_NEED_FALLBACK,
769 .cra_blocksize = 1, 769 .cra_blocksize = 1,
diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
index 003932db8d12..80b27294c1de 100644
--- a/arch/s390/crypto/paes_s390.c
+++ b/arch/s390/crypto/paes_s390.c
@@ -138,7 +138,7 @@ static int ecb_paes_decrypt(struct blkcipher_desc *desc,
138static struct crypto_alg ecb_paes_alg = { 138static struct crypto_alg ecb_paes_alg = {
139 .cra_name = "ecb(paes)", 139 .cra_name = "ecb(paes)",
140 .cra_driver_name = "ecb-paes-s390", 140 .cra_driver_name = "ecb-paes-s390",
141 .cra_priority = 400, /* combo: aes + ecb */ 141 .cra_priority = 401, /* combo: aes + ecb + 1 */
142 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 142 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
143 .cra_blocksize = AES_BLOCK_SIZE, 143 .cra_blocksize = AES_BLOCK_SIZE,
144 .cra_ctxsize = sizeof(struct s390_paes_ctx), 144 .cra_ctxsize = sizeof(struct s390_paes_ctx),
@@ -241,7 +241,7 @@ static int cbc_paes_decrypt(struct blkcipher_desc *desc,
241static struct crypto_alg cbc_paes_alg = { 241static struct crypto_alg cbc_paes_alg = {
242 .cra_name = "cbc(paes)", 242 .cra_name = "cbc(paes)",
243 .cra_driver_name = "cbc-paes-s390", 243 .cra_driver_name = "cbc-paes-s390",
244 .cra_priority = 400, /* combo: aes + cbc */ 244 .cra_priority = 402, /* ecb-paes-s390 + 1 */
245 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 245 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
246 .cra_blocksize = AES_BLOCK_SIZE, 246 .cra_blocksize = AES_BLOCK_SIZE,
247 .cra_ctxsize = sizeof(struct s390_paes_ctx), 247 .cra_ctxsize = sizeof(struct s390_paes_ctx),
@@ -377,7 +377,7 @@ static int xts_paes_decrypt(struct blkcipher_desc *desc,
377static struct crypto_alg xts_paes_alg = { 377static struct crypto_alg xts_paes_alg = {
378 .cra_name = "xts(paes)", 378 .cra_name = "xts(paes)",
379 .cra_driver_name = "xts-paes-s390", 379 .cra_driver_name = "xts-paes-s390",
380 .cra_priority = 400, /* combo: aes + xts */ 380 .cra_priority = 402, /* ecb-paes-s390 + 1 */
381 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 381 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
382 .cra_blocksize = AES_BLOCK_SIZE, 382 .cra_blocksize = AES_BLOCK_SIZE,
383 .cra_ctxsize = sizeof(struct s390_pxts_ctx), 383 .cra_ctxsize = sizeof(struct s390_pxts_ctx),
@@ -523,7 +523,7 @@ static int ctr_paes_decrypt(struct blkcipher_desc *desc,
523static struct crypto_alg ctr_paes_alg = { 523static struct crypto_alg ctr_paes_alg = {
524 .cra_name = "ctr(paes)", 524 .cra_name = "ctr(paes)",
525 .cra_driver_name = "ctr-paes-s390", 525 .cra_driver_name = "ctr-paes-s390",
526 .cra_priority = 400, /* combo: aes + ctr */ 526 .cra_priority = 402, /* ecb-paes-s390 + 1 */
527 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 527 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
528 .cra_blocksize = 1, 528 .cra_blocksize = 1,
529 .cra_ctxsize = sizeof(struct s390_paes_ctx), 529 .cra_ctxsize = sizeof(struct s390_paes_ctx),
diff --git a/arch/s390/include/asm/ap.h b/arch/s390/include/asm/ap.h
index cfce6835b109..c1bedb4c8de0 100644
--- a/arch/s390/include/asm/ap.h
+++ b/arch/s390/include/asm/ap.h
@@ -20,9 +20,9 @@
20 */ 20 */
21typedef unsigned int ap_qid_t; 21typedef unsigned int ap_qid_t;
22 22
23#define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255)) 23#define AP_MKQID(_card, _queue) (((_card) & 0xff) << 8 | ((_queue) & 0xff))
24#define AP_QID_CARD(_qid) (((_qid) >> 8) & 63) 24#define AP_QID_CARD(_qid) (((_qid) >> 8) & 0xff)
25#define AP_QID_QUEUE(_qid) ((_qid) & 255) 25#define AP_QID_QUEUE(_qid) ((_qid) & 0xff)
26 26
27/** 27/**
28 * struct ap_queue_status - Holds the AP queue status. 28 * struct ap_queue_status - Holds the AP queue status.
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
index 847a04262b9c..225667652069 100644
--- a/arch/s390/include/asm/cio.h
+++ b/arch/s390/include/asm/cio.h
@@ -328,16 +328,6 @@ static inline u8 pathmask_to_pos(u8 mask)
328void channel_subsystem_reinit(void); 328void channel_subsystem_reinit(void);
329extern void css_schedule_reprobe(void); 329extern void css_schedule_reprobe(void);
330 330
331extern void reipl_ccw_dev(struct ccw_dev_id *id);
332
333struct cio_iplinfo {
334 u8 ssid;
335 u16 devno;
336 int is_qdio;
337};
338
339extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
340
341/* Function from drivers/s390/cio/chsc.c */ 331/* Function from drivers/s390/cio/chsc.c */
342int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta); 332int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta);
343int chsc_sstpi(void *page, void *result, size_t size); 333int chsc_sstpi(void *page, void *result, size_t size);
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 186c7b5f5511..ae5135704616 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -15,8 +15,6 @@
15 15
16#define NSS_NAME_SIZE 8 16#define NSS_NAME_SIZE 8
17 17
18#define IPL_PARMBLOCK_ORIGIN 0x2000
19
20#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ 18#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
21 sizeof(struct ipl_block_fcp)) 19 sizeof(struct ipl_block_fcp))
22 20
@@ -29,10 +27,6 @@
29 27
30#define IPL_MAX_SUPPORTED_VERSION (0) 28#define IPL_MAX_SUPPORTED_VERSION (0)
31 29
32#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
33 IPL_PARMBLOCK_ORIGIN)
34#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
35
36struct ipl_list_hdr { 30struct ipl_list_hdr {
37 u32 len; 31 u32 len;
38 u8 reserved1[3]; 32 u8 reserved1[3];
@@ -83,33 +77,21 @@ struct ipl_parameter_block {
83 union { 77 union {
84 struct ipl_block_fcp fcp; 78 struct ipl_block_fcp fcp;
85 struct ipl_block_ccw ccw; 79 struct ipl_block_ccw ccw;
80 char raw[PAGE_SIZE - sizeof(struct ipl_list_hdr)];
86 } ipl_info; 81 } ipl_info;
87} __packed __aligned(PAGE_SIZE); 82} __packed __aligned(PAGE_SIZE);
88 83
89/*
90 * IPL validity flags
91 */
92extern u32 ipl_flags;
93
94struct save_area; 84struct save_area;
95struct save_area * __init save_area_alloc(bool is_boot_cpu); 85struct save_area * __init save_area_alloc(bool is_boot_cpu);
96struct save_area * __init save_area_boot_cpu(void); 86struct save_area * __init save_area_boot_cpu(void);
97void __init save_area_add_regs(struct save_area *, void *regs); 87void __init save_area_add_regs(struct save_area *, void *regs);
98void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs); 88void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
99 89
100extern void do_reipl(void); 90extern void s390_reset_system(void);
101extern void do_halt(void); 91extern void ipl_store_parameters(void);
102extern void do_poff(void);
103extern void ipl_verify_parameters(void);
104extern void ipl_update_parameters(void);
105extern size_t append_ipl_vmparm(char *, size_t); 92extern size_t append_ipl_vmparm(char *, size_t);
106extern size_t append_ipl_scpdata(char *, size_t); 93extern size_t append_ipl_scpdata(char *, size_t);
107 94
108enum {
109 IPL_DEVNO_VALID = 1,
110 IPL_PARMBLOCK_VALID = 2,
111};
112
113enum ipl_type { 95enum ipl_type {
114 IPL_TYPE_UNKNOWN = 1, 96 IPL_TYPE_UNKNOWN = 1,
115 IPL_TYPE_CCW = 2, 97 IPL_TYPE_CCW = 2,
@@ -138,6 +120,7 @@ struct ipl_info
138 120
139extern struct ipl_info ipl_info; 121extern struct ipl_info ipl_info;
140extern void setup_ipl(void); 122extern void setup_ipl(void);
123extern void set_os_info_reipl_block(void);
141 124
142/* 125/*
143 * DIAG 308 support 126 * DIAG 308 support
diff --git a/arch/s390/include/asm/nospec-branch.h b/arch/s390/include/asm/nospec-branch.h
index 35bf28fe4c64..b4bd8c41e9d3 100644
--- a/arch/s390/include/asm/nospec-branch.h
+++ b/arch/s390/include/asm/nospec-branch.h
@@ -9,6 +9,7 @@
9extern int nospec_disable; 9extern int nospec_disable;
10 10
11void nospec_init_branches(void); 11void nospec_init_branches(void);
12void nospec_auto_detect(void);
12void nospec_revert(s32 *start, s32 *end); 13void nospec_revert(s32 *start, s32 *end);
13 14
14#endif /* __ASSEMBLY__ */ 15#endif /* __ASSEMBLY__ */
diff --git a/arch/s390/include/asm/reset.h b/arch/s390/include/asm/reset.h
deleted file mode 100644
index 6450b31ade03..000000000000
--- a/arch/s390/include/asm/reset.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright IBM Corp. 2006
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
5 */
6
7#ifndef _ASM_S390_RESET_H
8#define _ASM_S390_RESET_H
9
10#include <linux/list.h>
11
12struct reset_call {
13 struct list_head list;
14 void (*fn)(void);
15};
16
17extern void register_reset_call(struct reset_call *reset);
18extern void unregister_reset_call(struct reset_call *reset);
19extern void s390_reset_system(void);
20#endif /* _ASM_S390_RESET_H */
diff --git a/arch/s390/include/uapi/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h
index d568307321fc..b62e0614e440 100644
--- a/arch/s390/include/uapi/asm/zcrypt.h
+++ b/arch/s390/include/uapi/asm/zcrypt.h
@@ -203,9 +203,9 @@ struct ep11_urb {
203} __attribute__((packed)); 203} __attribute__((packed));
204 204
205/** 205/**
206 * struct zcrypt_device_status 206 * struct zcrypt_device_status_ext
207 * @hwtype: raw hardware type 207 * @hwtype: raw hardware type
208 * @qid: 6 bit device index, 8 bit domain 208 * @qid: 8 bit device index, 8 bit domain
209 * @functions: AP device function bit field 'abcdef' 209 * @functions: AP device function bit field 'abcdef'
210 * a, b, c = reserved 210 * a, b, c = reserved
211 * d = CCA coprocessor 211 * d = CCA coprocessor
@@ -214,28 +214,23 @@ struct ep11_urb {
214 * @online online status 214 * @online online status
215 * @reserved reserved 215 * @reserved reserved
216 */ 216 */
217struct zcrypt_device_status { 217struct zcrypt_device_status_ext {
218 unsigned int hwtype:8; 218 unsigned int hwtype:8;
219 unsigned int qid:14; 219 unsigned int qid:16;
220 unsigned int online:1; 220 unsigned int online:1;
221 unsigned int functions:6; 221 unsigned int functions:6;
222 unsigned int reserved:3; 222 unsigned int reserved:1;
223}; 223};
224 224
225#define MAX_ZDEV_CARDIDS 64 225#define MAX_ZDEV_CARDIDS_EXT 256
226#define MAX_ZDEV_DOMAINS 256 226#define MAX_ZDEV_DOMAINS_EXT 256
227 227
228/** 228/* Maximum number of zcrypt devices */
229 * Maximum number of zcrypt devices 229#define MAX_ZDEV_ENTRIES_EXT (MAX_ZDEV_CARDIDS_EXT * MAX_ZDEV_DOMAINS_EXT)
230 */
231#define MAX_ZDEV_ENTRIES (MAX_ZDEV_CARDIDS * MAX_ZDEV_DOMAINS)
232 230
233/** 231/* Device matrix of all zcrypt devices */
234 * zcrypt_device_matrix 232struct zcrypt_device_matrix_ext {
235 * Device matrix of all zcrypt devices 233 struct zcrypt_device_status_ext device[MAX_ZDEV_ENTRIES_EXT];
236 */
237struct zcrypt_device_matrix {
238 struct zcrypt_device_status device[MAX_ZDEV_ENTRIES];
239}; 234};
240 235
241#define AUTOSELECT ((unsigned int)0xFFFFFFFF) 236#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
@@ -270,71 +265,35 @@ struct zcrypt_device_matrix {
270 * ZSENDEP11CPRB 265 * ZSENDEP11CPRB
271 * Send an arbitrary EP11 CPRB to an EP11 coprocessor crypto card. 266 * Send an arbitrary EP11 CPRB to an EP11 coprocessor crypto card.
272 * 267 *
273 * Z90STAT_STATUS_MASK 268 * ZCRYPT_DEVICE_STATUS
274 * Return an 64 element array of unsigned chars for the status of 269 * The given struct zcrypt_device_matrix_ext is updated with
275 * all devices. 270 * status information for each currently known apqn.
271 *
272 * ZCRYPT_STATUS_MASK
273 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned chars for the
274 * status of all devices.
276 * 0x01: PCICA 275 * 0x01: PCICA
277 * 0x02: PCICC 276 * 0x02: PCICC
278 * 0x03: PCIXCC_MCL2 277 * 0x03: PCIXCC_MCL2
279 * 0x04: PCIXCC_MCL3 278 * 0x04: PCIXCC_MCL3
280 * 0x05: CEX2C 279 * 0x05: CEX2C
281 * 0x06: CEX2A 280 * 0x06: CEX2A
282 * 0x0d: device is disabled via the proc filesystem 281 * 0x07: CEX3C
283 * 282 * 0x08: CEX3A
284 * Z90STAT_QDEPTH_MASK 283 * 0x0a: CEX4
285 * Return an 64 element array of unsigned chars for the queue 284 * 0x0b: CEX5
286 * depth of all devices. 285 * 0x0c: CEX6
287 * 286 * 0x0d: device is disabled
288 * Z90STAT_PERDEV_REQCNT
289 * Return an 64 element array of unsigned integers for the number
290 * of successfully completed requests per device since the device
291 * was detected and made available.
292 *
293 * Z90STAT_REQUESTQ_COUNT
294 * Return an integer count of the number of entries waiting to be
295 * sent to a device.
296 *
297 * Z90STAT_PENDINGQ_COUNT
298 * Return an integer count of the number of entries sent to all
299 * devices awaiting the reply.
300 *
301 * Z90STAT_TOTALOPEN_COUNT
302 * Return an integer count of the number of open file handles.
303 *
304 * Z90STAT_DOMAIN_INDEX
305 * Return the integer value of the Cryptographic Domain.
306 *
307 * The following ioctls are deprecated and should be no longer used:
308 *
309 * Z90STAT_TOTALCOUNT
310 * Return an integer count of all device types together.
311 *
312 * Z90STAT_PCICACOUNT
313 * Return an integer count of all PCICAs.
314 *
315 * Z90STAT_PCICCCOUNT
316 * Return an integer count of all PCICCs.
317 *
318 * Z90STAT_PCIXCCMCL2COUNT
319 * Return an integer count of all MCL2 PCIXCCs.
320 *
321 * Z90STAT_PCIXCCMCL3COUNT
322 * Return an integer count of all MCL3 PCIXCCs.
323 *
324 * Z90STAT_CEX2CCOUNT
325 * Return an integer count of all CEX2Cs.
326 * 287 *
327 * Z90STAT_CEX2ACOUNT 288 * ZCRYPT_QDEPTH_MASK
328 * Return an integer count of all CEX2As. 289 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned chars for the
290 * queue depth of all devices.
329 * 291 *
330 * ICAZ90STATUS 292 * ZCRYPT_PERDEV_REQCNT
331 * Return some device driver status in a ica_z90_status struct 293 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned integers for
332 * This takes an ica_z90_status struct as its arg. 294 * the number of successfully completed requests per device since the
295 * device was detected and made available.
333 * 296 *
334 * Z90STAT_PCIXCCCOUNT
335 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
336 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
337 * MCL2 PCIXCCs.
338 */ 297 */
339 298
340/** 299/**
@@ -344,22 +303,56 @@ struct zcrypt_device_matrix {
344#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0) 303#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
345#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0) 304#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
346#define ZSENDEP11CPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x04, 0) 305#define ZSENDEP11CPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x04, 0)
347#define ZDEVICESTATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x4f, 0)
348 306
349/* New status calls */ 307#define ZCRYPT_DEVICE_STATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x5f, 0)
350#define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int) 308#define ZCRYPT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x58, char[MAX_ZDEV_CARDIDS_EXT])
351#define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int) 309#define ZCRYPT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x59, char[MAX_ZDEV_CARDIDS_EXT])
352#define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int) 310#define ZCRYPT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x5a, int[MAX_ZDEV_CARDIDS_EXT])
353#define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int) 311
354#define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int) 312/*
355#define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int) 313 * Only deprecated defines, structs and ioctls below this line.
356#define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int) 314 */
315
316/* Deprecated: use MAX_ZDEV_CARDIDS_EXT */
317#define MAX_ZDEV_CARDIDS 64
318/* Deprecated: use MAX_ZDEV_DOMAINS_EXT */
319#define MAX_ZDEV_DOMAINS 256
320
321/* Deprecated: use MAX_ZDEV_ENTRIES_EXT */
322#define MAX_ZDEV_ENTRIES (MAX_ZDEV_CARDIDS * MAX_ZDEV_DOMAINS)
323
324/* Deprecated: use struct zcrypt_device_status_ext */
325struct zcrypt_device_status {
326 unsigned int hwtype:8;
327 unsigned int qid:14;
328 unsigned int online:1;
329 unsigned int functions:6;
330 unsigned int reserved:3;
331};
332
333/* Deprecated: use struct zcrypt_device_matrix_ext */
334struct zcrypt_device_matrix {
335 struct zcrypt_device_status device[MAX_ZDEV_ENTRIES];
336};
337
338/* Deprecated: use ZCRYPT_DEVICE_STATUS */
339#define ZDEVICESTATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x4f, 0)
340/* Deprecated: use ZCRYPT_STATUS_MASK */
341#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
342/* Deprecated: use ZCRYPT_QDEPTH_MASK */
343#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
344/* Deprecated: use ZCRYPT_PERDEV_REQCNT */
345#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
346
347/* Deprecated: use sysfs to query these values */
357#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int) 348#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
358#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int) 349#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
359#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int) 350#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
360#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int) 351#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
361#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64]) 352
362#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64]) 353/*
363#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64]) 354 * The ioctl number ranges 0x40 - 0x42 and 0x4b - 0x4e had been used in the
355 * past, don't assign new ioctls for these.
356 */
364 357
365#endif /* __ASM_S390_ZCRYPT_H */ 358#endif /* __ASM_S390_ZCRYPT_H */
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 18c1eeb847b2..6f2a193ccccc 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -279,7 +279,7 @@ static int setup_frame32(struct ksignal *ksig, sigset_t *set,
279 if (put_compat_sigset((compat_sigset_t __user *)frame->sc.oldmask, 279 if (put_compat_sigset((compat_sigset_t __user *)frame->sc.oldmask,
280 set, sizeof(compat_sigset_t))) 280 set, sizeof(compat_sigset_t)))
281 return -EFAULT; 281 return -EFAULT;
282 if (__put_user(ptr_to_compat(&frame->sc), &frame->sc.sregs)) 282 if (__put_user(ptr_to_compat(&frame->sregs), &frame->sc.sregs))
283 return -EFAULT; 283 return -EFAULT;
284 284
285 /* Store registers needed to create the signal frame */ 285 /* Store registers needed to create the signal frame */
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index b00b515baa53..32daa0f84325 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -342,16 +342,6 @@ static __init void memmove_early(void *dst, const void *src, size_t n)
342 S390_lowcore.program_new_psw = old; 342 S390_lowcore.program_new_psw = old;
343} 343}
344 344
345static __init noinline void ipl_save_parameters(void)
346{
347 void *src, *dst;
348
349 src = (void *)(unsigned long) S390_lowcore.ipl_parmblock_ptr;
350 dst = (void *) IPL_PARMBLOCK_ORIGIN;
351 memmove_early(dst, src, PAGE_SIZE);
352 S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
353}
354
355static __init noinline void rescue_initrd(void) 345static __init noinline void rescue_initrd(void)
356{ 346{
357#ifdef CONFIG_BLK_DEV_INITRD 347#ifdef CONFIG_BLK_DEV_INITRD
@@ -421,10 +411,8 @@ static void __init setup_boot_command_line(void)
421void __init startup_init(void) 411void __init startup_init(void)
422{ 412{
423 reset_tod_clock(); 413 reset_tod_clock();
424 ipl_save_parameters();
425 rescue_initrd(); 414 rescue_initrd();
426 clear_bss_section(); 415 clear_bss_section();
427 ipl_verify_parameters();
428 time_early_init(); 416 time_early_init();
429 init_kernel_storage_key(); 417 init_kernel_storage_key();
430 lockdep_off(); 418 lockdep_off();
@@ -432,7 +420,7 @@ void __init startup_init(void)
432 setup_facility_list(); 420 setup_facility_list();
433 detect_machine_type(); 421 detect_machine_type();
434 setup_arch_string(); 422 setup_arch_string();
435 ipl_update_parameters(); 423 ipl_store_parameters();
436 setup_boot_command_line(); 424 setup_boot_command_line();
437 detect_diag9c(); 425 detect_diag9c();
438 detect_diag44(); 426 detect_diag44();
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 34477c1aee6d..4296d7e61fb6 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -24,9 +24,7 @@
24#include <asm/smp.h> 24#include <asm/smp.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/cpcmd.h> 26#include <asm/cpcmd.h>
27#include <asm/cio.h>
28#include <asm/ebcdic.h> 27#include <asm/ebcdic.h>
29#include <asm/reset.h>
30#include <asm/sclp.h> 28#include <asm/sclp.h>
31#include <asm/checksum.h> 29#include <asm/checksum.h>
32#include <asm/debug.h> 30#include <asm/debug.h>
@@ -119,39 +117,12 @@ static char *dump_type_str(enum dump_type type)
119 } 117 }
120} 118}
121 119
122static u8 ipl_ssid; 120static int ipl_block_valid;
123static u16 ipl_devno;
124u32 ipl_flags;
125
126enum ipl_method {
127 REIPL_METHOD_CCW_CIO,
128 REIPL_METHOD_CCW_DIAG,
129 REIPL_METHOD_CCW_VM,
130 REIPL_METHOD_FCP_RO_DIAG,
131 REIPL_METHOD_FCP_RW_DIAG,
132 REIPL_METHOD_FCP_RO_VM,
133 REIPL_METHOD_FCP_DUMP,
134 REIPL_METHOD_NSS,
135 REIPL_METHOD_NSS_DIAG,
136 REIPL_METHOD_DEFAULT,
137};
138
139enum dump_method {
140 DUMP_METHOD_NONE,
141 DUMP_METHOD_CCW_CIO,
142 DUMP_METHOD_CCW_DIAG,
143 DUMP_METHOD_CCW_VM,
144 DUMP_METHOD_FCP_DIAG,
145};
146
147static int diag308_set_works;
148
149static struct ipl_parameter_block ipl_block; 121static struct ipl_parameter_block ipl_block;
150 122
151static int reipl_capabilities = IPL_TYPE_UNKNOWN; 123static int reipl_capabilities = IPL_TYPE_UNKNOWN;
152 124
153static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; 125static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN;
154static enum ipl_method reipl_method = REIPL_METHOD_DEFAULT;
155static struct ipl_parameter_block *reipl_block_fcp; 126static struct ipl_parameter_block *reipl_block_fcp;
156static struct ipl_parameter_block *reipl_block_ccw; 127static struct ipl_parameter_block *reipl_block_ccw;
157static struct ipl_parameter_block *reipl_block_nss; 128static struct ipl_parameter_block *reipl_block_nss;
@@ -159,7 +130,6 @@ static struct ipl_parameter_block *reipl_block_actual;
159 130
160static int dump_capabilities = DUMP_TYPE_NONE; 131static int dump_capabilities = DUMP_TYPE_NONE;
161static enum dump_type dump_type = DUMP_TYPE_NONE; 132static enum dump_type dump_type = DUMP_TYPE_NONE;
162static enum dump_method dump_method = DUMP_METHOD_NONE;
163static struct ipl_parameter_block *dump_block_fcp; 133static struct ipl_parameter_block *dump_block_fcp;
164static struct ipl_parameter_block *dump_block_ccw; 134static struct ipl_parameter_block *dump_block_ccw;
165 135
@@ -260,33 +230,25 @@ static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
260 sys_##_prefix##_##_name##_show, \ 230 sys_##_prefix##_##_name##_show, \
261 sys_##_prefix##_##_name##_store) 231 sys_##_prefix##_##_name##_store)
262 232
263static void make_attrs_ro(struct attribute **attrs)
264{
265 while (*attrs) {
266 (*attrs)->mode = S_IRUGO;
267 attrs++;
268 }
269}
270
271/* 233/*
272 * ipl section 234 * ipl section
273 */ 235 */
274 236
275static __init enum ipl_type get_ipl_type(void) 237static __init enum ipl_type get_ipl_type(void)
276{ 238{
277 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; 239 if (!ipl_block_valid)
278
279 if (!(ipl_flags & IPL_DEVNO_VALID))
280 return IPL_TYPE_UNKNOWN; 240 return IPL_TYPE_UNKNOWN;
281 if (!(ipl_flags & IPL_PARMBLOCK_VALID)) 241
242 switch (ipl_block.hdr.pbt) {
243 case DIAG308_IPL_TYPE_CCW:
282 return IPL_TYPE_CCW; 244 return IPL_TYPE_CCW;
283 if (ipl->hdr.version > IPL_MAX_SUPPORTED_VERSION) 245 case DIAG308_IPL_TYPE_FCP:
284 return IPL_TYPE_UNKNOWN; 246 if (ipl_block.ipl_info.fcp.opt == DIAG308_IPL_OPT_DUMP)
285 if (ipl->hdr.pbt != DIAG308_IPL_TYPE_FCP) 247 return IPL_TYPE_FCP_DUMP;
286 return IPL_TYPE_UNKNOWN; 248 else
287 if (ipl->ipl_info.fcp.opt == DIAG308_IPL_OPT_DUMP) 249 return IPL_TYPE_FCP;
288 return IPL_TYPE_FCP_DUMP; 250 }
289 return IPL_TYPE_FCP; 251 return IPL_TYPE_UNKNOWN;
290} 252}
291 253
292struct ipl_info ipl_info; 254struct ipl_info ipl_info;
@@ -338,7 +300,7 @@ size_t append_ipl_vmparm(char *dest, size_t size)
338 size_t rc; 300 size_t rc;
339 301
340 rc = 0; 302 rc = 0;
341 if (diag308_set_works && (ipl_block.hdr.pbt == DIAG308_IPL_TYPE_CCW)) 303 if (ipl_block_valid && ipl_block.hdr.pbt == DIAG308_IPL_TYPE_CCW)
342 rc = reipl_get_ascii_vmparm(dest, size, &ipl_block); 304 rc = reipl_get_ascii_vmparm(dest, size, &ipl_block);
343 else 305 else
344 dest[0] = 0; 306 dest[0] = 0;
@@ -401,7 +363,7 @@ size_t append_ipl_scpdata(char *dest, size_t len)
401 size_t rc; 363 size_t rc;
402 364
403 rc = 0; 365 rc = 0;
404 if (ipl_block.hdr.pbt == DIAG308_IPL_TYPE_FCP) 366 if (ipl_block_valid && ipl_block.hdr.pbt == DIAG308_IPL_TYPE_FCP)
405 rc = reipl_append_ascii_scpdata(dest, len, &ipl_block); 367 rc = reipl_append_ascii_scpdata(dest, len, &ipl_block);
406 else 368 else
407 dest[0] = 0; 369 dest[0] = 0;
@@ -415,14 +377,14 @@ static struct kobj_attribute sys_ipl_vm_parm_attr =
415static ssize_t sys_ipl_device_show(struct kobject *kobj, 377static ssize_t sys_ipl_device_show(struct kobject *kobj,
416 struct kobj_attribute *attr, char *page) 378 struct kobj_attribute *attr, char *page)
417{ 379{
418 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
419
420 switch (ipl_info.type) { 380 switch (ipl_info.type) {
421 case IPL_TYPE_CCW: 381 case IPL_TYPE_CCW:
422 return sprintf(page, "0.%x.%04x\n", ipl_ssid, ipl_devno); 382 return sprintf(page, "0.%x.%04x\n", ipl_block.ipl_info.ccw.ssid,
383 ipl_block.ipl_info.ccw.devno);
423 case IPL_TYPE_FCP: 384 case IPL_TYPE_FCP:
424 case IPL_TYPE_FCP_DUMP: 385 case IPL_TYPE_FCP_DUMP:
425 return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno); 386 return sprintf(page, "0.0.%04x\n",
387 ipl_block.ipl_info.fcp.devno);
426 default: 388 default:
427 return 0; 389 return 0;
428 } 390 }
@@ -435,8 +397,8 @@ static ssize_t ipl_parameter_read(struct file *filp, struct kobject *kobj,
435 struct bin_attribute *attr, char *buf, 397 struct bin_attribute *attr, char *buf,
436 loff_t off, size_t count) 398 loff_t off, size_t count)
437{ 399{
438 return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START, 400 return memory_read_from_buffer(buf, count, &off, &ipl_block,
439 IPL_PARMBLOCK_SIZE); 401 ipl_block.hdr.len);
440} 402}
441static struct bin_attribute ipl_parameter_attr = 403static struct bin_attribute ipl_parameter_attr =
442 __BIN_ATTR(binary_parameter, S_IRUGO, ipl_parameter_read, NULL, 404 __BIN_ATTR(binary_parameter, S_IRUGO, ipl_parameter_read, NULL,
@@ -446,8 +408,8 @@ static ssize_t ipl_scp_data_read(struct file *filp, struct kobject *kobj,
446 struct bin_attribute *attr, char *buf, 408 struct bin_attribute *attr, char *buf,
447 loff_t off, size_t count) 409 loff_t off, size_t count)
448{ 410{
449 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len; 411 unsigned int size = ipl_block.ipl_info.fcp.scp_data_len;
450 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data; 412 void *scp_data = &ipl_block.ipl_info.fcp.scp_data;
451 413
452 return memory_read_from_buffer(buf, count, &off, scp_data, size); 414 return memory_read_from_buffer(buf, count, &off, scp_data, size);
453} 415}
@@ -462,14 +424,14 @@ static struct bin_attribute *ipl_fcp_bin_attrs[] = {
462 424
463/* FCP ipl device attributes */ 425/* FCP ipl device attributes */
464 426
465DEFINE_IPL_ATTR_RO(ipl_fcp, wwpn, "0x%016llx\n", (unsigned long long) 427DEFINE_IPL_ATTR_RO(ipl_fcp, wwpn, "0x%016llx\n",
466 IPL_PARMBLOCK_START->ipl_info.fcp.wwpn); 428 (unsigned long long)ipl_block.ipl_info.fcp.wwpn);
467DEFINE_IPL_ATTR_RO(ipl_fcp, lun, "0x%016llx\n", (unsigned long long) 429DEFINE_IPL_ATTR_RO(ipl_fcp, lun, "0x%016llx\n",
468 IPL_PARMBLOCK_START->ipl_info.fcp.lun); 430 (unsigned long long)ipl_block.ipl_info.fcp.lun);
469DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long) 431DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n",
470 IPL_PARMBLOCK_START->ipl_info.fcp.bootprog); 432 (unsigned long long)ipl_block.ipl_info.fcp.bootprog);
471DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) 433DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n",
472 IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); 434 (unsigned long long)ipl_block.ipl_info.fcp.br_lba);
473 435
474static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, 436static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
475 struct kobj_attribute *attr, char *page) 437 struct kobj_attribute *attr, char *page)
@@ -545,10 +507,6 @@ static void __ipl_run(void *unused)
545{ 507{
546 __bpon(); 508 __bpon();
547 diag308(DIAG308_LOAD_CLEAR, NULL); 509 diag308(DIAG308_LOAD_CLEAR, NULL);
548 if (MACHINE_IS_VM)
549 __cpcmd("IPL", NULL, 0, NULL);
550 else if (ipl_info.type == IPL_TYPE_CCW)
551 reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
552} 510}
553 511
554static void ipl_run(struct shutdown_trigger *trigger) 512static void ipl_run(struct shutdown_trigger *trigger)
@@ -776,6 +734,7 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
776 /* copy and convert to ebcdic */ 734 /* copy and convert to ebcdic */
777 memcpy(ipb->hdr.loadparm, buf, lp_len); 735 memcpy(ipb->hdr.loadparm, buf, lp_len);
778 ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN); 736 ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN);
737 ipb->hdr.flags |= DIAG308_FLAGS_LP_VALID;
779 return len; 738 return len;
780} 739}
781 740
@@ -938,11 +897,10 @@ static struct attribute_group reipl_nss_attr_group = {
938 .attrs = reipl_nss_attrs, 897 .attrs = reipl_nss_attrs,
939}; 898};
940 899
941static void set_reipl_block_actual(struct ipl_parameter_block *reipl_block) 900void set_os_info_reipl_block(void)
942{ 901{
943 reipl_block_actual = reipl_block;
944 os_info_entry_add(OS_INFO_REIPL_BLOCK, reipl_block_actual, 902 os_info_entry_add(OS_INFO_REIPL_BLOCK, reipl_block_actual,
945 reipl_block->hdr.len); 903 reipl_block_actual->hdr.len);
946} 904}
947 905
948/* reipl type */ 906/* reipl type */
@@ -954,38 +912,16 @@ static int reipl_set_type(enum ipl_type type)
954 912
955 switch(type) { 913 switch(type) {
956 case IPL_TYPE_CCW: 914 case IPL_TYPE_CCW:
957 if (diag308_set_works) 915 reipl_block_actual = reipl_block_ccw;
958 reipl_method = REIPL_METHOD_CCW_DIAG;
959 else if (MACHINE_IS_VM)
960 reipl_method = REIPL_METHOD_CCW_VM;
961 else
962 reipl_method = REIPL_METHOD_CCW_CIO;
963 set_reipl_block_actual(reipl_block_ccw);
964 break; 916 break;
965 case IPL_TYPE_FCP: 917 case IPL_TYPE_FCP:
966 if (diag308_set_works) 918 reipl_block_actual = reipl_block_fcp;
967 reipl_method = REIPL_METHOD_FCP_RW_DIAG;
968 else if (MACHINE_IS_VM)
969 reipl_method = REIPL_METHOD_FCP_RO_VM;
970 else
971 reipl_method = REIPL_METHOD_FCP_RO_DIAG;
972 set_reipl_block_actual(reipl_block_fcp);
973 break;
974 case IPL_TYPE_FCP_DUMP:
975 reipl_method = REIPL_METHOD_FCP_DUMP;
976 break; 919 break;
977 case IPL_TYPE_NSS: 920 case IPL_TYPE_NSS:
978 if (diag308_set_works) 921 reipl_block_actual = reipl_block_nss;
979 reipl_method = REIPL_METHOD_NSS_DIAG;
980 else
981 reipl_method = REIPL_METHOD_NSS;
982 set_reipl_block_actual(reipl_block_nss);
983 break;
984 case IPL_TYPE_UNKNOWN:
985 reipl_method = REIPL_METHOD_DEFAULT;
986 break; 922 break;
987 default: 923 default:
988 BUG(); 924 break;
989 } 925 }
990 reipl_type = type; 926 reipl_type = type;
991 return 0; 927 return 0;
@@ -1018,77 +954,25 @@ static struct kobj_attribute reipl_type_attr =
1018static struct kset *reipl_kset; 954static struct kset *reipl_kset;
1019static struct kset *reipl_fcp_kset; 955static struct kset *reipl_fcp_kset;
1020 956
1021static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
1022 const enum ipl_method m)
1023{
1024 char loadparm[LOADPARM_LEN + 1] = {};
1025 char vmparm[DIAG308_VMPARM_SIZE + 1] = {};
1026 char nss_name[NSS_NAME_SIZE + 1] = {};
1027 size_t pos = 0;
1028
1029 reipl_get_ascii_loadparm(loadparm, ipb);
1030 reipl_get_ascii_nss_name(nss_name, ipb);
1031 reipl_get_ascii_vmparm(vmparm, sizeof(vmparm), ipb);
1032
1033 switch (m) {
1034 case REIPL_METHOD_CCW_VM:
1035 pos = sprintf(dst, "IPL %X CLEAR", ipb->ipl_info.ccw.devno);
1036 break;
1037 case REIPL_METHOD_NSS:
1038 pos = sprintf(dst, "IPL %s", nss_name);
1039 break;
1040 default:
1041 break;
1042 }
1043 if (strlen(loadparm) > 0)
1044 pos += sprintf(dst + pos, " LOADPARM '%s'", loadparm);
1045 if (strlen(vmparm) > 0)
1046 sprintf(dst + pos, " PARM %s", vmparm);
1047}
1048
1049static void __reipl_run(void *unused) 957static void __reipl_run(void *unused)
1050{ 958{
1051 struct ccw_dev_id devid; 959 switch (reipl_type) {
1052 static char buf[128]; 960 case IPL_TYPE_CCW:
1053
1054 switch (reipl_method) {
1055 case REIPL_METHOD_CCW_CIO:
1056 devid.ssid = reipl_block_ccw->ipl_info.ccw.ssid;
1057 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
1058 reipl_ccw_dev(&devid);
1059 break;
1060 case REIPL_METHOD_CCW_VM:
1061 get_ipl_string(buf, reipl_block_ccw, REIPL_METHOD_CCW_VM);
1062 __cpcmd(buf, NULL, 0, NULL);
1063 break;
1064 case REIPL_METHOD_CCW_DIAG:
1065 diag308(DIAG308_SET, reipl_block_ccw); 961 diag308(DIAG308_SET, reipl_block_ccw);
1066 diag308(DIAG308_LOAD_CLEAR, NULL); 962 diag308(DIAG308_LOAD_CLEAR, NULL);
1067 break; 963 break;
1068 case REIPL_METHOD_FCP_RW_DIAG: 964 case IPL_TYPE_FCP:
1069 diag308(DIAG308_SET, reipl_block_fcp); 965 diag308(DIAG308_SET, reipl_block_fcp);
1070 diag308(DIAG308_LOAD_CLEAR, NULL); 966 diag308(DIAG308_LOAD_CLEAR, NULL);
1071 break; 967 break;
1072 case REIPL_METHOD_FCP_RO_DIAG: 968 case IPL_TYPE_NSS:
1073 diag308(DIAG308_LOAD_CLEAR, NULL);
1074 break;
1075 case REIPL_METHOD_FCP_RO_VM:
1076 __cpcmd("IPL", NULL, 0, NULL);
1077 break;
1078 case REIPL_METHOD_NSS_DIAG:
1079 diag308(DIAG308_SET, reipl_block_nss); 969 diag308(DIAG308_SET, reipl_block_nss);
1080 diag308(DIAG308_LOAD_CLEAR, NULL); 970 diag308(DIAG308_LOAD_CLEAR, NULL);
1081 break; 971 break;
1082 case REIPL_METHOD_NSS: 972 case IPL_TYPE_UNKNOWN:
1083 get_ipl_string(buf, reipl_block_nss, REIPL_METHOD_NSS);
1084 __cpcmd(buf, NULL, 0, NULL);
1085 break;
1086 case REIPL_METHOD_DEFAULT:
1087 if (MACHINE_IS_VM)
1088 __cpcmd("IPL", NULL, 0, NULL);
1089 diag308(DIAG308_LOAD_CLEAR, NULL); 973 diag308(DIAG308_LOAD_CLEAR, NULL);
1090 break; 974 break;
1091 case REIPL_METHOD_FCP_DUMP: 975 case IPL_TYPE_FCP_DUMP:
1092 break; 976 break;
1093 } 977 }
1094 disabled_wait((unsigned long) __builtin_return_address(0)); 978 disabled_wait((unsigned long) __builtin_return_address(0));
@@ -1119,7 +1003,7 @@ static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb)
1119 ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; 1003 ipb->hdr.flags = DIAG308_FLAGS_LP_VALID;
1120 1004
1121 /* VM PARM */ 1005 /* VM PARM */
1122 if (MACHINE_IS_VM && diag308_set_works && 1006 if (MACHINE_IS_VM && ipl_block_valid &&
1123 (ipl_block.ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID)) { 1007 (ipl_block.ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID)) {
1124 1008
1125 ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID; 1009 ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID;
@@ -1141,9 +1025,6 @@ static int __init reipl_nss_init(void)
1141 if (!reipl_block_nss) 1025 if (!reipl_block_nss)
1142 return -ENOMEM; 1026 return -ENOMEM;
1143 1027
1144 if (!diag308_set_works)
1145 sys_reipl_nss_vmparm_attr.attr.mode = S_IRUGO;
1146
1147 rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group); 1028 rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group);
1148 if (rc) 1029 if (rc)
1149 return rc; 1030 return rc;
@@ -1161,24 +1042,16 @@ static int __init reipl_ccw_init(void)
1161 if (!reipl_block_ccw) 1042 if (!reipl_block_ccw)
1162 return -ENOMEM; 1043 return -ENOMEM;
1163 1044
1164 if (MACHINE_IS_VM) { 1045 rc = sysfs_create_group(&reipl_kset->kobj,
1165 if (!diag308_set_works) 1046 MACHINE_IS_VM ? &reipl_ccw_attr_group_vm
1166 sys_reipl_ccw_vmparm_attr.attr.mode = S_IRUGO; 1047 : &reipl_ccw_attr_group_lpar);
1167 rc = sysfs_create_group(&reipl_kset->kobj,
1168 &reipl_ccw_attr_group_vm);
1169 } else {
1170 if(!diag308_set_works)
1171 sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO;
1172 rc = sysfs_create_group(&reipl_kset->kobj,
1173 &reipl_ccw_attr_group_lpar);
1174 }
1175 if (rc) 1048 if (rc)
1176 return rc; 1049 return rc;
1177 1050
1178 reipl_block_ccw_init(reipl_block_ccw); 1051 reipl_block_ccw_init(reipl_block_ccw);
1179 if (ipl_info.type == IPL_TYPE_CCW) { 1052 if (ipl_info.type == IPL_TYPE_CCW) {
1180 reipl_block_ccw->ipl_info.ccw.ssid = ipl_ssid; 1053 reipl_block_ccw->ipl_info.ccw.ssid = ipl_block.ipl_info.ccw.ssid;
1181 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno; 1054 reipl_block_ccw->ipl_info.ccw.devno = ipl_block.ipl_info.ccw.devno;
1182 reipl_block_ccw_fill_parms(reipl_block_ccw); 1055 reipl_block_ccw_fill_parms(reipl_block_ccw);
1183 } 1056 }
1184 1057
@@ -1190,14 +1063,6 @@ static int __init reipl_fcp_init(void)
1190{ 1063{
1191 int rc; 1064 int rc;
1192 1065
1193 if (!diag308_set_works) {
1194 if (ipl_info.type == IPL_TYPE_FCP) {
1195 make_attrs_ro(reipl_fcp_attrs);
1196 sys_reipl_fcp_scp_data_attr.attr.mode = S_IRUGO;
1197 } else
1198 return 0;
1199 }
1200
1201 reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); 1066 reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
1202 if (!reipl_block_fcp) 1067 if (!reipl_block_fcp)
1203 return -ENOMEM; 1068 return -ENOMEM;
@@ -1218,7 +1083,7 @@ static int __init reipl_fcp_init(void)
1218 } 1083 }
1219 1084
1220 if (ipl_info.type == IPL_TYPE_FCP) { 1085 if (ipl_info.type == IPL_TYPE_FCP) {
1221 memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); 1086 memcpy(reipl_block_fcp, &ipl_block, sizeof(ipl_block));
1222 /* 1087 /*
1223 * Fix loadparm: There are systems where the (SCSI) LOADPARM 1088 * Fix loadparm: There are systems where the (SCSI) LOADPARM
1224 * is invalid in the SCSI IPL parameter block, so take it 1089 * is invalid in the SCSI IPL parameter block, so take it
@@ -1340,21 +1205,6 @@ static int dump_set_type(enum dump_type type)
1340{ 1205{
1341 if (!(dump_capabilities & type)) 1206 if (!(dump_capabilities & type))
1342 return -EINVAL; 1207 return -EINVAL;
1343 switch (type) {
1344 case DUMP_TYPE_CCW:
1345 if (diag308_set_works)
1346 dump_method = DUMP_METHOD_CCW_DIAG;
1347 else if (MACHINE_IS_VM)
1348 dump_method = DUMP_METHOD_CCW_VM;
1349 else
1350 dump_method = DUMP_METHOD_CCW_CIO;
1351 break;
1352 case DUMP_TYPE_FCP:
1353 dump_method = DUMP_METHOD_FCP_DIAG;
1354 break;
1355 default:
1356 dump_method = DUMP_METHOD_NONE;
1357 }
1358 dump_type = type; 1208 dump_type = type;
1359 return 0; 1209 return 0;
1360} 1210}
@@ -1397,25 +1247,11 @@ static void diag308_dump(void *dump_block)
1397 1247
1398static void __dump_run(void *unused) 1248static void __dump_run(void *unused)
1399{ 1249{
1400 struct ccw_dev_id devid; 1250 switch (dump_type) {
1401 static char buf[100]; 1251 case DUMP_TYPE_CCW:
1402
1403 switch (dump_method) {
1404 case DUMP_METHOD_CCW_CIO:
1405 devid.ssid = dump_block_ccw->ipl_info.ccw.ssid;
1406 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1407 reipl_ccw_dev(&devid);
1408 break;
1409 case DUMP_METHOD_CCW_VM:
1410 sprintf(buf, "STORE STATUS");
1411 __cpcmd(buf, NULL, 0, NULL);
1412 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
1413 __cpcmd(buf, NULL, 0, NULL);
1414 break;
1415 case DUMP_METHOD_CCW_DIAG:
1416 diag308_dump(dump_block_ccw); 1252 diag308_dump(dump_block_ccw);
1417 break; 1253 break;
1418 case DUMP_METHOD_FCP_DIAG: 1254 case DUMP_TYPE_FCP:
1419 diag308_dump(dump_block_fcp); 1255 diag308_dump(dump_block_fcp);
1420 break; 1256 break;
1421 default: 1257 default:
@@ -1425,7 +1261,7 @@ static void __dump_run(void *unused)
1425 1261
1426static void dump_run(struct shutdown_trigger *trigger) 1262static void dump_run(struct shutdown_trigger *trigger)
1427{ 1263{
1428 if (dump_method == DUMP_METHOD_NONE) 1264 if (dump_type == DUMP_TYPE_NONE)
1429 return; 1265 return;
1430 smp_send_stop(); 1266 smp_send_stop();
1431 smp_call_ipl_cpu(__dump_run, NULL); 1267 smp_call_ipl_cpu(__dump_run, NULL);
@@ -1457,8 +1293,6 @@ static int __init dump_fcp_init(void)
1457 1293
1458 if (!sclp_ipl_info.has_dump) 1294 if (!sclp_ipl_info.has_dump)
1459 return 0; /* LDIPL DUMP is not installed */ 1295 return 0; /* LDIPL DUMP is not installed */
1460 if (!diag308_set_works)
1461 return 0;
1462 dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); 1296 dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
1463 if (!dump_block_fcp) 1297 if (!dump_block_fcp)
1464 return -ENOMEM; 1298 return -ENOMEM;
@@ -1516,18 +1350,9 @@ static void dump_reipl_run(struct shutdown_trigger *trigger)
1516 dump_run(trigger); 1350 dump_run(trigger);
1517} 1351}
1518 1352
1519static int __init dump_reipl_init(void)
1520{
1521 if (!diag308_set_works)
1522 return -EOPNOTSUPP;
1523 else
1524 return 0;
1525}
1526
1527static struct shutdown_action __refdata dump_reipl_action = { 1353static struct shutdown_action __refdata dump_reipl_action = {
1528 .name = SHUTDOWN_ACTION_DUMP_REIPL_STR, 1354 .name = SHUTDOWN_ACTION_DUMP_REIPL_STR,
1529 .fn = dump_reipl_run, 1355 .fn = dump_reipl_run,
1530 .init = dump_reipl_init,
1531}; 1356};
1532 1357
1533/* 1358/*
@@ -1838,10 +1663,8 @@ static int __init s390_ipl_init(void)
1838 * case the system is booted from HMC. Fortunately in this case 1663 * case the system is booted from HMC. Fortunately in this case
1839 * READ SCP info provides the correct value. 1664 * READ SCP info provides the correct value.
1840 */ 1665 */
1841 if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 && 1666 if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 && ipl_block_valid)
1842 diag308_set_works) 1667 memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm, LOADPARM_LEN);
1843 memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm,
1844 LOADPARM_LEN);
1845 shutdown_actions_init(); 1668 shutdown_actions_init();
1846 shutdown_triggers_init(); 1669 shutdown_triggers_init();
1847 return 0; 1670 return 0;
@@ -1921,19 +1744,20 @@ static struct notifier_block on_panic_nb = {
1921 1744
1922void __init setup_ipl(void) 1745void __init setup_ipl(void)
1923{ 1746{
1747 BUILD_BUG_ON(sizeof(struct ipl_parameter_block) != PAGE_SIZE);
1748
1924 ipl_info.type = get_ipl_type(); 1749 ipl_info.type = get_ipl_type();
1925 switch (ipl_info.type) { 1750 switch (ipl_info.type) {
1926 case IPL_TYPE_CCW: 1751 case IPL_TYPE_CCW:
1927 ipl_info.data.ccw.dev_id.ssid = ipl_ssid; 1752 ipl_info.data.ccw.dev_id.ssid = ipl_block.ipl_info.ccw.ssid;
1928 ipl_info.data.ccw.dev_id.devno = ipl_devno; 1753 ipl_info.data.ccw.dev_id.devno = ipl_block.ipl_info.ccw.devno;
1929 break; 1754 break;
1930 case IPL_TYPE_FCP: 1755 case IPL_TYPE_FCP:
1931 case IPL_TYPE_FCP_DUMP: 1756 case IPL_TYPE_FCP_DUMP:
1932 ipl_info.data.fcp.dev_id.ssid = 0; 1757 ipl_info.data.fcp.dev_id.ssid = 0;
1933 ipl_info.data.fcp.dev_id.devno = 1758 ipl_info.data.fcp.dev_id.devno = ipl_block.ipl_info.fcp.devno;
1934 IPL_PARMBLOCK_START->ipl_info.fcp.devno; 1759 ipl_info.data.fcp.wwpn = ipl_block.ipl_info.fcp.wwpn;
1935 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn; 1760 ipl_info.data.fcp.lun = ipl_block.ipl_info.fcp.lun;
1936 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;
1937 break; 1761 break;
1938 case IPL_TYPE_NSS: 1762 case IPL_TYPE_NSS:
1939 case IPL_TYPE_UNKNOWN: 1763 case IPL_TYPE_UNKNOWN:
@@ -1943,85 +1767,21 @@ void __init setup_ipl(void)
1943 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb); 1767 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
1944} 1768}
1945 1769
1946void __init ipl_update_parameters(void) 1770void __init ipl_store_parameters(void)
1947{ 1771{
1948 int rc; 1772 int rc;
1949 1773
1950 rc = diag308(DIAG308_STORE, &ipl_block); 1774 rc = diag308(DIAG308_STORE, &ipl_block);
1951 if ((rc == DIAG308_RC_OK) || (rc == DIAG308_RC_NOCONFIG)) 1775 if (rc == DIAG308_RC_OK && ipl_block.hdr.version <= IPL_MAX_SUPPORTED_VERSION)
1952 diag308_set_works = 1; 1776 ipl_block_valid = 1;
1953}
1954
1955void __init ipl_verify_parameters(void)
1956{
1957 struct cio_iplinfo iplinfo;
1958
1959 if (cio_get_iplinfo(&iplinfo))
1960 return;
1961
1962 ipl_ssid = iplinfo.ssid;
1963 ipl_devno = iplinfo.devno;
1964 ipl_flags |= IPL_DEVNO_VALID;
1965 if (!iplinfo.is_qdio)
1966 return;
1967 ipl_flags |= IPL_PARMBLOCK_VALID;
1968}
1969
1970static LIST_HEAD(rcall);
1971static DEFINE_MUTEX(rcall_mutex);
1972
1973void register_reset_call(struct reset_call *reset)
1974{
1975 mutex_lock(&rcall_mutex);
1976 list_add(&reset->list, &rcall);
1977 mutex_unlock(&rcall_mutex);
1978}
1979EXPORT_SYMBOL_GPL(register_reset_call);
1980
1981void unregister_reset_call(struct reset_call *reset)
1982{
1983 mutex_lock(&rcall_mutex);
1984 list_del(&reset->list);
1985 mutex_unlock(&rcall_mutex);
1986}
1987EXPORT_SYMBOL_GPL(unregister_reset_call);
1988
1989static void do_reset_calls(void)
1990{
1991 struct reset_call *reset;
1992
1993 if (diag308_set_works) {
1994 diag308_reset();
1995 return;
1996 }
1997 list_for_each_entry(reset, &rcall, list)
1998 reset->fn();
1999} 1777}
2000 1778
2001void s390_reset_system(void) 1779void s390_reset_system(void)
2002{ 1780{
2003 struct lowcore *lc;
2004
2005 lc = (struct lowcore *)(unsigned long) store_prefix();
2006
2007 /* Stack for interrupt/machine check handler */
2008 lc->panic_stack = S390_lowcore.panic_stack;
2009
2010 /* Disable prefixing */ 1781 /* Disable prefixing */
2011 set_prefix(0); 1782 set_prefix(0);
2012 1783
2013 /* Disable lowcore protection */ 1784 /* Disable lowcore protection */
2014 __ctl_clear_bit(0,28); 1785 __ctl_clear_bit(0, 28);
2015 1786 diag308_reset();
2016 /* Set new machine check handler */
2017 S390_lowcore.mcck_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2018 S390_lowcore.mcck_new_psw.addr =
2019 (unsigned long) s390_base_mcck_handler;
2020
2021 /* Set new program check handler */
2022 S390_lowcore.program_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2023 S390_lowcore.program_new_psw.addr =
2024 (unsigned long) s390_base_pgm_handler;
2025
2026 do_reset_calls();
2027} 1787}
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index a80050bbe2e4..b7020e721ae3 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -20,7 +20,6 @@
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/pgalloc.h> 21#include <asm/pgalloc.h>
22#include <asm/smp.h> 22#include <asm/smp.h>
23#include <asm/reset.h>
24#include <asm/ipl.h> 23#include <asm/ipl.h>
25#include <asm/diag.h> 24#include <asm/diag.h>
26#include <asm/elf.h> 25#include <asm/elf.h>
@@ -253,6 +252,7 @@ void machine_shutdown(void)
253 252
254void machine_crash_shutdown(struct pt_regs *regs) 253void machine_crash_shutdown(struct pt_regs *regs)
255{ 254{
255 set_os_info_reipl_block();
256} 256}
257 257
258/* 258/*
diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c
index 14867ec5f726..f236ce8757e8 100644
--- a/arch/s390/kernel/nospec-branch.c
+++ b/arch/s390/kernel/nospec-branch.c
@@ -72,7 +72,7 @@ static int __init nospectre_v2_setup_early(char *str)
72} 72}
73early_param("nospectre_v2", nospectre_v2_setup_early); 73early_param("nospectre_v2", nospectre_v2_setup_early);
74 74
75static int __init spectre_v2_auto_early(void) 75void __init nospec_auto_detect(void)
76{ 76{
77 if (IS_ENABLED(CC_USING_EXPOLINE)) { 77 if (IS_ENABLED(CC_USING_EXPOLINE)) {
78 /* 78 /*
@@ -87,11 +87,7 @@ static int __init spectre_v2_auto_early(void)
87 * nobp setting decides what is done, this depends on the 87 * nobp setting decides what is done, this depends on the
88 * CONFIG_KERNEL_NP option and the nobp/nospec parameters. 88 * CONFIG_KERNEL_NP option and the nobp/nospec parameters.
89 */ 89 */
90 return 0;
91} 90}
92#ifdef CONFIG_EXPOLINE_AUTO
93early_initcall(spectre_v2_auto_early);
94#endif
95 91
96static int __init spectre_v2_setup_early(char *str) 92static int __init spectre_v2_setup_early(char *str)
97{ 93{
@@ -102,7 +98,7 @@ static int __init spectre_v2_setup_early(char *str)
102 if (str && !strncmp(str, "off", 3)) 98 if (str && !strncmp(str, "off", 3))
103 nospec_disable = 1; 99 nospec_disable = 1;
104 if (str && !strncmp(str, "auto", 4)) 100 if (str && !strncmp(str, "auto", 4))
105 spectre_v2_auto_early(); 101 nospec_auto_detect();
106 return 0; 102 return 0;
107} 103}
108early_param("spectre_v2", spectre_v2_setup_early); 104early_param("spectre_v2", spectre_v2_setup_early);
diff --git a/arch/s390/kernel/reipl.S b/arch/s390/kernel/reipl.S
index a40ebd1d29d0..73cc3750f0d3 100644
--- a/arch/s390/kernel/reipl.S
+++ b/arch/s390/kernel/reipl.S
@@ -75,90 +75,3 @@ ENTRY(store_status)
75 .align 8 75 .align 8
76.Lclkcmp: .quad 0x0000000000000000 76.Lclkcmp: .quad 0x0000000000000000
77 .previous 77 .previous
78
79#
80# do_reipl_asm
81# Parameter: r2 = schid of reipl device
82#
83
84ENTRY(do_reipl_asm)
85 basr %r13,0
86.Lpg0: lpswe .Lnewpsw-.Lpg0(%r13)
87.Lpg1: lgr %r3,%r2
88 larl %r2,.Lstatus
89 brasl %r14,store_status
90
91.Lstatus: lctlg %c6,%c6,.Lall-.Lpg0(%r13)
92 lgr %r1,%r2
93 mvc __LC_PGM_NEW_PSW(16),.Lpcnew-.Lpg0(%r13)
94 stsch .Lschib-.Lpg0(%r13)
95 oi .Lschib+5-.Lpg0(%r13),0x84
96.Lecs: xi .Lschib+27-.Lpg0(%r13),0x01
97 msch .Lschib-.Lpg0(%r13)
98 lghi %r0,5
99.Lssch: ssch .Liplorb-.Lpg0(%r13)
100 jz .L001
101 brct %r0,.Lssch
102 bas %r14,.Ldisab-.Lpg0(%r13)
103.L001: mvc __LC_IO_NEW_PSW(16),.Lionew-.Lpg0(%r13)
104.Ltpi: lpswe .Lwaitpsw-.Lpg0(%r13)
105.Lcont: c %r1,__LC_SUBCHANNEL_ID
106 jnz .Ltpi
107 clc __LC_IO_INT_PARM(4),.Liplorb-.Lpg0(%r13)
108 jnz .Ltpi
109 tsch .Liplirb-.Lpg0(%r13)
110 tm .Liplirb+9-.Lpg0(%r13),0xbf
111 jz .L002
112 bas %r14,.Ldisab-.Lpg0(%r13)
113.L002: tm .Liplirb+8-.Lpg0(%r13),0xf3
114 jz .L003
115 bas %r14,.Ldisab-.Lpg0(%r13)
116.L003: st %r1,__LC_SUBCHANNEL_ID
117 lhi %r1,0 # mode 0 = esa
118 slr %r0,%r0 # set cpuid to zero
119 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esa mode
120 lpsw 0
121.Ldisab: sll %r14,1
122 srl %r14,1 # need to kill hi bit to avoid specification exceptions.
123 st %r14,.Ldispsw+12-.Lpg0(%r13)
124 lpswe .Ldispsw-.Lpg0(%r13)
125 .align 8
126.Lall: .quad 0x00000000ff000000
127 .align 16
128/*
129 * These addresses have to be 31 bit otherwise
130 * the sigp will throw a specifcation exception
131 * when switching to ESA mode as bit 31 be set
132 * in the ESA psw.
133 * Bit 31 of the addresses has to be 0 for the
134 * 31bit lpswe instruction a fact they appear to have
135 * omitted from the pop.
136 */
137.Lnewpsw: .quad 0x0000000080000000
138 .quad .Lpg1
139.Lpcnew: .quad 0x0000000080000000
140 .quad .Lecs
141.Lionew: .quad 0x0000000080000000
142 .quad .Lcont
143.Lwaitpsw: .quad 0x0202000080000000
144 .quad .Ltpi
145.Ldispsw: .quad 0x0002000080000000
146 .quad 0x0000000000000000
147.Liplccws: .long 0x02000000,0x60000018
148 .long 0x08000008,0x20000001
149.Liplorb: .long 0x0049504c,0x0040ff80
150 .long 0x00000000+.Liplccws
151.Lschib: .long 0x00000000,0x00000000
152 .long 0x00000000,0x00000000
153 .long 0x00000000,0x00000000
154 .long 0x00000000,0x00000000
155 .long 0x00000000,0x00000000
156 .long 0x00000000,0x00000000
157.Liplirb: .long 0x00000000,0x00000000
158 .long 0x00000000,0x00000000
159 .long 0x00000000,0x00000000
160 .long 0x00000000,0x00000000
161 .long 0x00000000,0x00000000
162 .long 0x00000000,0x00000000
163 .long 0x00000000,0x00000000
164 .long 0x00000000,0x00000000
diff --git a/arch/s390/kernel/relocate_kernel.S b/arch/s390/kernel/relocate_kernel.S
index 9c2c96da23d0..c97c2d40fe15 100644
--- a/arch/s390/kernel/relocate_kernel.S
+++ b/arch/s390/kernel/relocate_kernel.S
@@ -29,33 +29,6 @@
29ENTRY(relocate_kernel) 29ENTRY(relocate_kernel)
30 basr %r13,0 # base address 30 basr %r13,0 # base address
31 .base: 31 .base:
32 stctg %c0,%c15,ctlregs-.base(%r13)
33 stmg %r0,%r15,gprregs-.base(%r13)
34 lghi %r0,3
35 sllg %r0,%r0,31
36 stg %r0,0x1d0(%r0)
37 la %r0,.back_pgm-.base(%r13)
38 stg %r0,0x1d8(%r0)
39 la %r1,load_psw-.base(%r13)
40 mvc 0(8,%r0),0(%r1)
41 la %r0,.back-.base(%r13)
42 st %r0,4(%r0)
43 oi 4(%r0),0x80
44 lghi %r0,0
45 diag %r0,%r0,0x308
46 .back:
47 lhi %r1,1 # mode 1 = esame
48 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esame mode
49 sam64 # switch to 64 bit addressing mode
50 basr %r13,0
51 .back_base:
52 oi have_diag308-.back_base(%r13),0x01
53 lctlg %c0,%c15,ctlregs-.back_base(%r13)
54 lmg %r0,%r15,gprregs-.back_base(%r13)
55 j .top
56 .back_pgm:
57 lmg %r0,%r15,gprregs-.base(%r13)
58 .top:
59 lghi %r7,PAGE_SIZE # load PAGE_SIZE in r7 32 lghi %r7,PAGE_SIZE # load PAGE_SIZE in r7
60 lghi %r9,PAGE_SIZE # load PAGE_SIZE in r9 33 lghi %r9,PAGE_SIZE # load PAGE_SIZE in r9
61 lg %r5,0(%r2) # read another word for indirection page 34 lg %r5,0(%r2) # read another word for indirection page
@@ -64,55 +37,36 @@ ENTRY(relocate_kernel)
64 je .indir_check # NO, goto "indir_check" 37 je .indir_check # NO, goto "indir_check"
65 lgr %r6,%r5 # r6 = r5 38 lgr %r6,%r5 # r6 = r5
66 nill %r6,0xf000 # mask it out and... 39 nill %r6,0xf000 # mask it out and...
67 j .top # ...next iteration 40 j .base # ...next iteration
68 .indir_check: 41 .indir_check:
69 tml %r5,0x2 # is it a indirection page? 42 tml %r5,0x2 # is it a indirection page?
70 je .done_test # NO, goto "done_test" 43 je .done_test # NO, goto "done_test"
71 nill %r5,0xf000 # YES, mask out, 44 nill %r5,0xf000 # YES, mask out,
72 lgr %r2,%r5 # move it into the right register, 45 lgr %r2,%r5 # move it into the right register,
73 j .top # and read next... 46 j .base # and read next...
74 .done_test: 47 .done_test:
75 tml %r5,0x4 # is it the done indicator? 48 tml %r5,0x4 # is it the done indicator?
76 je .source_test # NO! Well, then it should be the source indicator... 49 je .source_test # NO! Well, then it should be the source indicator...
77 j .done # ok, lets finish it here... 50 j .done # ok, lets finish it here...
78 .source_test: 51 .source_test:
79 tml %r5,0x8 # it should be a source indicator... 52 tml %r5,0x8 # it should be a source indicator...
80 je .top # NO, ignore it... 53 je .base # NO, ignore it...
81 lgr %r8,%r5 # r8 = r5 54 lgr %r8,%r5 # r8 = r5
82 nill %r8,0xf000 # masking 55 nill %r8,0xf000 # masking
83 0: mvcle %r6,%r8,0x0 # copy PAGE_SIZE bytes from r8 to r6 - pad with 0 56 0: mvcle %r6,%r8,0x0 # copy PAGE_SIZE bytes from r8 to r6 - pad with 0
84 jo 0b 57 jo 0b
85 j .top 58 j .base
86 .done: 59 .done:
87 sgr %r0,%r0 # clear register r0 60 sgr %r0,%r0 # clear register r0
88 la %r4,load_psw-.base(%r13) # load psw-address into the register 61 la %r4,load_psw-.base(%r13) # load psw-address into the register
89 o %r3,4(%r4) # or load address into psw 62 o %r3,4(%r4) # or load address into psw
90 st %r3,4(%r4) 63 st %r3,4(%r4)
91 mvc 0(8,%r0),0(%r4) # copy psw to absolute address 0 64 mvc 0(8,%r0),0(%r4) # copy psw to absolute address 0
92 tm have_diag308-.base(%r13),0x01
93 jno .no_diag308
94 diag %r0,%r0,0x308 65 diag %r0,%r0,0x308
95 .no_diag308:
96 sam31 # 31 bit mode
97 sr %r1,%r1 # erase register r1
98 sr %r2,%r2 # erase register r2
99 sigp %r1,%r2,SIGP_SET_ARCHITECTURE # set cpuid to zero
100 lpsw 0 # hopefully start new kernel...
101 66
102 .align 8 67 .align 8
103 load_psw: 68 load_psw:
104 .long 0x00080000,0x80000000 69 .long 0x00080000,0x80000000
105 ctlregs:
106 .rept 16
107 .quad 0
108 .endr
109 gprregs:
110 .rept 16
111 .quad 0
112 .endr
113 have_diag308:
114 .byte 0
115 .align 8
116 relocate_kernel_end: 70 relocate_kernel_end:
117 .align 8 71 .align 8
118 .globl relocate_kernel_len 72 .globl relocate_kernel_len
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 7b58a712f818..fc3b4aa185cc 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -894,6 +894,9 @@ void __init setup_arch(char **cmdline_p)
894 init_mm.end_data = (unsigned long) _edata; 894 init_mm.end_data = (unsigned long) _edata;
895 init_mm.brk = (unsigned long) _end; 895 init_mm.brk = (unsigned long) _end;
896 896
897 if (IS_ENABLED(CONFIG_EXPOLINE_AUTO))
898 nospec_auto_detect();
899
897 parse_early_param(); 900 parse_early_param();
898#ifdef CONFIG_CRASH_DUMP 901#ifdef CONFIG_CRASH_DUMP
899 /* Deactivate elfcorehdr= kernel parameter */ 902 /* Deactivate elfcorehdr= kernel parameter */