0001
0002 #ifndef __NVDIMM_PMEM_H__
0003 #define __NVDIMM_PMEM_H__
0004 #include <linux/page-flags.h>
0005 #include <linux/badblocks.h>
0006 #include <linux/memremap.h>
0007 #include <linux/types.h>
0008 #include <linux/pfn_t.h>
0009 #include <linux/fs.h>
0010
0011 enum dax_access_mode;
0012
0013
0014 struct pmem_device {
0015
0016 phys_addr_t phys_addr;
0017
0018 phys_addr_t data_offset;
0019 u64 pfn_flags;
0020 void *virt_addr;
0021
0022 size_t size;
0023
0024 u32 pfn_pad;
0025 struct kernfs_node *bb_state;
0026 struct badblocks bb;
0027 struct dax_device *dax_dev;
0028 struct gendisk *disk;
0029 struct dev_pagemap pgmap;
0030 };
0031
0032 long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
0033 long nr_pages, enum dax_access_mode mode, void **kaddr,
0034 pfn_t *pfn);
0035
0036 #ifdef CONFIG_MEMORY_FAILURE
0037 static inline bool test_and_clear_pmem_poison(struct page *page)
0038 {
0039 return TestClearPageHWPoison(page);
0040 }
0041 #else
0042 static inline bool test_and_clear_pmem_poison(struct page *page)
0043 {
0044 return false;
0045 }
0046 #endif
0047 #endif