diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-06-16 06:34:17 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-06-27 21:40:46 +0300 |
commit | ee8520fe8cd4cd2658ca555781eefeb4914c4ef9 (patch) | |
tree | bef946a586e0416b6b2df37ad3d41dc0d3769808 /tools/testing/nvdimm/pmem-dax.c | |
parent | f295e53b60eb93ee53ed5ac610374ed293caa57b (diff) | |
download | linux-ee8520fe8cd4cd2658ca555781eefeb4914c4ef9.tar.xz |
tools/testing/nvdimm: replace CONFIG_DMA_CMA dependency with vmalloc()
DMA_CMA is incompatible with SWIOTLB used in enterprise distro
configurations. Switch to vmalloc() allocations for all resources.
Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools/testing/nvdimm/pmem-dax.c')
-rw-r--r-- | tools/testing/nvdimm/pmem-dax.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/testing/nvdimm/pmem-dax.c b/tools/testing/nvdimm/pmem-dax.c index fdba77f2bb06..1e0218ce6a8b 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); |