]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/amdgpu: also track late init state
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 2 Oct 2016 21:06:44 +0000 (00:06 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Oct 2016 16:39:02 +0000 (12:39 -0400)
Successful sw_init() and hw_init() states are tracked, but not
late_init(). Various error paths may result in amdgpu_fini() being
called before .late init is done, so late_init needs to be tracked
to avoid unexpected or multiple .late_fini() calls.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 235f3902643a387576156f7bfd9668eb0b4586a3..039b57e4644c3936bfe345426ff17754847b199b 100644 (file)
@@ -1943,6 +1943,7 @@ struct amdgpu_ip_block_status {
        bool valid;
        bool sw;
        bool hw;
+       bool late_initialized;
        bool hang;
 };
 
index 99a15cad67897b48b87685851fec31eebac8ce69..a58513f271e3fdf410385d3e1b801c7fe413e256 100644 (file)
@@ -1424,6 +1424,7 @@ static int amdgpu_late_init(struct amdgpu_device *adev)
                                DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
                                return r;
                        }
+                       adev->ip_block_status[i].late_initialized = true;
                }
        }
 
@@ -1469,8 +1470,11 @@ static int amdgpu_fini(struct amdgpu_device *adev)
        }
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
+               if (!adev->ip_block_status[i].late_initialized)
+                       continue;
                if (adev->ip_blocks[i].funcs->late_fini)
                        adev->ip_blocks[i].funcs->late_fini((void *)adev);
+               adev->ip_block_status[i].late_initialized = false;
        }
 
        return 0;