summaryrefslogtreecommitdiffstats
path: root/tools/testing/nvdimm/pmem-dax.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/nvdimm/pmem-dax.c')
-rw-r--r--tools/testing/nvdimm/pmem-dax.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/testing/nvdimm/pmem-dax.c b/tools/testing/nvdimm/pmem-dax.c
index fdba77f..1e0218c 100644
--- a/tools/testing/nvdimm/pmem-dax.c
+++ b/tools/testing/nvdimm/pmem-dax.c
@@ -21,14 +21,26 @@ long pmem_direct_access(struct block_device *bdev, sector_t sector,
struct pmem_device *pmem = bdev->bd_queue->queuedata;
resource_size_t offset = sector * 512 + pmem->data_offset;
- /* disable DAX for nfit_test pmem devices */
- if (get_nfit_res(pmem->phys_addr + offset)) {
- dev_info_once(pmem->bb.dev, "dax is disabled for nfit_test\n");
+ if (unlikely(is_bad_pmem(&pmem->bb, sector, size)))
return -EIO;
+
+ /*
+ * Limit dax to a single page at a time given vmalloc()-backed
+ * in the nfit_test case.
+ */
+ if (get_nfit_res(pmem->phys_addr + offset)) {
+ struct page *page;
+
+ *kaddr = pmem->virt_addr + offset;
+ page = vmalloc_to_page(pmem->virt_addr + offset);
+ *pfn = page_to_pfn_t(page);
+ dev_dbg_ratelimited(disk_to_dev(bdev->bd_disk)->parent,
+ "%s: sector: %#llx pfn: %#lx\n", __func__,
+ (unsigned long long) sector, page_to_pfn(page));
+
+ return PAGE_SIZE;
}
- if (unlikely(is_bad_pmem(&pmem->bb, sector, size)))
- return -EIO;
*kaddr = pmem->virt_addr + offset;
*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
OpenPOWER on IntegriCloud