Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
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 /* this definition is in it's own header for tools/testing/nvdimm to consume */
0014 struct pmem_device {
0015     /* One contiguous memory region per device */
0016     phys_addr_t     phys_addr;
0017     /* when non-zero this device is hosting a 'pfn' instance */
0018     phys_addr_t     data_offset;
0019     u64         pfn_flags;
0020     void            *virt_addr;
0021     /* immutable base size of the namespace */
0022     size_t          size;
0023     /* trim size when namespace capacity has been section aligned */
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 /* __NVDIMM_PMEM_H__ */