@@ -231,13 +231,22 @@ static unsigned int papr_smart_get_health(struct ndctl_cmd *cmd)
return 1 << (p->health.dimm_health - 1);
}
+static unsigned int papr_smart_get_shutdown_state(struct ndctl_cmd *cmd)
+{
+ struct dimm_priv *p = cmd->dimm->dimm_user_data;
+
+ /* Update dimm state and return f_flush */
+ return update_dimm_stats(cmd->dimm, cmd) ?
+ 0 : p->health.dimm_bad_shutdown;
+}
+
static unsigned int papr_smart_get_flags(struct ndctl_cmd *cmd)
{
/* In case of error return empty flags * */
if (update_dimm_stats(cmd->dimm, cmd))
return 0;
- return ND_SMART_HEALTH_VALID;
+ return ND_SMART_HEALTH_VALID | ND_SMART_SHUTDOWN_VALID;
}
static int papr_dimm_init(struct ndctl_dimm *dimm)
@@ -279,4 +288,5 @@ struct ndctl_dimm_ops * const papr_scm_dimm_ops = &(struct ndctl_dimm_ops) {
.smart_get_flags = papr_smart_get_flags,
.new_smart = papr_new_smart_health,
.smart_get_health = papr_smart_get_health,
+ .smart_get_shutdown_state = papr_smart_get_shutdown_state,
};
Provide support for dimm-op 'smart_get_shutdown_state' implemented as papr_smart_get_shutdown_state() to report a bad shutdown that couldn't flush contents of nvdimm to flash memory properly. Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> --- ndctl/lib/papr_scm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)