xref: /linux/drivers/iommu/dma-iommu.h (revision 0cc6f45cecb46cefe89c17ec816dc8cd58a2229a)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2014-2015 ARM Ltd.
4  */
5 #ifndef __DMA_IOMMU_H
6 #define __DMA_IOMMU_H
7 
8 #include <linux/iommu.h>
9 
10 #ifdef CONFIG_IOMMU_DMA
11 
12 void iommu_setup_dma_ops(struct device *dev);
13 
14 int iommu_get_dma_cookie(struct iommu_domain *domain);
15 void iommu_put_dma_cookie(struct iommu_domain *domain);
16 
17 int iommu_dma_init_fq(struct iommu_domain *domain);
18 
19 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
20 
21 extern bool iommu_dma_forcedac;
22 
23 #else /* CONFIG_IOMMU_DMA */
24 
iommu_setup_dma_ops(struct device * dev)25 static inline void iommu_setup_dma_ops(struct device *dev)
26 {
27 }
28 
iommu_dma_init_fq(struct iommu_domain * domain)29 static inline int iommu_dma_init_fq(struct iommu_domain *domain)
30 {
31 	return -EINVAL;
32 }
33 
iommu_get_dma_cookie(struct iommu_domain * domain)34 static inline int iommu_get_dma_cookie(struct iommu_domain *domain)
35 {
36 	return -ENODEV;
37 }
38 
iommu_put_dma_cookie(struct iommu_domain * domain)39 static inline void iommu_put_dma_cookie(struct iommu_domain *domain)
40 {
41 }
42 
iommu_dma_get_resv_regions(struct device * dev,struct list_head * list)43 static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
44 {
45 }
46 
47 #endif	/* CONFIG_IOMMU_DMA */
48 #endif	/* __DMA_IOMMU_H */
49