Skip to content

Commit 96c3a23

Browse files
davejiangRoss Zwisler
authored andcommitted
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 <[email protected]> Reviewed-by: Ross Zwisler <[email protected]> Signed-off-by: Ross Zwisler <[email protected]>
1 parent 30e6d7b commit 96c3a23

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/nvdimm/region_devs.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ static ssize_t resource_show(struct device *dev,
528528
}
529529
static DEVICE_ATTR_RO(resource);
530530

531+
static ssize_t persistence_domain_show(struct device *dev,
532+
struct device_attribute *attr, char *buf)
533+
{
534+
struct nd_region *nd_region = to_nd_region(dev);
535+
unsigned long flags = nd_region->flags;
536+
537+
return sprintf(buf, "%s%s\n",
538+
flags & BIT(ND_REGION_PERSIST_CACHE) ? "cpu_cache " : "",
539+
flags & BIT(ND_REGION_PERSIST_MEMCTRL) ? "memory_controller " : "");
540+
}
541+
static DEVICE_ATTR_RO(persistence_domain);
542+
531543
static struct attribute *nd_region_attributes[] = {
532544
&dev_attr_size.attr,
533545
&dev_attr_nstype.attr,
@@ -543,6 +555,7 @@ static struct attribute *nd_region_attributes[] = {
543555
&dev_attr_init_namespaces.attr,
544556
&dev_attr_badblocks.attr,
545557
&dev_attr_resource.attr,
558+
&dev_attr_persistence_domain.attr,
546559
NULL,
547560
};
548561

0 commit comments

Comments
 (0)