From 5f70b624d3c0a44f5703418108f6eff5b9908f89 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 13 Jun 2023 03:21:05 +0000 Subject: [PATCH] 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 --- sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 || -- 2.20.1