Commit | Line | Data |
---|---|---|
caab277b | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
0db2e5d1 RM |
2 | /* |
3 | * Copyright (C) 2014-2015 ARM Ltd. | |
0db2e5d1 RM |
4 | */ |
5 | #ifndef __DMA_IOMMU_H | |
6 | #define __DMA_IOMMU_H | |
7 | ||
f2042ed2 | 8 | #include <linux/iommu.h> |
0db2e5d1 RM |
9 | |
10 | #ifdef CONFIG_IOMMU_DMA | |
0db2e5d1 | 11 | |
0db2e5d1 RM |
12 | int iommu_get_dma_cookie(struct iommu_domain *domain); |
13 | void iommu_put_dma_cookie(struct iommu_domain *domain); | |
14 | ||
452e69b5 | 15 | int iommu_dma_init_fq(struct iommu_domain *domain); |
0db2e5d1 | 16 | |
273df963 | 17 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); |
44bb7e24 | 18 | |
3542dcb1 | 19 | extern bool iommu_dma_forcedac; |
791c2b17 RM |
20 | static inline void iommu_dma_set_pci_32bit_workaround(struct device *dev) |
21 | { | |
22 | dev->iommu->pci_32bit_workaround = !iommu_dma_forcedac; | |
23 | } | |
3542dcb1 | 24 | |
185da893 | 25 | #else /* CONFIG_IOMMU_DMA */ |
0db2e5d1 | 26 | |
452e69b5 RM |
27 | static inline int iommu_dma_init_fq(struct iommu_domain *domain) |
28 | { | |
29 | return -EINVAL; | |
30 | } | |
31 | ||
0db2e5d1 RM |
32 | static inline int iommu_get_dma_cookie(struct iommu_domain *domain) |
33 | { | |
34 | return -ENODEV; | |
35 | } | |
36 | ||
37 | static inline void iommu_put_dma_cookie(struct iommu_domain *domain) | |
38 | { | |
39 | } | |
40 | ||
273df963 RM |
41 | static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) |
42 | { | |
43 | } | |
44 | ||
791c2b17 RM |
45 | static inline void iommu_dma_set_pci_32bit_workaround(struct device *dev) |
46 | { | |
47 | } | |
48 | ||
0db2e5d1 | 49 | #endif /* CONFIG_IOMMU_DMA */ |
0db2e5d1 | 50 | #endif /* __DMA_IOMMU_H */ |