Skip to content

Commit d485235

Browse files
Vasily GorbikMartin Schwidefsky
authored andcommitted
s390: assume diag308 set always works
diag308 set has been available for many machine generations, and alternative reipl code paths has not been exercised and seems to be broken without noticing for a while now. So, cleaning up all obsolete reipl methods except currently used ones, assuming that diag308 set always works. Also removing not longer needed reset callbacks. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent ecc0df0 commit d485235

File tree

11 files changed

+16
-630
lines changed

11 files changed

+16
-630
lines changed

arch/s390/include/asm/cio.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ static inline u8 pathmask_to_pos(u8 mask)
328328
void channel_subsystem_reinit(void);
329329
extern void css_schedule_reprobe(void);
330330

331-
extern void reipl_ccw_dev(struct ccw_dev_id *id);
332-
333331
/* Function from drivers/s390/cio/chsc.c */
334332
int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta);
335333
int chsc_sstpi(void *page, void *result, size_t size);

arch/s390/include/asm/ipl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct save_area * __init save_area_boot_cpu(void);
8787
void __init save_area_add_regs(struct save_area *, void *regs);
8888
void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
8989

90+
extern void s390_reset_system(void);
9091
extern void do_reipl(void);
9192
extern void do_halt(void);
9293
extern void do_poff(void);

arch/s390/include/asm/reset.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

arch/s390/kernel/ipl.c

Lines changed: 11 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <asm/setup.h>
2626
#include <asm/cpcmd.h>
2727
#include <asm/ebcdic.h>
28-
#include <asm/reset.h>
2928
#include <asm/sclp.h>
3029
#include <asm/checksum.h>
3130
#include <asm/debug.h>
@@ -119,29 +118,20 @@ static char *dump_type_str(enum dump_type type)
119118
}
120119

121120
enum ipl_method {
122-
REIPL_METHOD_CCW_CIO,
123121
REIPL_METHOD_CCW_DIAG,
124-
REIPL_METHOD_CCW_VM,
125-
REIPL_METHOD_FCP_RO_DIAG,
126-
REIPL_METHOD_FCP_RW_DIAG,
127-
REIPL_METHOD_FCP_RO_VM,
122+
REIPL_METHOD_FCP_DIAG,
128123
REIPL_METHOD_FCP_DUMP,
129-
REIPL_METHOD_NSS,
130124
REIPL_METHOD_NSS_DIAG,
131125
REIPL_METHOD_DEFAULT,
132126
};
133127

134128
enum dump_method {
135129
DUMP_METHOD_NONE,
136-
DUMP_METHOD_CCW_CIO,
137130
DUMP_METHOD_CCW_DIAG,
138-
DUMP_METHOD_CCW_VM,
139131
DUMP_METHOD_FCP_DIAG,
140132
};
141133

142134
static int ipl_block_valid;
143-
static int diag308_set_works;
144-
145135
static struct ipl_parameter_block ipl_block;
146136

147137
static int reipl_capabilities = IPL_TYPE_UNKNOWN;
@@ -256,14 +246,6 @@ static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
256246
sys_##_prefix##_##_name##_show, \
257247
sys_##_prefix##_##_name##_store)
258248

259-
static void make_attrs_ro(struct attribute **attrs)
260-
{
261-
while (*attrs) {
262-
(*attrs)->mode = S_IRUGO;
263-
attrs++;
264-
}
265-
}
266-
267249
/*
268250
* ipl section
269251
*/
@@ -541,10 +523,6 @@ static void __ipl_run(void *unused)
541523
{
542524
__bpon();
543525
diag308(DIAG308_LOAD_CLEAR, NULL);
544-
if (MACHINE_IS_VM)
545-
__cpcmd("IPL", NULL, 0, NULL);
546-
else if (ipl_info.type == IPL_TYPE_CCW)
547-
reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
548526
}
549527

550528
static void ipl_run(struct shutdown_trigger *trigger)
@@ -951,31 +929,18 @@ static int reipl_set_type(enum ipl_type type)
951929

952930
switch(type) {
953931
case IPL_TYPE_CCW:
954-
if (diag308_set_works)
955-
reipl_method = REIPL_METHOD_CCW_DIAG;
956-
else if (MACHINE_IS_VM)
957-
reipl_method = REIPL_METHOD_CCW_VM;
958-
else
959-
reipl_method = REIPL_METHOD_CCW_CIO;
932+
reipl_method = REIPL_METHOD_CCW_DIAG;
960933
set_reipl_block_actual(reipl_block_ccw);
961934
break;
962935
case IPL_TYPE_FCP:
963-
if (diag308_set_works)
964-
reipl_method = REIPL_METHOD_FCP_RW_DIAG;
965-
else if (MACHINE_IS_VM)
966-
reipl_method = REIPL_METHOD_FCP_RO_VM;
967-
else
968-
reipl_method = REIPL_METHOD_FCP_RO_DIAG;
936+
reipl_method = REIPL_METHOD_FCP_DIAG;
969937
set_reipl_block_actual(reipl_block_fcp);
970938
break;
971939
case IPL_TYPE_FCP_DUMP:
972940
reipl_method = REIPL_METHOD_FCP_DUMP;
973941
break;
974942
case IPL_TYPE_NSS:
975-
if (diag308_set_works)
976-
reipl_method = REIPL_METHOD_NSS_DIAG;
977-
else
978-
reipl_method = REIPL_METHOD_NSS;
943+
reipl_method = REIPL_METHOD_NSS_DIAG;
979944
set_reipl_block_actual(reipl_block_nss);
980945
break;
981946
case IPL_TYPE_UNKNOWN:
@@ -1015,74 +980,22 @@ static struct kobj_attribute reipl_type_attr =
1015980
static struct kset *reipl_kset;
1016981
static struct kset *reipl_fcp_kset;
1017982

1018-
static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
1019-
const enum ipl_method m)
1020-
{
1021-
char loadparm[LOADPARM_LEN + 1] = {};
1022-
char vmparm[DIAG308_VMPARM_SIZE + 1] = {};
1023-
char nss_name[NSS_NAME_SIZE + 1] = {};
1024-
size_t pos = 0;
1025-
1026-
reipl_get_ascii_loadparm(loadparm, ipb);
1027-
reipl_get_ascii_nss_name(nss_name, ipb);
1028-
reipl_get_ascii_vmparm(vmparm, sizeof(vmparm), ipb);
1029-
1030-
switch (m) {
1031-
case REIPL_METHOD_CCW_VM:
1032-
pos = sprintf(dst, "IPL %X CLEAR", ipb->ipl_info.ccw.devno);
1033-
break;
1034-
case REIPL_METHOD_NSS:
1035-
pos = sprintf(dst, "IPL %s", nss_name);
1036-
break;
1037-
default:
1038-
break;
1039-
}
1040-
if (strlen(loadparm) > 0)
1041-
pos += sprintf(dst + pos, " LOADPARM '%s'", loadparm);
1042-
if (strlen(vmparm) > 0)
1043-
sprintf(dst + pos, " PARM %s", vmparm);
1044-
}
1045-
1046983
static void __reipl_run(void *unused)
1047984
{
1048-
struct ccw_dev_id devid;
1049-
static char buf[128];
1050-
1051985
switch (reipl_method) {
1052-
case REIPL_METHOD_CCW_CIO:
1053-
devid.ssid = reipl_block_ccw->ipl_info.ccw.ssid;
1054-
devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
1055-
reipl_ccw_dev(&devid);
1056-
break;
1057-
case REIPL_METHOD_CCW_VM:
1058-
get_ipl_string(buf, reipl_block_ccw, REIPL_METHOD_CCW_VM);
1059-
__cpcmd(buf, NULL, 0, NULL);
1060-
break;
1061986
case REIPL_METHOD_CCW_DIAG:
1062987
diag308(DIAG308_SET, reipl_block_ccw);
1063988
diag308(DIAG308_LOAD_CLEAR, NULL);
1064989
break;
1065-
case REIPL_METHOD_FCP_RW_DIAG:
990+
case REIPL_METHOD_FCP_DIAG:
1066991
diag308(DIAG308_SET, reipl_block_fcp);
1067992
diag308(DIAG308_LOAD_CLEAR, NULL);
1068993
break;
1069-
case REIPL_METHOD_FCP_RO_DIAG:
1070-
diag308(DIAG308_LOAD_CLEAR, NULL);
1071-
break;
1072-
case REIPL_METHOD_FCP_RO_VM:
1073-
__cpcmd("IPL", NULL, 0, NULL);
1074-
break;
1075994
case REIPL_METHOD_NSS_DIAG:
1076995
diag308(DIAG308_SET, reipl_block_nss);
1077996
diag308(DIAG308_LOAD_CLEAR, NULL);
1078997
break;
1079-
case REIPL_METHOD_NSS:
1080-
get_ipl_string(buf, reipl_block_nss, REIPL_METHOD_NSS);
1081-
__cpcmd(buf, NULL, 0, NULL);
1082-
break;
1083998
case REIPL_METHOD_DEFAULT:
1084-
if (MACHINE_IS_VM)
1085-
__cpcmd("IPL", NULL, 0, NULL);
1086999
diag308(DIAG308_LOAD_CLEAR, NULL);
10871000
break;
10881001
case REIPL_METHOD_FCP_DUMP:
@@ -1138,9 +1051,6 @@ static int __init reipl_nss_init(void)
11381051
if (!reipl_block_nss)
11391052
return -ENOMEM;
11401053

1141-
if (!diag308_set_works)
1142-
sys_reipl_nss_vmparm_attr.attr.mode = S_IRUGO;
1143-
11441054
rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group);
11451055
if (rc)
11461056
return rc;
@@ -1158,17 +1068,9 @@ static int __init reipl_ccw_init(void)
11581068
if (!reipl_block_ccw)
11591069
return -ENOMEM;
11601070

1161-
if (MACHINE_IS_VM) {
1162-
if (!diag308_set_works)
1163-
sys_reipl_ccw_vmparm_attr.attr.mode = S_IRUGO;
1164-
rc = sysfs_create_group(&reipl_kset->kobj,
1165-
&reipl_ccw_attr_group_vm);
1166-
} else {
1167-
if(!diag308_set_works)
1168-
sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO;
1169-
rc = sysfs_create_group(&reipl_kset->kobj,
1170-
&reipl_ccw_attr_group_lpar);
1171-
}
1071+
rc = sysfs_create_group(&reipl_kset->kobj,
1072+
MACHINE_IS_VM ? &reipl_ccw_attr_group_vm
1073+
: &reipl_ccw_attr_group_lpar);
11721074
if (rc)
11731075
return rc;
11741076

@@ -1187,14 +1089,6 @@ static int __init reipl_fcp_init(void)
11871089
{
11881090
int rc;
11891091

1190-
if (!diag308_set_works) {
1191-
if (ipl_info.type == IPL_TYPE_FCP) {
1192-
make_attrs_ro(reipl_fcp_attrs);
1193-
sys_reipl_fcp_scp_data_attr.attr.mode = S_IRUGO;
1194-
} else
1195-
return 0;
1196-
}
1197-
11981092
reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
11991093
if (!reipl_block_fcp)
12001094
return -ENOMEM;
@@ -1339,12 +1233,7 @@ static int dump_set_type(enum dump_type type)
13391233
return -EINVAL;
13401234
switch (type) {
13411235
case DUMP_TYPE_CCW:
1342-
if (diag308_set_works)
1343-
dump_method = DUMP_METHOD_CCW_DIAG;
1344-
else if (MACHINE_IS_VM)
1345-
dump_method = DUMP_METHOD_CCW_VM;
1346-
else
1347-
dump_method = DUMP_METHOD_CCW_CIO;
1236+
dump_method = DUMP_METHOD_CCW_DIAG;
13481237
break;
13491238
case DUMP_TYPE_FCP:
13501239
dump_method = DUMP_METHOD_FCP_DIAG;
@@ -1394,21 +1283,7 @@ static void diag308_dump(void *dump_block)
13941283

13951284
static void __dump_run(void *unused)
13961285
{
1397-
struct ccw_dev_id devid;
1398-
static char buf[100];
1399-
14001286
switch (dump_method) {
1401-
case DUMP_METHOD_CCW_CIO:
1402-
devid.ssid = dump_block_ccw->ipl_info.ccw.ssid;
1403-
devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1404-
reipl_ccw_dev(&devid);
1405-
break;
1406-
case DUMP_METHOD_CCW_VM:
1407-
sprintf(buf, "STORE STATUS");
1408-
__cpcmd(buf, NULL, 0, NULL);
1409-
sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
1410-
__cpcmd(buf, NULL, 0, NULL);
1411-
break;
14121287
case DUMP_METHOD_CCW_DIAG:
14131288
diag308_dump(dump_block_ccw);
14141289
break;
@@ -1454,8 +1329,6 @@ static int __init dump_fcp_init(void)
14541329

14551330
if (!sclp_ipl_info.has_dump)
14561331
return 0; /* LDIPL DUMP is not installed */
1457-
if (!diag308_set_works)
1458-
return 0;
14591332
dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
14601333
if (!dump_block_fcp)
14611334
return -ENOMEM;
@@ -1513,18 +1386,9 @@ static void dump_reipl_run(struct shutdown_trigger *trigger)
15131386
dump_run(trigger);
15141387
}
15151388

1516-
static int __init dump_reipl_init(void)
1517-
{
1518-
if (!diag308_set_works)
1519-
return -EOPNOTSUPP;
1520-
else
1521-
return 0;
1522-
}
1523-
15241389
static struct shutdown_action __refdata dump_reipl_action = {
15251390
.name = SHUTDOWN_ACTION_DUMP_REIPL_STR,
15261391
.fn = dump_reipl_run,
1527-
.init = dump_reipl_init,
15281392
};
15291393

15301394
/*
@@ -1944,67 +1808,16 @@ void __init ipl_store_parameters(void)
19441808
int rc;
19451809

19461810
rc = diag308(DIAG308_STORE, &ipl_block);
1947-
if ((rc == DIAG308_RC_OK) || (rc == DIAG308_RC_NOCONFIG))
1948-
diag308_set_works = 1;
19491811
if (rc == DIAG308_RC_OK && ipl_block.hdr.version <= IPL_MAX_SUPPORTED_VERSION)
19501812
ipl_block_valid = 1;
19511813
}
19521814

1953-
static LIST_HEAD(rcall);
1954-
static DEFINE_MUTEX(rcall_mutex);
1955-
1956-
void register_reset_call(struct reset_call *reset)
1957-
{
1958-
mutex_lock(&rcall_mutex);
1959-
list_add(&reset->list, &rcall);
1960-
mutex_unlock(&rcall_mutex);
1961-
}
1962-
EXPORT_SYMBOL_GPL(register_reset_call);
1963-
1964-
void unregister_reset_call(struct reset_call *reset)
1965-
{
1966-
mutex_lock(&rcall_mutex);
1967-
list_del(&reset->list);
1968-
mutex_unlock(&rcall_mutex);
1969-
}
1970-
EXPORT_SYMBOL_GPL(unregister_reset_call);
1971-
1972-
static void do_reset_calls(void)
1973-
{
1974-
struct reset_call *reset;
1975-
1976-
if (diag308_set_works) {
1977-
diag308_reset();
1978-
return;
1979-
}
1980-
list_for_each_entry(reset, &rcall, list)
1981-
reset->fn();
1982-
}
1983-
19841815
void s390_reset_system(void)
19851816
{
1986-
struct lowcore *lc;
1987-
1988-
lc = (struct lowcore *)(unsigned long) store_prefix();
1989-
1990-
/* Stack for interrupt/machine check handler */
1991-
lc->panic_stack = S390_lowcore.panic_stack;
1992-
19931817
/* Disable prefixing */
19941818
set_prefix(0);
19951819

19961820
/* Disable lowcore protection */
1997-
__ctl_clear_bit(0,28);
1998-
1999-
/* Set new machine check handler */
2000-
S390_lowcore.mcck_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2001-
S390_lowcore.mcck_new_psw.addr =
2002-
(unsigned long) s390_base_mcck_handler;
2003-
2004-
/* Set new program check handler */
2005-
S390_lowcore.program_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2006-
S390_lowcore.program_new_psw.addr =
2007-
(unsigned long) s390_base_pgm_handler;
2008-
2009-
do_reset_calls();
1821+
__ctl_clear_bit(0, 28);
1822+
diag308_reset();
20101823
}

0 commit comments

Comments
 (0)