From: jsg Date: Tue, 13 Jun 2023 03:21:05 +0000 (+0000) Subject: drm/amdgpu: Fix vram recover doesn't work after whole GPU reset (v2) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5f70b624d3c0a44f5703418108f6eff5b9908f89;p=openbsd drm/amdgpu: Fix vram recover doesn't work after whole GPU reset (v2) From Lin.Cao 7a8248317b322d3cb56c64332062bae91460978a in linux-6.1.y/6.1.29 6c032c37ac3ef3b7df30937c785ecc4da428edc0 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index a15539e21ff..9693660acf5 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -4596,7 +4596,11 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) dev_info(adev->dev, "recover vram bo from shadow start\n"); mutex_lock(&adev->shadow_list_lock); list_for_each_entry(vmbo, &adev->shadow_list, shadow_list) { - shadow = &vmbo->bo; + /* If vm is compute context or adev is APU, shadow will be NULL */ + if (!vmbo->shadow) + continue; + shadow = vmbo->shadow; + /* No need to recover an evicted BO */ if (shadow->tbo.resource->mem_type != TTM_PL_TT || shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||