From: jsg Date: Wed, 26 Jul 2023 06:31:05 +0000 (+0000) Subject: drm/amdgpu: fix clearing mappings for BOs that are always valid in VM X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=00d84c35b82f62711979a00f952be7df4a4b0608;p=openbsd drm/amdgpu: fix clearing mappings for BOs that are always valid in VM From Samuel Pitoiset 91e69e67d401eb67178ce5992ddc9b1046b39ee7 in linux-6.1.y/6.1.40 ea2c3c08554601b051d91403a241266e1cf490a5 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c index 1d6ff4db92a..54e47f3003b 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c @@ -1730,18 +1730,30 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, /* Insert partial mapping before the range */ if (!list_empty(&before->list)) { + struct amdgpu_bo *bo = before->bo_va->base.bo; + amdgpu_vm_it_insert(before, &vm->va); if (before->flags & AMDGPU_PTE_PRT) amdgpu_vm_prt_get(adev); + + if (bo && bo->tbo.base.resv == vm->root.bo->tbo.base.resv && + !before->bo_va->base.moved) + amdgpu_vm_bo_moved(&before->bo_va->base); } else { kfree(before); } /* Insert partial mapping after the range */ if (!list_empty(&after->list)) { + struct amdgpu_bo *bo = after->bo_va->base.bo; + amdgpu_vm_it_insert(after, &vm->va); if (after->flags & AMDGPU_PTE_PRT) amdgpu_vm_prt_get(adev); + + if (bo && bo->tbo.base.resv == vm->root.bo->tbo.base.resv && + !after->bo_va->base.moved) + amdgpu_vm_bo_moved(&after->bo_va->base); } else { kfree(after); }