]> Git Repo - linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
Merge tag 'hwmon-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_vm.h
index 5d119ac26c4fe4c890f6f101d6bc0426f2a2a2fc..a3e128e373bc62233bd0361b7f95584c8ebacd15 100644 (file)
@@ -35,6 +35,7 @@
 #include "amdgpu_sync.h"
 #include "amdgpu_ring.h"
 #include "amdgpu_ids.h"
+#include "amdgpu_ttm.h"
 
 struct drm_exec;
 
@@ -202,9 +203,13 @@ struct amdgpu_vm_bo_base {
        /* protected by bo being reserved */
        struct amdgpu_vm_bo_base        *next;
 
-       /* protected by spinlock */
+       /* protected by vm status_lock */
        struct list_head                vm_status;
 
+       /* if the bo is counted as shared in mem stats
+        * protected by vm status_lock */
+       bool                            shared;
+
        /* protected by the BO being reserved */
        bool                            moved;
 };
@@ -324,10 +329,7 @@ struct amdgpu_vm_fault_info {
 struct amdgpu_mem_stats {
        struct drm_memory_stats drm;
 
-       /* buffers that requested this placement */
-       uint64_t requested;
-       /* buffers that requested this placement
-        * but are currently evicted */
+       /* buffers that requested this placement but are currently evicted */
        uint64_t evicted;
 };
 
@@ -345,6 +347,9 @@ struct amdgpu_vm {
        /* Lock to protect vm_bo add/del/move on all lists of vm */
        spinlock_t              status_lock;
 
+       /* Memory statistics for this vm, protected by status_lock */
+       struct amdgpu_mem_stats stats[__AMDGPU_PL_NUM];
+
        /* Per-VM and PT BOs who needs a validation */
        struct list_head        evicted;
 
@@ -524,8 +529,12 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
                        struct amdgpu_bo_va *bo_va,
                        bool clear);
 bool amdgpu_vm_evictable(struct amdgpu_bo *bo);
-void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
-                            struct amdgpu_bo *bo, bool evicted);
+void amdgpu_vm_bo_invalidate(struct amdgpu_bo *bo, bool evicted);
+void amdgpu_vm_update_stats(struct amdgpu_vm_bo_base *base,
+                           struct ttm_resource *new_res, int sign);
+void amdgpu_vm_bo_update_shared(struct amdgpu_bo *bo);
+void amdgpu_vm_bo_move(struct amdgpu_bo *bo, struct ttm_resource *new_mem,
+                      bool evicted);
 uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr);
 struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
                                       struct amdgpu_bo *bo);
@@ -576,8 +585,7 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm);
 void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev,
                                struct amdgpu_vm *vm);
 void amdgpu_vm_get_memory(struct amdgpu_vm *vm,
-                         struct amdgpu_mem_stats *stats,
-                         unsigned int size);
+                         struct amdgpu_mem_stats stats[__AMDGPU_PL_NUM]);
 
 int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                       struct amdgpu_bo_vm *vmbo, bool immediate);
This page took 0.034686 seconds and 4 git commands to generate.