Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.13.7.
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * SVA library for IOMMU drivers
 4 */
 5#ifndef _IOMMU_SVA_H
 6#define _IOMMU_SVA_H
 7
 8#include <linux/ioasid.h>
 9#include <linux/mm_types.h>
10
11int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max);
12struct mm_struct *iommu_sva_find(ioasid_t pasid);
13
14/* I/O Page fault */
15struct device;
16struct iommu_fault;
17struct iopf_queue;
18
19#ifdef CONFIG_IOMMU_SVA
20int iommu_queue_iopf(struct iommu_fault *fault, void *cookie);
21
22int iopf_queue_add_device(struct iopf_queue *queue, struct device *dev);
23int iopf_queue_remove_device(struct iopf_queue *queue,
24			     struct device *dev);
25int iopf_queue_flush_dev(struct device *dev);
26struct iopf_queue *iopf_queue_alloc(const char *name);
27void iopf_queue_free(struct iopf_queue *queue);
28int iopf_queue_discard_partial(struct iopf_queue *queue);
29enum iommu_page_response_code
30iommu_sva_handle_iopf(struct iommu_fault *fault, void *data);
31
32#else /* CONFIG_IOMMU_SVA */
33static inline int iommu_queue_iopf(struct iommu_fault *fault, void *cookie)
34{
35	return -ENODEV;
36}
37
38static inline int iopf_queue_add_device(struct iopf_queue *queue,
39					struct device *dev)
40{
41	return -ENODEV;
42}
43
44static inline int iopf_queue_remove_device(struct iopf_queue *queue,
45					   struct device *dev)
46{
47	return -ENODEV;
48}
49
50static inline int iopf_queue_flush_dev(struct device *dev)
51{
52	return -ENODEV;
53}
54
55static inline struct iopf_queue *iopf_queue_alloc(const char *name)
56{
57	return NULL;
58}
59
60static inline void iopf_queue_free(struct iopf_queue *queue)
61{
62}
63
64static inline int iopf_queue_discard_partial(struct iopf_queue *queue)
65{
66	return -ENODEV;
67}
68
69static inline enum iommu_page_response_code
70iommu_sva_handle_iopf(struct iommu_fault *fault, void *data)
71{
72	return IOMMU_PAGE_RESP_INVALID;
73}
74#endif /* CONFIG_IOMMU_SVA */
75#endif /* _IOMMU_SVA_H */