drm/amdgpu: Fix vram recover doesn't work after whole GPU reset (v2)
authorjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:21:05 +0000 (03:21 +0000)
committerjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:21:05 +0000 (03:21 +0000)
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

index a15539e..9693660 100644 (file)
@@ -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 ||