diff options
author | Ross Zwisler <ross.zwisler@linux.intel.com> | 2018-02-03 00:26:26 -0700 |
---|---|---|
committer | Ross Zwisler <ross.zwisler@linux.intel.com> | 2018-02-03 00:26:26 -0700 |
commit | ee95f4059a833839bf52972191b2d4c3d3cec552 (patch) | |
tree | a1c8587d9b82e64a75dde376a90a3d69b0f4847a /drivers/nvdimm | |
parent | d121f07691415df824e6b60520f782f6d13b3c81 (diff) | |
parent | f81e1d35a6e36d30888c46283b8dd1022e847124 (diff) | |
download | op-kernel-dev-ee95f4059a833839bf52972191b2d4c3d3cec552.zip op-kernel-dev-ee95f4059a833839bf52972191b2d4c3d3cec552.tar.gz |
Merge branch 'for-4.16/nfit' into libnvdimm-for-next
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/pmem.c | 4 | ||||
-rw-r--r-- | drivers/nvdimm/region_devs.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index cf074b1..10041ac 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -35,6 +35,7 @@ #include "pmem.h" #include "pfn.h" #include "nd.h" +#include "nd-core.h" static struct device *to_dev(struct pmem_device *pmem) { @@ -334,7 +335,8 @@ static int pmem_attach_disk(struct device *dev, dev_warn(dev, "unable to guarantee persistence of writes\n"); fua = 0; } - wbc = nvdimm_has_cache(nd_region); + wbc = nvdimm_has_cache(nd_region) && + !test_bit(ND_REGION_PERSIST_CACHE, &nd_region->flags); if (!devm_request_mem_region(dev, res->start, resource_size(res), dev_name(&ndns->dev))) { 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, }; |