Merge tag 'csky-for-linus-5.3-rc1' of git://github.com/c-sky/csky-linux
[linux-2.6-block.git] / drivers / dax / dax-private.h
CommitLineData
5b497af4 1/* SPDX-License-Identifier: GPL-2.0-only */
efebc711
DJ
2/*
3 * Copyright(c) 2016 Intel Corporation. All rights reserved.
efebc711
DJ
4 */
5#ifndef __DAX_PRIVATE_H__
6#define __DAX_PRIVATE_H__
7
8#include <linux/device.h>
9#include <linux/cdev.h>
10
51cf784c
DW
11/* private routines between core files */
12struct dax_device;
13struct dax_device *inode_dax(struct inode *inode);
14struct inode *dax_inode(struct dax_device *dax_dev);
9567da0b
DW
15int dax_bus_init(void);
16void dax_bus_exit(void);
51cf784c 17
efebc711
DJ
18/**
19 * struct dax_region - mapping infrastructure for dax devices
20 * @id: kernel-wide unique region for a memory range
8fc5c735 21 * @target_node: effective numa node if this memory range is onlined
efebc711
DJ
22 * @kref: to pin while other agents have a need to do lookups
23 * @dev: parent device backing this region
24 * @align: allocation and mapping alignment for child dax devices
25 * @res: physical address range of the region
26 * @pfn_flags: identify whether the pfns are paged back or not
27 */
28struct dax_region {
29 int id;
8fc5c735 30 int target_node;
efebc711
DJ
31 struct kref kref;
32 struct device *dev;
33 unsigned int align;
34 struct resource res;
35 unsigned long pfn_flags;
36};
37
38/**
89ec9f2c
DW
39 * struct dev_dax - instance data for a subdivision of a dax region, and
40 * data while the device is activated in the driver.
efebc711 41 * @region - parent region
73616367 42 * @dax_dev - core dax functionality
8fc5c735 43 * @target_node: effective numa node if dev_dax memory range is onlined
73616367 44 * @dev - device core
89ec9f2c 45 * @pgmap - pgmap for memmap setup / lifetime (driver owned)
9f960da7 46 * @dax_mem_res: physical address range of hotadded DAX memory
efebc711 47 */
73616367 48struct dev_dax {
efebc711 49 struct dax_region *region;
73616367 50 struct dax_device *dax_dev;
8fc5c735 51 int target_node;
efebc711 52 struct device dev;
89ec9f2c 53 struct dev_pagemap pgmap;
9f960da7 54 struct resource *dax_kmem_res;
efebc711 55};
51cf784c
DW
56
57static inline struct dev_dax *to_dev_dax(struct device *dev)
58{
59 return container_of(dev, struct dev_dax, dev);
60}
efebc711 61#endif