linux/drivers/iommu/iommu-sva-lib.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * SVA library for IOMMU drivers
   4 */
   5#ifndef _IOMMU_SVA_LIB_H
   6#define _IOMMU_SVA_LIB_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);
  12void iommu_sva_free_pasid(struct mm_struct *mm);
  13struct mm_struct *iommu_sva_find(ioasid_t pasid);
  14
  15/* I/O Page fault */
  16struct device;
  17struct iommu_fault;
  18struct iopf_queue;
  19
  20#ifdef CONFIG_IOMMU_SVA_LIB
  21int iommu_queue_iopf(struct iommu_fault *fault, void *cookie);
  22
  23int iopf_queue_add_device(struct iopf_queue *queue, struct device *dev);
  24int iopf_queue_remove_device(struct iopf_queue *queue,
  25                             struct device *dev);
  26int iopf_queue_flush_dev(struct device *dev);
  27struct iopf_queue *iopf_queue_alloc(const char *name);
  28void iopf_queue_free(struct iopf_queue *queue);
  29int iopf_queue_discard_partial(struct iopf_queue *queue);
  30
  31#else /* CONFIG_IOMMU_SVA_LIB */
  32static inline int iommu_queue_iopf(struct iommu_fault *fault, void *cookie)
  33{
  34        return -ENODEV;
  35}
  36
  37static inline int iopf_queue_add_device(struct iopf_queue *queue,
  38                                        struct device *dev)
  39{
  40        return -ENODEV;
  41}
  42
  43static inline int iopf_queue_remove_device(struct iopf_queue *queue,
  44                                           struct device *dev)
  45{
  46        return -ENODEV;
  47}
  48
  49static inline int iopf_queue_flush_dev(struct device *dev)
  50{
  51        return -ENODEV;
  52}
  53
  54static inline struct iopf_queue *iopf_queue_alloc(const char *name)
  55{
  56        return NULL;
  57}
  58
  59static inline void iopf_queue_free(struct iopf_queue *queue)
  60{
  61}
  62
  63static inline int iopf_queue_discard_partial(struct iopf_queue *queue)
  64{
  65        return -ENODEV;
  66}
  67#endif /* CONFIG_IOMMU_SVA_LIB */
  68#endif /* _IOMMU_SVA_LIB_H */
  69