1 /* SPDX-License-Identifier: GPL-2.0 */
3 * SVA library for IOMMU drivers
8 #include <linux/ioasid.h>
9 #include <linux/mm_types.h>
11 int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max);
12 struct mm_struct *iommu_sva_find(ioasid_t pasid);
19 #ifdef CONFIG_IOMMU_SVA
20 int iommu_queue_iopf(struct iommu_fault *fault, void *cookie);
22 int iopf_queue_add_device(struct iopf_queue *queue, struct device *dev);
23 int iopf_queue_remove_device(struct iopf_queue *queue,
25 int iopf_queue_flush_dev(struct device *dev);
26 struct iopf_queue *iopf_queue_alloc(const char *name);
27 void iopf_queue_free(struct iopf_queue *queue);
28 int iopf_queue_discard_partial(struct iopf_queue *queue);
29 enum iommu_page_response_code
30 iommu_sva_handle_iopf(struct iommu_fault *fault, void *data);
32 #else /* CONFIG_IOMMU_SVA */
33 static inline int iommu_queue_iopf(struct iommu_fault *fault, void *cookie)
38 static inline int iopf_queue_add_device(struct iopf_queue *queue,
44 static inline int iopf_queue_remove_device(struct iopf_queue *queue,
50 static inline int iopf_queue_flush_dev(struct device *dev)
55 static inline struct iopf_queue *iopf_queue_alloc(const char *name)
60 static inline void iopf_queue_free(struct iopf_queue *queue)
64 static inline int iopf_queue_discard_partial(struct iopf_queue *queue)
69 static inline enum iommu_page_response_code
70 iommu_sva_handle_iopf(struct iommu_fault *fault, void *data)
72 return IOMMU_PAGE_RESP_INVALID;
74 #endif /* CONFIG_IOMMU_SVA */
75 #endif /* _IOMMU_SVA_H */