Skip to content

Commit c4d18e9

Browse files
pixelclustergregkh
authored andcommitted
drm/amdgpu: Forward VMID reservation errors
[ Upstream commit 8defb4f ] Otherwise userspace may be fooled into believing it has a reserved VMID when in reality it doesn't, ultimately leading to GPU hangs when SPM is used. Fixes: 80e709e ("drm/amdgpu: add option params to enforce process isolation between graphics and compute") Cc: stable@vger.kernel.org Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Natalie Vock <natalie.vock@gmx.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> [ adapted 3-argument amdgpu_vmid_alloc_reserved(adev, vm, vmhub) call to 2-argument version and added separate error check to preserve reserved_vmid tracking logic. ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 585dbb5 commit c4d18e9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,10 +2747,12 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
27472747
case AMDGPU_VM_OP_RESERVE_VMID:
27482748
/* We only have requirement to reserve vmid from gfxhub */
27492749
if (!fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) {
2750-
amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(0));
2750+
int r = amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(0));
2751+
2752+
if (r)
2753+
return r;
27512754
fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)] = true;
27522755
}
2753-
27542756
break;
27552757
case AMDGPU_VM_OP_UNRESERVE_VMID:
27562758
if (fpriv->vm.reserved_vmid[AMDGPU_GFXHUB(0)]) {

0 commit comments

Comments
 (0)