xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_svm.h (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 /*	$NetBSD: nouveau_svm.h,v 1.2 2021/12/18 23:45:32 riastradh Exp $	*/
2 
3 #ifndef __NOUVEAU_SVM_H__
4 #define __NOUVEAU_SVM_H__
5 #include <nvif/os.h>
6 struct drm_device;
7 struct drm_file;
8 struct nouveau_drm;
9 
10 struct nouveau_svmm;
11 
12 #if IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM)
13 void nouveau_svm_init(struct nouveau_drm *);
14 void nouveau_svm_fini(struct nouveau_drm *);
15 void nouveau_svm_suspend(struct nouveau_drm *);
16 void nouveau_svm_resume(struct nouveau_drm *);
17 
18 int nouveau_svmm_init(struct drm_device *, void *, struct drm_file *);
19 void nouveau_svmm_fini(struct nouveau_svmm **);
20 int nouveau_svmm_join(struct nouveau_svmm *, u64 inst);
21 void nouveau_svmm_part(struct nouveau_svmm *, u64 inst);
22 int nouveau_svmm_bind(struct drm_device *, void *, struct drm_file *);
23 #else /* IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM) */
24 static inline void nouveau_svm_init(struct nouveau_drm *drm) {}
25 static inline void nouveau_svm_fini(struct nouveau_drm *drm) {}
26 static inline void nouveau_svm_suspend(struct nouveau_drm *drm) {}
27 static inline void nouveau_svm_resume(struct nouveau_drm *drm) {}
28 
29 static inline int nouveau_svmm_init(struct drm_device *device, void *p,
30 				    struct drm_file *file)
31 {
32 	return -ENOSYS;
33 }
34 
35 static inline void nouveau_svmm_fini(struct nouveau_svmm **svmmp) {}
36 
37 static inline int nouveau_svmm_join(struct nouveau_svmm *svmm, u64 inst)
38 {
39 	return 0;
40 }
41 
42 static inline void nouveau_svmm_part(struct nouveau_svmm *svmm, u64 inst) {}
43 
44 static inline int nouveau_svmm_bind(struct drm_device *device, void *p,
45 				    struct drm_file *file)
46 {
47 	return -ENOSYS;
48 }
49 #endif /* IS_ENABLED(CONFIG_DRM_NOUVEAU_SVM) */
50 #endif
51