1 // SPDX-License-Identifier: GPL-2.0
3 /* This file is part of Lustre, http://www.lustre.org/ */
8 #include <linux/types.h>
9 #include <linux/delay.h>
10 #include <linux/blkdev.h>
11 #include <linux/cpumask.h>
12 #include <linux/scatterlist.h>
13 #include <linux/percpu-defs.h>
14 #include <linux/dma-direction.h>
15 #include <linux/dma-mapping.h>
18 struct nvfs_dma_rw_ops {
19 unsigned long long ft_bmap; /* feature bitmap */
21 int (*nvfs_blk_rq_map_sg) (struct request_queue *q,
23 struct scatterlist *sglist);
25 int (*nvfs_dma_map_sg_attrs) (struct device *device,
26 struct scatterlist *sglist,
28 enum dma_data_direction dma_dir,
31 int (*nvfs_dma_unmap_sg) (struct device *device,
32 struct scatterlist *sglist,
34 enum dma_data_direction dma_dir);
35 bool (*nvfs_is_gpu_page) (struct page *);
36 unsigned int (*nvfs_gpu_index) (struct page *page);
37 unsigned int (*nvfs_device_priority) (struct device *dev, unsigned int dev_index);
40 /* feature list for dma_ops, values indicate bit pos */
42 nvfs_ft_prep_sglist = 1ULL << 0,
43 nvfs_ft_map_sglist = 1ULL << 1,
44 nvfs_ft_is_gpu_page = 1ULL << 2,
45 nvfs_ft_device_priority = 1ULL << 3,
48 /* check features for use in registration with vendor drivers */
49 #define NVIDIA_FS_CHECK_FT_SGLIST_PREP(ops) \
50 ((ops)->ft_bmap & nvfs_ft_prep_sglist)
51 #define NVIDIA_FS_CHECK_FT_SGLIST_DMA(ops) \
52 ((ops)->ft_bmap & nvfs_ft_map_sglist)
53 #define NVIDIA_FS_CHECK_FT_GPU_PAGE(ops) \
54 ((ops)->ft_bmap & nvfs_ft_is_gpu_page)
55 #define NVIDIA_FS_CHECK_FT_DEVICE_PRIORITY(ops) \
56 ((ops)->ft_bmap & nvfs_ft_device_priority)
58 #endif /* LUSTRE_NVFS_H */