This source file includes following definitions.
- amdgpu_mn_lock
- amdgpu_mn_unlock
- amdgpu_mn_get
- amdgpu_mn_register
- amdgpu_mn_unregister
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef __AMDGPU_MN_H__
25 #define __AMDGPU_MN_H__
26
27 #include <linux/types.h>
28 #include <linux/hmm.h>
29 #include <linux/rwsem.h>
30 #include <linux/workqueue.h>
31 #include <linux/interval_tree.h>
32
33 enum amdgpu_mn_type {
34 AMDGPU_MN_TYPE_GFX,
35 AMDGPU_MN_TYPE_HSA,
36 };
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 struct amdgpu_mn {
53
54 struct amdgpu_device *adev;
55 struct mm_struct *mm;
56 enum amdgpu_mn_type type;
57
58
59 struct work_struct work;
60
61
62 struct hlist_node node;
63
64
65 struct rw_semaphore lock;
66 struct rb_root_cached objects;
67
68 #ifdef CONFIG_HMM_MIRROR
69
70 struct hmm_mirror mirror;
71 #endif
72 };
73
74 #if defined(CONFIG_HMM_MIRROR)
75 void amdgpu_mn_lock(struct amdgpu_mn *mn);
76 void amdgpu_mn_unlock(struct amdgpu_mn *mn);
77 struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
78 enum amdgpu_mn_type type);
79 int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr);
80 void amdgpu_mn_unregister(struct amdgpu_bo *bo);
81 void amdgpu_hmm_init_range(struct hmm_range *range);
82 #else
83 static inline void amdgpu_mn_lock(struct amdgpu_mn *mn) {}
84 static inline void amdgpu_mn_unlock(struct amdgpu_mn *mn) {}
85 static inline struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
86 enum amdgpu_mn_type type)
87 {
88 return NULL;
89 }
90 static inline int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
91 {
92 DRM_WARN_ONCE("HMM_MIRROR kernel config option is not enabled, "
93 "add CONFIG_ZONE_DEVICE=y in config file to fix this\n");
94 return -ENODEV;
95 }
96 static inline void amdgpu_mn_unregister(struct amdgpu_bo *bo) {}
97 #endif
98
99 #endif