linux/drivers/gpu/drm/nouveau/nouveau_svm.h
<<
>>
Prefs
   1#ifndef __NOUVEAU_SVM_H__
   2#define __NOUVEAU_SVM_H__
   3#include <nvif/os.h>
   4#include <linux/mmu_notifier.h>
   5struct drm_device;
   6struct drm_file;
   7struct nouveau_drm;
   8
   9struct nouveau_svmm {
  10        struct mmu_notifier notifier;
  11        struct nouveau_vmm *vmm;
  12        struct {
  13                unsigned long start;
  14                unsigned long limit;
  15        } unmanaged;
  16
  17        struct mutex mutex;
  18};
  19
  20#if IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM)
  21void nouveau_svm_init(struct nouveau_drm *);
  22void nouveau_svm_fini(struct nouveau_drm *);
  23void nouveau_svm_suspend(struct nouveau_drm *);
  24void nouveau_svm_resume(struct nouveau_drm *);
  25
  26int nouveau_svmm_init(struct drm_device *, void *, struct drm_file *);
  27void nouveau_svmm_fini(struct nouveau_svmm **);
  28int nouveau_svmm_join(struct nouveau_svmm *, u64 inst);
  29void nouveau_svmm_part(struct nouveau_svmm *, u64 inst);
  30int nouveau_svmm_bind(struct drm_device *, void *, struct drm_file *);
  31
  32void nouveau_svmm_invalidate(struct nouveau_svmm *svmm, u64 start, u64 limit);
  33u64 *nouveau_pfns_alloc(unsigned long npages);
  34void nouveau_pfns_free(u64 *pfns);
  35void nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
  36                      unsigned long addr, u64 *pfns, unsigned long npages);
  37#else /* IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM) */
  38static inline void nouveau_svm_init(struct nouveau_drm *drm) {}
  39static inline void nouveau_svm_fini(struct nouveau_drm *drm) {}
  40static inline void nouveau_svm_suspend(struct nouveau_drm *drm) {}
  41static inline void nouveau_svm_resume(struct nouveau_drm *drm) {}
  42
  43static inline int nouveau_svmm_init(struct drm_device *device, void *p,
  44                                    struct drm_file *file)
  45{
  46        return -ENOSYS;
  47}
  48
  49static inline void nouveau_svmm_fini(struct nouveau_svmm **svmmp) {}
  50
  51static inline int nouveau_svmm_join(struct nouveau_svmm *svmm, u64 inst)
  52{
  53        return 0;
  54}
  55
  56static inline void nouveau_svmm_part(struct nouveau_svmm *svmm, u64 inst) {}
  57
  58static inline int nouveau_svmm_bind(struct drm_device *device, void *p,
  59                                    struct drm_file *file)
  60{
  61        return -ENOSYS;
  62}
  63#endif /* IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM) */
  64#endif
  65