ipl_tools: support clear attribute for nvme re-IPL

This patch adds support for the "clear" sysfs attribute for nvme re-IPL,
if available. This attribute allows to control whether the memory should
be cleared on re-IPL.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Gerald Schaefer
2020-06-23 19:08:50 +02:00
committed by Jan Höppner
parent 26c544998e
commit 0ecf18b66d
3 changed files with 16 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ static const char *const usage_chreipl =
" -s --nsid <NAMESPACE_ID> Namespace ID of NVME IPL device (decimal, default 1)\n"
" -b, --bootprog <BPROG> Bootprog specification\n"
" -L, --loadparm <PARM> Loadparm specification\n"
" -c, --clear 0|1 Control if memory is cleared on re-IPL\n"
"\n"
"Options for nss target:\n"
" -n, --name <NAME> Identifier of the NSS\n"
@@ -794,6 +795,11 @@ static void chreipl_nvme(void)
strlen(l.bootparms), BOOTPARMS_FCP_MAX);
}
if (l.reipl_clear >= 0) {
check_exists("reipl/nvme/clear", "NVME re-IPL clear attribute");
write_str(l.reipl_clear ? "1" : "0", "reipl/nvme/clear");
}
write_str_optional(l.loadparm, "reipl/nvme/loadparm", l.loadparm_set,
"loadparm");
write_str_optional(l.bootparms, "reipl/nvme/scp_data", l.bootparms_set,

View File

@@ -92,6 +92,7 @@ void print_nvme(int show_ipl, int dump)
char *path_loadparm = show_ipl ? "/sys/firmware/ipl/loadparm" :
"/sys/firmware/reipl/nvme/loadparm";
char loadparm[9], loadparm_path[PATH_MAX];
char *path_reipl_clear = "/sys/firmware/reipl/nvme/clear";
if (dump)
printf("%-12s nvme_dump\n", get_ipl_banner(show_ipl));
@@ -111,6 +112,8 @@ void print_nvme(int show_ipl, int dump)
}
if (access(path_bootparms, R_OK) == 0)
print_fw_str("Bootparms: \"%s\"\n", dir, "scp_data");
if (!show_ipl && access(path_reipl_clear, R_OK) == 0)
print_fw_str("clear: %s\n", dir, "clear");
}
void print_ccw(int show_ipl)

View File

@@ -238,6 +238,13 @@ configuration that is defined by the
boot menu. Instead it can be used to control higher level boot loaders
like GRUB. For more details refer to distribution specific documentation.
.TP
.BR "\-c" " or " "\-\-clear"
Specify whether memory should be cleared on re-IPL. Possible values are 0 to
disable and 1 to enable memory clearing on re-IPL.
Memory clearing is supported if the "clear" attribute is present in
/sys/firmware/reipl/nvme/.
.PP
\fBExamples:\fP
.br