hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
....@@ -30,6 +30,9 @@
3030
3131 #include <drm/amdgpu_drm.h>
3232 #include "amdgpu.h"
33
+#ifdef CONFIG_MMU_NOTIFIER
34
+#include <linux/mmu_notifier.h>
35
+#endif
3336
3437 #define AMDGPU_BO_INVALID_OFFSET LONG_MAX
3538 #define AMDGPU_BO_MAX_PLACEMENTS 3
....@@ -41,7 +44,8 @@
4144 u32 preferred_domain;
4245 u64 flags;
4346 enum ttm_bo_type type;
44
- struct reservation_object *resv;
47
+ bool no_wait_gpu;
48
+ struct dma_resv *resv;
4549 };
4650
4751 /* bo virtual addresses in a vm */
....@@ -72,6 +76,8 @@
7276
7377 /* If the mappings are cleared or filled */
7478 bool cleared;
79
+
80
+ bool is_xgmi;
7581 };
7682
7783 struct amdgpu_bo {
....@@ -89,20 +95,21 @@
8995 void *metadata;
9096 u32 metadata_size;
9197 unsigned prime_shared_count;
92
- /* list of all virtual address to which this bo is associated to */
93
- struct list_head va;
98
+ /* per VM structure for page tables and with virtual addresses */
99
+ struct amdgpu_vm_bo_base *vm_bo;
94100 /* Constant after initialization */
95
- struct drm_gem_object gem_base;
96101 struct amdgpu_bo *parent;
97102 struct amdgpu_bo *shadow;
98103
99104 struct ttm_bo_kmap_obj dma_buf_vmap;
100105 struct amdgpu_mn *mn;
101106
102
- union {
103
- struct list_head mn_list;
104
- struct list_head shadow_list;
105
- };
107
+
108
+#ifdef CONFIG_MMU_NOTIFIER
109
+ struct mmu_interval_notifier notifier;
110
+#endif
111
+
112
+ struct list_head shadow_list;
106113
107114 struct kgd_mem *kfd_bo;
108115 };
....@@ -190,20 +197,7 @@
190197 */
191198 static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
192199 {
193
- return drm_vma_node_offset_addr(&bo->tbo.vma_node);
194
-}
195
-
196
-/**
197
- * amdgpu_bo_gpu_accessible - return whether the bo is currently in memory that
198
- * is accessible to the GPU.
199
- */
200
-static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)
201
-{
202
- switch (bo->tbo.mem.mem_type) {
203
- case TTM_PL_TT: return amdgpu_gtt_mgr_has_gart_addr(&bo->tbo.mem);
204
- case TTM_PL_VRAM: return true;
205
- default: return false;
206
- }
200
+ return drm_vma_node_offset_addr(&bo->tbo.base.vma_node);
207201 }
208202
209203 /**
....@@ -235,6 +229,17 @@
235229 return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC;
236230 }
237231
232
+/**
233
+ * amdgpu_bo_encrypted - test if the BO is encrypted
234
+ * @bo: pointer to a buffer object
235
+ *
236
+ * Return true if the buffer object is encrypted, false otherwise.
237
+ */
238
+static inline bool amdgpu_bo_encrypted(struct amdgpu_bo *bo)
239
+{
240
+ return bo->flags & AMDGPU_GEM_CREATE_ENCRYPTED;
241
+}
242
+
238243 bool amdgpu_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
239244 void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
240245
....@@ -249,6 +254,9 @@
249254 unsigned long size, int align,
250255 u32 domain, struct amdgpu_bo **bo_ptr,
251256 u64 *gpu_addr, void **cpu_addr);
257
+int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
258
+ uint64_t offset, uint64_t size, uint32_t domain,
259
+ struct amdgpu_bo **bo_ptr, void **cpu_addr);
252260 void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
253261 void **cpu_addr);
254262 int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr);
....@@ -275,23 +283,20 @@
275283 uint64_t *flags);
276284 void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
277285 bool evict,
278
- struct ttm_mem_reg *new_mem);
286
+ struct ttm_resource *new_mem);
287
+void amdgpu_bo_release_notify(struct ttm_buffer_object *bo);
279288 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
280289 void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
281290 bool shared);
291
+int amdgpu_bo_sync_wait_resv(struct amdgpu_device *adev, struct dma_resv *resv,
292
+ enum amdgpu_sync_mode sync_mode, void *owner,
293
+ bool intr);
294
+int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr);
282295 u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo);
283
-int amdgpu_bo_backup_to_shadow(struct amdgpu_device *adev,
284
- struct amdgpu_ring *ring,
285
- struct amdgpu_bo *bo,
286
- struct reservation_object *resv,
287
- struct dma_fence **fence, bool direct);
296
+u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo);
288297 int amdgpu_bo_validate(struct amdgpu_bo *bo);
289
-int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,
290
- struct amdgpu_ring *ring,
291
- struct amdgpu_bo *bo,
292
- struct reservation_object *resv,
293
- struct dma_fence **fence,
294
- bool direct);
298
+int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow,
299
+ struct dma_fence **fence);
295300 uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
296301 uint32_t domain);
297302
....@@ -326,6 +331,9 @@
326331 void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
327332 struct seq_file *m);
328333 #endif
334
+int amdgpu_debugfs_sa_init(struct amdgpu_device *adev);
335
+
336
+bool amdgpu_bo_support_uswc(u64 bo_flags);
329337
330338
331339 #endif