nd_pfn 22 drivers/dax/pmem/core.c struct nd_pfn *nd_pfn = &nd_dax->nd_pfn; nd_pfn 34 drivers/dax/pmem/core.c rc = nvdimm_setup_pfn(nd_pfn, &pgmap); nd_pfn 40 drivers/dax/pmem/core.c pfn_sb = nd_pfn->pfn_sb; nd_pfn 908 drivers/nvdimm/bus.c struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL; nd_pfn 920 drivers/nvdimm/bus.c if (nd_btt || nd_pfn || nd_dax) { nd_pfn 923 drivers/nvdimm/bus.c else if (nd_pfn) nd_pfn 924 drivers/nvdimm/bus.c ndns = nd_pfn->ndns; nd_pfn 926 drivers/nvdimm/bus.c ndns = nd_dax->nd_pfn.ndns; nd_pfn 93 drivers/nvdimm/claim.c struct nd_pfn *to_nd_pfn_safe(struct device *dev) nd_pfn 105 drivers/nvdimm/claim.c return &nd_dax->nd_pfn; nd_pfn 126 drivers/nvdimm/claim.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 128 drivers/nvdimm/claim.c kfree(nd_pfn->uuid); nd_pfn 129 drivers/nvdimm/claim.c nd_pfn->uuid = NULL; nd_pfn 130 drivers/nvdimm/claim.c nd_pfn->mode = PFN_MODE_NONE; nd_pfn 17 drivers/nvdimm/dax_devs.c struct nd_pfn *nd_pfn = &nd_dax->nd_pfn; nd_pfn 20 drivers/nvdimm/dax_devs.c nd_detach_ndns(dev, &nd_pfn->ndns); nd_pfn 21 drivers/nvdimm/dax_devs.c ida_simple_remove(&nd_region->dax_ida, nd_pfn->id); nd_pfn 22 drivers/nvdimm/dax_devs.c kfree(nd_pfn->uuid); nd_pfn 39 drivers/nvdimm/dax_devs.c struct nd_dax *nd_dax = container_of(dev, struct nd_dax, nd_pfn.dev); nd_pfn 55 drivers/nvdimm/dax_devs.c struct nd_pfn *nd_pfn; nd_pfn 63 drivers/nvdimm/dax_devs.c nd_pfn = &nd_dax->nd_pfn; nd_pfn 64 drivers/nvdimm/dax_devs.c nd_pfn->id = ida_simple_get(&nd_region->dax_ida, 0, 0, GFP_KERNEL); nd_pfn 65 drivers/nvdimm/dax_devs.c if (nd_pfn->id < 0) { nd_pfn 70 drivers/nvdimm/dax_devs.c dev = &nd_pfn->dev; nd_pfn 71 drivers/nvdimm/dax_devs.c dev_set_name(dev, "dax%d.%d", nd_region->id, nd_pfn->id); nd_pfn 89 drivers/nvdimm/dax_devs.c dev = nd_pfn_devinit(&nd_dax->nd_pfn, NULL); nd_pfn 99 drivers/nvdimm/dax_devs.c struct nd_pfn *nd_pfn; nd_pfn 116 drivers/nvdimm/dax_devs.c nd_pfn = &nd_dax->nd_pfn; nd_pfn 117 drivers/nvdimm/dax_devs.c dax_dev = nd_pfn_devinit(nd_pfn, ndns); nd_pfn 122 drivers/nvdimm/dax_devs.c nd_pfn->pfn_sb = pfn_sb; nd_pfn 123 drivers/nvdimm/dax_devs.c rc = nd_pfn_validate(nd_pfn, DAX_SIG); nd_pfn 126 drivers/nvdimm/dax_devs.c nd_detach_ndns(dax_dev, &nd_pfn->ndns); nd_pfn 94 drivers/nvdimm/namespace_devs.c struct nd_pfn *nd_pfn = to_nd_pfn(dev); nd_pfn 96 drivers/nvdimm/namespace_devs.c uuid2 = nd_pfn->uuid; nd_pfn 1686 drivers/nvdimm/namespace_devs.c struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL; nd_pfn 1691 drivers/nvdimm/namespace_devs.c if (nd_btt || nd_pfn || nd_dax) { nd_pfn 1694 drivers/nvdimm/namespace_devs.c else if (nd_pfn) nd_pfn 1695 drivers/nvdimm/namespace_devs.c ndns = nd_pfn->ndns; nd_pfn 1697 drivers/nvdimm/namespace_devs.c ndns = nd_dax->nd_pfn.ndns; nd_pfn 171 drivers/nvdimm/nd-core.h struct nd_pfn *to_nd_pfn_safe(struct device *dev); nd_pfn 212 drivers/nvdimm/nd.h struct nd_pfn nd_pfn; nd_pfn 289 drivers/nvdimm/nd.h struct nd_pfn *to_nd_pfn(struct device *dev); nd_pfn 297 drivers/nvdimm/nd.h struct device *nd_pfn_devinit(struct nd_pfn *nd_pfn, nd_pfn 299 drivers/nvdimm/nd.h int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig); nd_pfn 318 drivers/nvdimm/nd.h static inline int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) nd_pfn 378 drivers/nvdimm/nd.h int nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap); nd_pfn 382 drivers/nvdimm/nd.h static inline int nvdimm_setup_pfn(struct nd_pfn *nd_pfn, nd_pfn 20 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn(dev); nd_pfn 23 drivers/nvdimm/pfn_devs.c nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns); nd_pfn 24 drivers/nvdimm/pfn_devs.c ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id); nd_pfn 25 drivers/nvdimm/pfn_devs.c kfree(nd_pfn->uuid); nd_pfn 26 drivers/nvdimm/pfn_devs.c kfree(nd_pfn); nd_pfn 40 drivers/nvdimm/pfn_devs.c struct nd_pfn *to_nd_pfn(struct device *dev) nd_pfn 42 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = container_of(dev, struct nd_pfn, dev); nd_pfn 45 drivers/nvdimm/pfn_devs.c return nd_pfn; nd_pfn 52 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 54 drivers/nvdimm/pfn_devs.c switch (nd_pfn->mode) { nd_pfn 67 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 79 drivers/nvdimm/pfn_devs.c nd_pfn->mode = PFN_MODE_PMEM; nd_pfn 82 drivers/nvdimm/pfn_devs.c nd_pfn->mode = PFN_MODE_RAM; nd_pfn 85 drivers/nvdimm/pfn_devs.c nd_pfn->mode = PFN_MODE_NONE; nd_pfn 101 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 103 drivers/nvdimm/pfn_devs.c return sprintf(buf, "%ld\n", nd_pfn->align); nd_pfn 134 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 140 drivers/nvdimm/pfn_devs.c rc = nd_size_select_store(dev, buf, &nd_pfn->align, nd_pfn 154 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 156 drivers/nvdimm/pfn_devs.c if (nd_pfn->uuid) nd_pfn 157 drivers/nvdimm/pfn_devs.c return sprintf(buf, "%pUb\n", nd_pfn->uuid); nd_pfn 164 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 168 drivers/nvdimm/pfn_devs.c rc = nd_uuid_store(dev, &nd_pfn->uuid, buf, len); nd_pfn 180 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 184 drivers/nvdimm/pfn_devs.c rc = sprintf(buf, "%s\n", nd_pfn->ndns nd_pfn 185 drivers/nvdimm/pfn_devs.c ? dev_name(&nd_pfn->ndns->dev) : ""); nd_pfn 193 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 198 drivers/nvdimm/pfn_devs.c rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len); nd_pfn 211 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 216 drivers/nvdimm/pfn_devs.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 218 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 237 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); nd_pfn 242 drivers/nvdimm/pfn_devs.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 244 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 302 drivers/nvdimm/pfn_devs.c struct device *nd_pfn_devinit(struct nd_pfn *nd_pfn, nd_pfn 307 drivers/nvdimm/pfn_devs.c if (!nd_pfn) nd_pfn 310 drivers/nvdimm/pfn_devs.c nd_pfn->mode = PFN_MODE_NONE; nd_pfn 311 drivers/nvdimm/pfn_devs.c nd_pfn->align = nd_pfn_default_alignment(); nd_pfn 312 drivers/nvdimm/pfn_devs.c dev = &nd_pfn->dev; nd_pfn 313 drivers/nvdimm/pfn_devs.c device_initialize(&nd_pfn->dev); nd_pfn 314 drivers/nvdimm/pfn_devs.c if (ndns && !__nd_attach_ndns(&nd_pfn->dev, ndns, &nd_pfn->ndns)) { nd_pfn 323 drivers/nvdimm/pfn_devs.c static struct nd_pfn *nd_pfn_alloc(struct nd_region *nd_region) nd_pfn 325 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn; nd_pfn 328 drivers/nvdimm/pfn_devs.c nd_pfn = kzalloc(sizeof(*nd_pfn), GFP_KERNEL); nd_pfn 329 drivers/nvdimm/pfn_devs.c if (!nd_pfn) nd_pfn 332 drivers/nvdimm/pfn_devs.c nd_pfn->id = ida_simple_get(&nd_region->pfn_ida, 0, 0, GFP_KERNEL); nd_pfn 333 drivers/nvdimm/pfn_devs.c if (nd_pfn->id < 0) { nd_pfn 334 drivers/nvdimm/pfn_devs.c kfree(nd_pfn); nd_pfn 338 drivers/nvdimm/pfn_devs.c dev = &nd_pfn->dev; nd_pfn 339 drivers/nvdimm/pfn_devs.c dev_set_name(dev, "pfn%d.%d", nd_region->id, nd_pfn->id); nd_pfn 344 drivers/nvdimm/pfn_devs.c return nd_pfn; nd_pfn 349 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn; nd_pfn 355 drivers/nvdimm/pfn_devs.c nd_pfn = nd_pfn_alloc(nd_region); nd_pfn 356 drivers/nvdimm/pfn_devs.c dev = nd_pfn_devinit(nd_pfn, NULL); nd_pfn 368 drivers/nvdimm/pfn_devs.c static int nd_pfn_clear_memmap_errors(struct nd_pfn *nd_pfn) nd_pfn 370 drivers/nvdimm/pfn_devs.c struct nd_region *nd_region = to_nd_region(nd_pfn->dev.parent); nd_pfn 371 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 373 drivers/nvdimm/pfn_devs.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 378 drivers/nvdimm/pfn_devs.c if (nd_pfn->mode != PFN_MODE_PMEM) nd_pfn 392 drivers/nvdimm/pfn_devs.c dev_dbg(&nd_pfn->dev, "meta: %x badblocks at %llx\n", nd_pfn 410 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, nd_pfn 445 drivers/nvdimm/pfn_devs.c int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) nd_pfn 451 drivers/nvdimm/pfn_devs.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 452 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 458 drivers/nvdimm/pfn_devs.c if (!is_memory(nd_pfn->dev.parent)) nd_pfn 506 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, nd_pfn 514 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, nd_pfn 527 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, "init failed, alignment mismatch: " nd_pfn 528 drivers/nvdimm/pfn_devs.c "%ld:%ld\n", nd_pfn->align, align); nd_pfn 532 drivers/nvdimm/pfn_devs.c if (!nd_pfn->uuid) { nd_pfn 538 drivers/nvdimm/pfn_devs.c nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); nd_pfn 539 drivers/nvdimm/pfn_devs.c if (!nd_pfn->uuid) nd_pfn 541 drivers/nvdimm/pfn_devs.c nd_pfn->align = align; nd_pfn 542 drivers/nvdimm/pfn_devs.c nd_pfn->mode = mode; nd_pfn 548 drivers/nvdimm/pfn_devs.c if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) nd_pfn 557 drivers/nvdimm/pfn_devs.c if (nd_pfn->align != align || nd_pfn->mode != mode) { nd_pfn 558 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, nd_pfn 560 drivers/nvdimm/pfn_devs.c dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n", nd_pfn 561 drivers/nvdimm/pfn_devs.c nd_pfn->align, align, nd_pfn->mode, nd_pfn 568 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", nd_pfn 581 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", nd_pfn 588 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, nd_pfn 594 drivers/nvdimm/pfn_devs.c return nd_pfn_clear_memmap_errors(nd_pfn); nd_pfn 601 drivers/nvdimm/pfn_devs.c struct nd_pfn *nd_pfn; nd_pfn 618 drivers/nvdimm/pfn_devs.c nd_pfn = nd_pfn_alloc(nd_region); nd_pfn 619 drivers/nvdimm/pfn_devs.c pfn_dev = nd_pfn_devinit(nd_pfn, ndns); nd_pfn 624 drivers/nvdimm/pfn_devs.c nd_pfn = to_nd_pfn(pfn_dev); nd_pfn 625 drivers/nvdimm/pfn_devs.c nd_pfn->pfn_sb = pfn_sb; nd_pfn 626 drivers/nvdimm/pfn_devs.c rc = nd_pfn_validate(nd_pfn, PFN_SIG); nd_pfn 629 drivers/nvdimm/pfn_devs.c nd_detach_ndns(pfn_dev, &nd_pfn->ndns); nd_pfn 663 drivers/nvdimm/pfn_devs.c static int __nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap) nd_pfn 667 drivers/nvdimm/pfn_devs.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 672 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 686 drivers/nvdimm/pfn_devs.c if (nd_pfn->mode == PFN_MODE_RAM) { nd_pfn 689 drivers/nvdimm/pfn_devs.c nd_pfn->npfns = le64_to_cpu(pfn_sb->npfns); nd_pfn 690 drivers/nvdimm/pfn_devs.c } else if (nd_pfn->mode == PFN_MODE_PMEM) { nd_pfn 691 drivers/nvdimm/pfn_devs.c nd_pfn->npfns = PHYS_PFN((resource_size(res) - offset)); nd_pfn 692 drivers/nvdimm/pfn_devs.c if (le64_to_cpu(nd_pfn->pfn_sb->npfns) > nd_pfn->npfns) nd_pfn 693 drivers/nvdimm/pfn_devs.c dev_info(&nd_pfn->dev, nd_pfn 695 drivers/nvdimm/pfn_devs.c le64_to_cpu(nd_pfn->pfn_sb->npfns), nd_pfn 696 drivers/nvdimm/pfn_devs.c nd_pfn->npfns); nd_pfn 707 drivers/nvdimm/pfn_devs.c static int nd_pfn_init(struct nd_pfn *nd_pfn) nd_pfn 709 drivers/nvdimm/pfn_devs.c struct nd_namespace_common *ndns = nd_pfn->ndns; nd_pfn 721 drivers/nvdimm/pfn_devs.c pfn_sb = devm_kmalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL); nd_pfn 725 drivers/nvdimm/pfn_devs.c nd_pfn->pfn_sb = pfn_sb; nd_pfn 726 drivers/nvdimm/pfn_devs.c if (is_nd_dax(&nd_pfn->dev)) nd_pfn 731 drivers/nvdimm/pfn_devs.c rc = nd_pfn_validate(nd_pfn, sig); nd_pfn 738 drivers/nvdimm/pfn_devs.c nd_region = to_nd_region(nd_pfn->dev.parent); nd_pfn 740 drivers/nvdimm/pfn_devs.c dev_info(&nd_pfn->dev, nd_pfn 755 drivers/nvdimm/pfn_devs.c align = max(nd_pfn->align, (1UL << SUBSECTION_SHIFT)); nd_pfn 757 drivers/nvdimm/pfn_devs.c if (nd_pfn->mode == PFN_MODE_PMEM) { nd_pfn 772 drivers/nvdimm/pfn_devs.c } else if (nd_pfn->mode == PFN_MODE_RAM) nd_pfn 778 drivers/nvdimm/pfn_devs.c dev_err(&nd_pfn->dev, "%s unable to satisfy requested alignment\n", nd_pfn 784 drivers/nvdimm/pfn_devs.c pfn_sb->mode = cpu_to_le32(nd_pfn->mode); nd_pfn 788 drivers/nvdimm/pfn_devs.c memcpy(pfn_sb->uuid, nd_pfn->uuid, 16); nd_pfn 793 drivers/nvdimm/pfn_devs.c pfn_sb->align = cpu_to_le32(nd_pfn->align); nd_pfn 806 drivers/nvdimm/pfn_devs.c int nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap) nd_pfn 810 drivers/nvdimm/pfn_devs.c if (!nd_pfn->uuid || !nd_pfn->ndns) nd_pfn 813 drivers/nvdimm/pfn_devs.c rc = nd_pfn_init(nd_pfn); nd_pfn 818 drivers/nvdimm/pfn_devs.c return __nvdimm_setup_pfn(nd_pfn, pgmap); nd_pfn 360 drivers/nvdimm/pmem.c struct nd_pfn *nd_pfn = NULL; nd_pfn 377 drivers/nvdimm/pmem.c nd_pfn = to_nd_pfn(dev); nd_pfn 378 drivers/nvdimm/pmem.c rc = nvdimm_setup_pfn(nd_pfn, &pmem->pgmap); nd_pfn 411 drivers/nvdimm/pmem.c pfn_sb = nd_pfn->pfn_sb; nd_pfn 591 drivers/nvdimm/pmem.c struct nd_pfn *nd_pfn = to_nd_pfn(dev); nd_pfn 592 drivers/nvdimm/pmem.c struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; nd_pfn 594 drivers/nvdimm/pmem.c ndns = nd_pfn->ndns; nd_pfn 734 drivers/nvdimm/region_devs.c struct nd_pfn *nd_pfn = to_nd_pfn(dev); nd_pfn 738 drivers/nvdimm/region_devs.c if (nd_region->ns_seed == &nd_pfn->ndns->dev) nd_pfn 745 drivers/nvdimm/region_devs.c if (nd_region->ns_seed == &nd_dax->nd_pfn.ndns->dev)