Skip to contentSkip to conversation

drm/amdgpu: fix nullptr error of amdgpu_vm_handle_moved

PATCH New Heng Zhou 1 participant 1 message Jul 31, 2025

Subsystems (2)
lore
Share & tools
lore

Heng Zhou

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix nullptr error of amdgpu_vm_handle_moved

If a amdgpu_bo_va is fpriv->prt_va, the bo of this one is always NULL. So, such kind of amdgpu_bo_va should be updated separately within amdgpu_vm_handle_moved.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +12 -1
index 283dd44f04b0..f88b3e3448f5 100644
@@ -578,7 +578,7 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	struct amdgpu_vm_bo_base *bo_base;
 	struct amdgpu_bo *bo;
 	int r;
-
+	
 	if (vm->generation != new_vm_generation) {
 		vm->generation = new_vm_generation;
 		amdgpu_vm_bo_reset_state_machine(vm);
@@ -1608,6 +1608,17 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
 	while (!list_empty(&vm->invalidated)) {
 		bo_va = list_first_entry(&vm->invalidated, struct amdgpu_bo_va,
 					 base.vm_status);
+
+		/* bo_va->base.bo is NULL only when bo_va is a prt_va */
+		if (!bo_va->base.bo) {
+			spin_unlock(&vm->status_lock);
+			r = amdgpu_vm_bo_update(adev, bo_va, false);
+			if (r)
+				return r;
+			spin_lock(&vm->status_lock);
+			continue;
+		}
+
 		resv = bo_va->base.bo->tbo.base.resv;
 		spin_unlock(&vm->status_lock);
 
Signature · 1 line
2.43.0