aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/namespace_devs.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-03-11 13:15:36 -0500
committerDan Williams <dan.j.williams@intel.com>2016-05-09 18:35:42 -0400
commitcd03412a51ac4cb3001a8cdfae4560c9602f3387 (patch)
treec2d501759d7d96fab9a0f70eefba139876bb12de /drivers/nvdimm/namespace_devs.c
parent0bfb8dd3edd6e423b5053c86e10c97e92cf205ea (diff)
libnvdimm, dax: introduce device-dax infrastructure
Device DAX is the device-centric analogue of Filesystem DAX (CONFIG_FS_DAX). It allows persistent memory ranges to be allocated and mapped without need of an intervening file system. This initial infrastructure arranges for a libnvdimm pfn-device to be represented as a different device-type so that it can be attached to a driver other than the pmem driver. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r--drivers/nvdimm/namespace_devs.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index e5ad5162bf34..c5e3196c45b0 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -1288,6 +1288,8 @@ static ssize_t mode_show(struct device *dev,
1288 mode = "safe"; 1288 mode = "safe";
1289 else if (claim && is_nd_pfn(claim)) 1289 else if (claim && is_nd_pfn(claim))
1290 mode = "memory"; 1290 mode = "memory";
1291 else if (claim && is_nd_dax(claim))
1292 mode = "dax";
1291 else if (!claim && pmem_should_map_pages(dev)) 1293 else if (!claim && pmem_should_map_pages(dev))
1292 mode = "memory"; 1294 mode = "memory";
1293 else 1295 else
@@ -1379,14 +1381,17 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
1379{ 1381{
1380 struct nd_btt *nd_btt = is_nd_btt(dev) ? to_nd_btt(dev) : NULL; 1382 struct nd_btt *nd_btt = is_nd_btt(dev) ? to_nd_btt(dev) : NULL;
1381 struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL; 1383 struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL;
1384 struct nd_dax *nd_dax = is_nd_dax(dev) ? to_nd_dax(dev) : NULL;
1382 struct nd_namespace_common *ndns = NULL; 1385 struct nd_namespace_common *ndns = NULL;
1383 resource_size_t size; 1386 resource_size_t size;
1384 1387
1385 if (nd_btt || nd_pfn) { 1388 if (nd_btt || nd_pfn || nd_dax) {
1386 if (nd_btt) 1389 if (nd_btt)
1387 ndns = nd_btt->ndns; 1390 ndns = nd_btt->ndns;
1388 else if (nd_pfn) 1391 else if (nd_pfn)
1389 ndns = nd_pfn->ndns; 1392 ndns = nd_pfn->ndns;
1393 else if (nd_dax)
1394 ndns = nd_dax->nd_pfn.ndns;
1390 1395
1391 if (!ndns) 1396 if (!ndns)
1392 return ERR_PTR(-ENODEV); 1397 return ERR_PTR(-ENODEV);
@@ -1779,6 +1784,18 @@ void nd_region_create_blk_seed(struct nd_region *nd_region)
1779 nd_device_register(nd_region->ns_seed); 1784 nd_device_register(nd_region->ns_seed);
1780} 1785}
1781 1786
1787void nd_region_create_dax_seed(struct nd_region *nd_region)
1788{
1789 WARN_ON(!is_nvdimm_bus_locked(&nd_region->dev));
1790 nd_region->dax_seed = nd_dax_create(nd_region);
1791 /*
1792 * Seed creation failures are not fatal, provisioning is simply
1793 * disabled until memory becomes available
1794 */
1795 if (!nd_region->dax_seed)
1796 dev_err(&nd_region->dev, "failed to create dax namespace\n");
1797}
1798
1782void nd_region_create_pfn_seed(struct nd_region *nd_region) 1799void nd_region_create_pfn_seed(struct nd_region *nd_region)
1783{ 1800{
1784 WARN_ON(!is_nvdimm_bus_locked(&nd_region->dev)); 1801 WARN_ON(!is_nvdimm_bus_locked(&nd_region->dev));