OSDN Git Service

f2fs: Revert rapid GC
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / linux / dma-mapping-fast.h
1 /* Copyright (c) 2016, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #ifndef __LINUX_DMA_MAPPING_FAST_H
14 #define __LINUX_DMA_MAPPING_FAST_H
15
16 #include <linux/iommu.h>
17 #include <linux/io-pgtable-fast.h>
18
19 struct dma_iommu_mapping;
20
21 struct dma_fast_smmu_mapping {
22         struct device           *dev;
23         struct iommu_domain     *domain;
24         dma_addr_t       base;
25         size_t           size;
26         size_t           num_4k_pages;
27
28         unsigned int    bitmap_size;
29         unsigned long   *bitmap;
30         unsigned long   next_start;
31         unsigned long   upcoming_stale_bit;
32         bool            have_stale_tlbs;
33
34         dma_addr_t      pgtbl_dma_handle;
35         av8l_fast_iopte *pgtbl_pmds;
36
37         spinlock_t      lock;
38         struct notifier_block notifier;
39
40         int             is_smmu_pt_coherent;
41 };
42
43 #ifdef CONFIG_IOMMU_IO_PGTABLE_FAST
44 int fast_smmu_attach_device(struct device *dev,
45                             struct dma_iommu_mapping *mapping);
46 void fast_smmu_detach_device(struct device *dev,
47                              struct dma_iommu_mapping *mapping);
48 #else
49 static inline int fast_smmu_attach_device(struct device *dev,
50                                           struct dma_iommu_mapping *mapping)
51 {
52         return -ENODEV;
53 }
54
55 static inline void fast_smmu_detach_device(struct device *dev,
56                                            struct dma_iommu_mapping *mapping)
57 {
58 }
59 #endif
60
61 #endif /* __LINUX_DMA_MAPPING_FAST_H */