@@ -56,13 +56,14 @@ struct shutdown_trigger {
5656};
5757
5858/*
59- * Five shutdown action types are supported:
59+ * The following shutdown action types are supported:
6060 */
6161#define SHUTDOWN_ACTION_IPL_STR "ipl"
6262#define SHUTDOWN_ACTION_REIPL_STR "reipl"
6363#define SHUTDOWN_ACTION_DUMP_STR "dump"
6464#define SHUTDOWN_ACTION_VMCMD_STR "vmcmd"
6565#define SHUTDOWN_ACTION_STOP_STR "stop"
66+ #define SHUTDOWN_ACTION_DUMP_REIPL_STR "dump_reipl"
6667
6768struct shutdown_action {
6869 char * name ;
@@ -146,6 +147,7 @@ static enum ipl_method reipl_method = REIPL_METHOD_DEFAULT;
146147static struct ipl_parameter_block * reipl_block_fcp ;
147148static struct ipl_parameter_block * reipl_block_ccw ;
148149static struct ipl_parameter_block * reipl_block_nss ;
150+ static struct ipl_parameter_block * reipl_block_actual ;
149151
150152static int dump_capabilities = DUMP_TYPE_NONE ;
151153static enum dump_type dump_type = DUMP_TYPE_NONE ;
@@ -835,6 +837,7 @@ static int reipl_set_type(enum ipl_type type)
835837 reipl_method = REIPL_METHOD_CCW_VM ;
836838 else
837839 reipl_method = REIPL_METHOD_CCW_CIO ;
840+ reipl_block_actual = reipl_block_ccw ;
838841 break ;
839842 case IPL_TYPE_FCP :
840843 if (diag308_set_works )
@@ -843,6 +846,7 @@ static int reipl_set_type(enum ipl_type type)
843846 reipl_method = REIPL_METHOD_FCP_RO_VM ;
844847 else
845848 reipl_method = REIPL_METHOD_FCP_RO_DIAG ;
849+ reipl_block_actual = reipl_block_fcp ;
846850 break ;
847851 case IPL_TYPE_FCP_DUMP :
848852 reipl_method = REIPL_METHOD_FCP_DUMP ;
@@ -852,6 +856,7 @@ static int reipl_set_type(enum ipl_type type)
852856 reipl_method = REIPL_METHOD_NSS_DIAG ;
853857 else
854858 reipl_method = REIPL_METHOD_NSS ;
859+ reipl_block_actual = reipl_block_nss ;
855860 break ;
856861 case IPL_TYPE_UNKNOWN :
857862 reipl_method = REIPL_METHOD_DEFAULT ;
@@ -1332,6 +1337,48 @@ static struct shutdown_action __refdata dump_action = {
13321337 .init = dump_init ,
13331338};
13341339
1340+ static void dump_reipl_run (struct shutdown_trigger * trigger )
1341+ {
1342+ preempt_disable ();
1343+ /*
1344+ * Bypass dynamic address translation (DAT) when storing IPL parameter
1345+ * information block address and checksum into the prefix area
1346+ * (corresponding to absolute addresses 0-8191).
1347+ * When enhanced DAT applies and the STE format control in one,
1348+ * the absolute address is formed without prefixing. In this case a
1349+ * normal store (stg/st) into the prefix area would no more match to
1350+ * absolute addresses 0-8191.
1351+ */
1352+ #ifdef CONFIG_64BIT
1353+ asm volatile ("sturg %0,%1"
1354+ :: "a" ((unsigned long ) reipl_block_actual ),
1355+ "a" (& lowcore_ptr [smp_processor_id ()]-> ipib ));
1356+ #else
1357+ asm volatile ("stura %0,%1"
1358+ :: "a" ((unsigned long ) reipl_block_actual ),
1359+ "a" (& lowcore_ptr [smp_processor_id ()]-> ipib ));
1360+ #endif
1361+ asm volatile ("stura %0,%1"
1362+ :: "a" (cksm (reipl_block_actual , reipl_block_actual -> hdr .len )),
1363+ "a" (& lowcore_ptr [smp_processor_id ()]-> ipib_checksum ));
1364+ preempt_enable ();
1365+ dump_run (trigger );
1366+ }
1367+
1368+ static int __init dump_reipl_init (void )
1369+ {
1370+ if (!diag308_set_works )
1371+ return - EOPNOTSUPP ;
1372+ else
1373+ return 0 ;
1374+ }
1375+
1376+ static struct shutdown_action __refdata dump_reipl_action = {
1377+ .name = SHUTDOWN_ACTION_DUMP_REIPL_STR ,
1378+ .fn = dump_reipl_run ,
1379+ .init = dump_reipl_init ,
1380+ };
1381+
13351382/*
13361383 * vmcmd shutdown action: Trigger vm command on shutdown.
13371384 */
@@ -1421,7 +1468,8 @@ static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR,
14211468/* action list */
14221469
14231470static struct shutdown_action * shutdown_actions_list [] = {
1424- & ipl_action , & reipl_action , & dump_action , & vmcmd_action , & stop_action };
1471+ & ipl_action , & reipl_action , & dump_reipl_action , & dump_action ,
1472+ & vmcmd_action , & stop_action };
14251473#define SHUTDOWN_ACTIONS_COUNT (sizeof(shutdown_actions_list) / sizeof(void *))
14261474
14271475/*
@@ -1434,11 +1482,11 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger,
14341482 size_t len )
14351483{
14361484 int i ;
1485+
14371486 for (i = 0 ; i < SHUTDOWN_ACTIONS_COUNT ; i ++ ) {
14381487 if (!shutdown_actions_list [i ])
14391488 continue ;
1440- if (strncmp (buf , shutdown_actions_list [i ]-> name ,
1441- strlen (shutdown_actions_list [i ]-> name )) == 0 ) {
1489+ if (sysfs_streq (buf , shutdown_actions_list [i ]-> name )) {
14421490 trigger -> action = shutdown_actions_list [i ];
14431491 return len ;
14441492 }
0 commit comments