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, struct iommu_domain *domain); 13 14 int iommu_get_dma_cookie(struct iommu_domain *domain); 15 void iommu_put_dma_cookie(struct iommu_domain *domain); 16 void iommu_put_msi_cookie(struct iommu_domain *domain); 17 18 int iommu_dma_init_fq(struct iommu_domain *domain); 19 20 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); 21 22 int iommu_dma_sw_msi(struct iommu_domain *domain, struct msi_desc *desc, 23 phys_addr_t msi_addr); 24 25 extern bool iommu_dma_forcedac; 26 27 #else /* CONFIG_IOMMU_DMA */ 28 29 static inline void iommu_setup_dma_ops(struct device *dev, 30 struct iommu_domain *domain) 31 { 32 } 33 34 static inline int iommu_dma_init_fq(struct iommu_domain *domain) 35 { 36 return -EINVAL; 37 } 38 39 static inline int iommu_get_dma_cookie(struct iommu_domain *domain) 40 { 41 return -ENODEV; 42 } 43 44 static inline void iommu_put_dma_cookie(struct iommu_domain *domain) 45 { 46 } 47 48 static inline void iommu_put_msi_cookie(struct iommu_domain *domain) 49 { 50 } 51 52 static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) 53 { 54 } 55 56 static inline int iommu_dma_sw_msi(struct iommu_domain *domain, 57 struct msi_desc *desc, phys_addr_t msi_addr) 58 { 59 return -ENODEV; 60 } 61 62 #endif /* CONFIG_IOMMU_DMA */ 63 #endif /* __DMA_IOMMU_H */ 64