1 /* Copyright (c) 2016, The Linux Foundation. All rights reserved.
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.
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.
13 #ifndef __LINUX_DMA_MAPPING_FAST_H
14 #define __LINUX_DMA_MAPPING_FAST_H
16 #include <linux/iommu.h>
17 #include <linux/io-pgtable-fast.h>
19 struct dma_iommu_mapping;
21 struct dma_fast_smmu_mapping {
23 struct iommu_domain *domain;
28 unsigned int bitmap_size;
29 unsigned long *bitmap;
30 unsigned long next_start;
31 unsigned long upcoming_stale_bit;
34 dma_addr_t pgtbl_dma_handle;
35 av8l_fast_iopte *pgtbl_pmds;
38 struct notifier_block notifier;
40 int is_smmu_pt_coherent;
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);
49 static inline int fast_smmu_attach_device(struct device *dev,
50 struct dma_iommu_mapping *mapping)
55 static inline void fast_smmu_detach_device(struct device *dev,
56 struct dma_iommu_mapping *mapping)
61 #endif /* __LINUX_DMA_MAPPING_FAST_H */