From: Santosh Sivaraj <santosh@fossix.org>
To: Linux NVDIMM <linux-nvdimm@lists.01.org>,
Vishal Verma <vishal.l.verma@intel.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Vaibhav Jain <vaibhav@linux.ibm.com>,
Shivaprasad G Bhat <sbhat@linux.ibm.com>,
Harish Sriram <harish@linux.ibm.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: Santosh Sivaraj <santosh@fossix.org>
Subject: [PATCH 7/7] ndtest: Add papr health related flags
Date: Tue, 22 Dec 2020 09:52:40 +0530 [thread overview]
Message-ID: <20201222042240.2983755-8-santosh@fossix.org> (raw)
In-Reply-To: <20201222042240.2983755-1-santosh@fossix.org>
sysfs attibutes to show health related flags are added.
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
tools/testing/nvdimm/test/ndtest.c | 41 ++++++++++++++++++++++++++++++
tools/testing/nvdimm/test/ndtest.h | 31 ++++++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index dc1e3636616a..6862915f1fb0 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -86,6 +86,9 @@ static struct ndtest_dimm dimm_group2[] = {
.uuid_str = "ca0817e2-b618-11ea-9db3-507b9ddc0f72",
.physical_id = 0,
.num_formats = 1,
+ .flags = PAPR_PMEM_UNARMED | PAPR_PMEM_EMPTY |
+ PAPR_PMEM_SAVE_FAILED | PAPR_PMEM_SHUTDOWN_DIRTY |
+ PAPR_PMEM_HEALTH_FATAL,
},
};
@@ -789,6 +792,40 @@ static umode_t ndtest_nvdimm_attr_visible(struct kobject *kobj,
return a->mode;
}
+static ssize_t flags_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct nvdimm *nvdimm = to_nvdimm(dev);
+ struct ndtest_dimm *dimm = nvdimm_provider_data(nvdimm);
+ struct seq_buf s;
+ u64 flags;
+
+ flags = dimm->flags;
+
+ seq_buf_init(&s, buf, PAGE_SIZE);
+ if (flags & PAPR_PMEM_UNARMED_MASK)
+ seq_buf_printf(&s, "not_armed ");
+
+ if (flags & PAPR_PMEM_BAD_SHUTDOWN_MASK)
+ seq_buf_printf(&s, "flush_fail ");
+
+ if (flags & PAPR_PMEM_BAD_RESTORE_MASK)
+ seq_buf_printf(&s, "restore_fail ");
+
+ if (flags & PAPR_PMEM_SAVE_MASK)
+ seq_buf_printf(&s, "save_fail ");
+
+ if (flags & PAPR_PMEM_SMART_EVENT_MASK)
+ seq_buf_printf(&s, "smart_notify ");
+
+
+ if (seq_buf_used(&s))
+ seq_buf_printf(&s, "\n");
+
+ return seq_buf_used(&s);
+}
+static DEVICE_ATTR_RO(flags);
+
static struct attribute *ndtest_nvdimm_attributes[] = {
&dev_attr_nvdimm_show_handle.attr,
&dev_attr_vendor.attr,
@@ -799,6 +836,7 @@ static struct attribute *ndtest_nvdimm_attributes[] = {
&dev_attr_formats.attr,
&dev_attr_format.attr,
&dev_attr_format1.attr,
+ &dev_attr_flags.attr,
NULL,
};
@@ -824,6 +862,9 @@ static int ndtest_dimm_register(struct ndtest_priv *priv,
set_bit(NDD_LABELING, &dimm_flags);
}
+ if (dimm->flags & PAPR_PMEM_UNARMED_MASK)
+ set_bit(NDD_UNARMED, &dimm_flags);
+
dimm->nvdimm = nvdimm_create(priv->bus, dimm,
ndtest_nvdimm_attribute_groups, dimm_flags,
NDTEST_SCM_DIMM_CMD_MASK, 0, NULL);
diff --git a/tools/testing/nvdimm/test/ndtest.h b/tools/testing/nvdimm/test/ndtest.h
index 8f27ad6f7319..2c54c9cbb90c 100644
--- a/tools/testing/nvdimm/test/ndtest.h
+++ b/tools/testing/nvdimm/test/ndtest.h
@@ -5,6 +5,37 @@
#include <linux/platform_device.h>
#include <linux/libnvdimm.h>
+/* SCM device is unable to persist memory contents */
+#define PAPR_PMEM_UNARMED (1ULL << (63 - 0))
+/* SCM device failed to persist memory contents */
+#define PAPR_PMEM_SHUTDOWN_DIRTY (1ULL << (63 - 1))
+/* SCM device contents are not persisted from previous IPL */
+#define PAPR_PMEM_EMPTY (1ULL << (63 - 3))
+#define PAPR_PMEM_HEALTH_CRITICAL (1ULL << (63 - 4))
+/* SCM device will be garded off next IPL due to failure */
+#define PAPR_PMEM_HEALTH_FATAL (1ULL << (63 - 5))
+/* SCM contents cannot persist due to current platform health status */
+#define PAPR_PMEM_HEALTH_UNHEALTHY (1ULL << (63 - 6))
+
+/* Bits status indicators for health bitmap indicating unarmed dimm */
+#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \
+ PAPR_PMEM_HEALTH_UNHEALTHY)
+
+#define PAPR_PMEM_SAVE_FAILED (1ULL << (63 - 10))
+
+/* Bits status indicators for health bitmap indicating unflushed dimm */
+#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)
+
+/* Bits status indicators for health bitmap indicating unrestored dimm */
+#define PAPR_PMEM_BAD_RESTORE_MASK (PAPR_PMEM_EMPTY)
+
+/* Bit status indicators for smart event notification */
+#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
+ PAPR_PMEM_HEALTH_FATAL | \
+ PAPR_PMEM_HEALTH_UNHEALTHY)
+
+#define PAPR_PMEM_SAVE_MASK (PAPR_PMEM_SAVE_FAILED)
+
struct ndtest_config;
struct ndtest_priv {
--
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2020-12-22 4:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-22 4:22 [0/7] PMEM device emulation without nfit depenency Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 1/7] testing/nvdimm: Add test module for non-nfit platforms Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 2/7] ndtest: Add compatability string to treat it as PAPR family Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 3/7] ndtest: Add dimms to the two buses Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 4/7] ndtest: Add dimm attributes Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 5/7] ndtest: Add regions and mappings to the test buses Santosh Sivaraj
2020-12-22 4:22 ` [PATCH 6/7] ndtest: Add nvdimm control functions Santosh Sivaraj
2020-12-22 4:22 ` Santosh Sivaraj [this message]
2020-12-22 4:25 ` [ndctl 1/5] libndctl: test enablement for non-nfit devices Santosh Sivaraj
2020-12-22 4:25 ` [ndctl 2/5] test: Don't skip tests if nfit modules are missing Santosh Sivaraj
2020-12-22 4:25 ` [ndctl 3/5] papr: Add support to parse save_fail flag for dimm Santosh Sivaraj
2021-01-28 1:16 ` Dan Williams
2021-02-25 5:53 ` Santosh Sivaraj
2020-12-22 4:25 ` [ndctl 4/5] test/libndctl: skip SMART tests on non-nfit devices Santosh Sivaraj
2020-12-22 4:25 ` [ndctl 5/5] Use page size as alignment value Santosh Sivaraj
2021-01-28 1:24 ` Dan Williams
2021-01-29 6:24 ` Santosh Sivaraj
2021-02-25 5:54 ` Santosh Sivaraj
2020-12-24 18:26 ` [0/7] PMEM device emulation without nfit depenency Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201222042240.2983755-8-santosh@fossix.org \
--to=santosh@fossix.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=harish@linux.ibm.com \
--cc=linux-nvdimm@lists.01.org \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.com \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).