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 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 iommu_setup_dma_ops(struct device * dev)29static inline void iommu_setup_dma_ops(struct device *dev) 30 { 31 } 32 iommu_dma_init_fq(struct iommu_domain * domain)33static inline int iommu_dma_init_fq(struct iommu_domain *domain) 34 { 35 return -EINVAL; 36 } 37 iommu_get_dma_cookie(struct iommu_domain * domain)38static inline int iommu_get_dma_cookie(struct iommu_domain *domain) 39 { 40 return -ENODEV; 41 } 42 iommu_put_dma_cookie(struct iommu_domain * domain)43static inline void iommu_put_dma_cookie(struct iommu_domain *domain) 44 { 45 } 46 iommu_put_msi_cookie(struct iommu_domain * domain)47static inline void iommu_put_msi_cookie(struct iommu_domain *domain) 48 { 49 } 50 iommu_dma_get_resv_regions(struct device * dev,struct list_head * list)51static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) 52 { 53 } 54 iommu_dma_sw_msi(struct iommu_domain * domain,struct msi_desc * desc,phys_addr_t msi_addr)55static inline int iommu_dma_sw_msi(struct iommu_domain *domain, 56 struct msi_desc *desc, phys_addr_t msi_addr) 57 { 58 return -ENODEV; 59 } 60 61 #endif /* CONFIG_IOMMU_DMA */ 62 #endif /* __DMA_IOMMU_H */ 63