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