mm: update get_user_pages_longterm to migrate pages allocated from CMA region
[linux-2.6-block.git] / drivers / nvdimm / pmem.h
CommitLineData
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
DW
5#include <linux/badblocks.h>
6#include <linux/types.h>
7#include <linux/pfn_t.h>
8#include <linux/fs.h>
9
f295e53b
DW
10/* this definition is in it's own header for tools/testing/nvdimm to consume */
11struct pmem_device {
12 /* One contiguous memory region per device */
13 phys_addr_t phys_addr;
14 /* when non-zero this device is hosting a 'pfn' instance */
15 phys_addr_t data_offset;
16 u64 pfn_flags;
7a9eb206 17 void *virt_addr;
f295e53b
DW
18 /* immutable base size of the namespace */
19 size_t size;
20 /* trim size when namespace capacity has been section aligned */
21 u32 pfn_pad;
975750a9 22 struct kernfs_node *bb_state;
f295e53b 23 struct badblocks bb;
c1d6e828
DW
24 struct dax_device *dax_dev;
25 struct gendisk *disk;
e8d51348 26 struct dev_pagemap pgmap;
f295e53b 27};
c1d6e828
DW
28
29long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
30 long nr_pages, void **kaddr, pfn_t *pfn);
c953cc98
DW
31
32#ifdef CONFIG_MEMORY_FAILURE
33static inline bool test_and_clear_pmem_poison(struct page *page)
34{
35 return TestClearPageHWPoison(page);
36}
37#else
38static inline bool test_and_clear_pmem_poison(struct page *page)
39{
40 return false;
41}
42#endif
f295e53b 43#endif /* __NVDIMM_PMEM_H__ */