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