Debian Codegraph @

drivers/nvdimm/pmem.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NVDIMM_PMEM_H__
3 #define __NVDIMM_PMEM_H__
4 #include <linux/page-flags.h>
5 #include <linux/badblocks.h>
6 #include <linux/memremap.h>
7 #include <linux/types.h>
8 #include <linux/fs.h>
9
10 enum dax_access_mode;
11
12 /* this definition is in it's own header for tools/testing/nvdimm to consume */
13 struct pmem_device {
14 /* One contiguous memory region per device */
15 phys_addr_t phys_addr;
16 /* when non-zero this device is hosting a 'pfn' instance */
17 phys_addr_t data_offset;
18 void *virt_addr;
19 /* immutable base size of the namespace */
20 size_t size;
21 /* trim size when namespace capacity has been section aligned */
22 u32 pfn_pad;
23 struct kernfs_node *bb_state;
24 struct badblocks bb;
25 struct dax_device *dax_dev;
26 struct gendisk *disk;
27 struct dev_pagemap pgmap;
28 };
29
30 long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
31 long nr_pages, enum dax_access_mode mode, void **kaddr,
32 unsigned long *pfn);
33
34 #ifdef CONFIG_MEMORY_FAILURE
35 static inline bool test_and_clear_pmem_poison(struct page *page)
36 {
37 return TestClearPageHWPoison(page);
38 }
39 #else
40 static inline bool test_and_clear_pmem_poison(struct page *page)
41 {
42 return false;
43 }
44 #endif
45 #endif /* __NVDIMM_PMEM_H__ */