summaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2018-01-31 12:45:49 -0700
committerRoss Zwisler <ross.zwisler@linux.intel.com>2018-02-01 15:01:15 -0700
commit96c3a239054a367d1a18581384985ab9e97c5ce7 (patch)
tree37c8ddbba2da8a1f8f5c6c9394c340613633fae7 /drivers/nvdimm
parent30e6d7bf29daa79d80711d35211c9b60894dbc44 (diff)
downloadop-kernel-dev-96c3a239054a367d1a18581384985ab9e97c5ce7.zip
op-kernel-dev-96c3a239054a367d1a18581384985ab9e97c5ce7.tar.gz
libnvdimm: expose platform persistence attribute for nd_region
Providing a sysfs attribute for nd_region that shows the persistence capabilities for the platform. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/region_devs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index abaf38c..e6d0191 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -528,6 +528,18 @@ static ssize_t resource_show(struct device *dev,
}
static DEVICE_ATTR_RO(resource);
+static ssize_t persistence_domain_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct nd_region *nd_region = to_nd_region(dev);
+ unsigned long flags = nd_region->flags;
+
+ return sprintf(buf, "%s%s\n",
+ flags & BIT(ND_REGION_PERSIST_CACHE) ? "cpu_cache " : "",
+ flags & BIT(ND_REGION_PERSIST_MEMCTRL) ? "memory_controller " : "");
+}
+static DEVICE_ATTR_RO(persistence_domain);
+
static struct attribute *nd_region_attributes[] = {
&dev_attr_size.attr,
&dev_attr_nstype.attr,
@@ -543,6 +555,7 @@ static struct attribute *nd_region_attributes[] = {
&dev_attr_init_namespaces.attr,
&dev_attr_badblocks.attr,
&dev_attr_resource.attr,
+ &dev_attr_persistence_domain.attr,
NULL,
};
OpenPOWER on IntegriCloud