| 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 |  | 
|---|
| 29 | static inline void iommu_setup_dma_ops(struct device *dev) | 
|---|
| 30 | { | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|
| 33 | static inline int iommu_dma_init_fq(struct iommu_domain *domain) | 
|---|
| 34 | { | 
|---|
| 35 | return -EINVAL; | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | static inline int iommu_get_dma_cookie(struct iommu_domain *domain) | 
|---|
| 39 | { | 
|---|
| 40 | return -ENODEV; | 
|---|
| 41 | } | 
|---|
| 42 |  | 
|---|
| 43 | static inline void iommu_put_dma_cookie(struct iommu_domain *domain) | 
|---|
| 44 | { | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | static inline void iommu_put_msi_cookie(struct iommu_domain *domain) | 
|---|
| 48 | { | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) | 
|---|
| 52 | { | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | static 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 |  | 
|---|