drm/amdgpu: check number of gfx ring before init cp gfx
authorHawking Zhang <Hawking.Zhang@amd.com>
Sat, 21 Nov 2020 13:01:47 +0000 (21:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Dec 2020 20:00:54 +0000 (15:00 -0500)
Check number of gfx ring, rather than asic type,
before cp gfx engine initialization so driver just
need to make sure number of gfx ring is initialized
correctly in gfx early_init phase. No need to add
additional asic type check everywhere when there is
new asic with gfx pipe removed.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index fc9bb94..ef430f2 100644 (file)
@@ -1647,7 +1647,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
        }
 
        /* No CPG in Arcturus */
-       if (adev->asic_type != CHIP_ARCTURUS) {
+       if (adev->gfx.num_gfx_rings) {
                r = gfx_v9_0_init_cp_gfx_microcode(adev, chip_name);
                if (r)
                        return r;
@@ -3822,7 +3822,7 @@ static int gfx_v9_0_cp_resume(struct amdgpu_device *adev)
                gfx_v9_0_enable_gui_idle_interrupt(adev, false);
 
        if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
-               if (adev->asic_type != CHIP_ARCTURUS) {
+               if (adev->gfx.num_gfx_rings) {
                        /* legacy firmware loading */
                        r = gfx_v9_0_cp_gfx_load_microcode(adev);
                        if (r)
@@ -3838,7 +3838,7 @@ static int gfx_v9_0_cp_resume(struct amdgpu_device *adev)
        if (r)
                return r;
 
-       if (adev->asic_type != CHIP_ARCTURUS) {
+       if (adev->gfx.num_gfx_rings) {
                r = gfx_v9_0_cp_gfx_resume(adev);
                if (r)
                        return r;
@@ -3848,7 +3848,7 @@ static int gfx_v9_0_cp_resume(struct amdgpu_device *adev)
        if (r)
                return r;
 
-       if (adev->asic_type != CHIP_ARCTURUS) {
+       if (adev->gfx.num_gfx_rings) {
                ring = &adev->gfx.gfx_ring[0];
                r = amdgpu_ring_test_helper(ring);
                if (r)
@@ -3884,7 +3884,7 @@ static void gfx_v9_0_init_tcp_config(struct amdgpu_device *adev)
 
 static void gfx_v9_0_cp_enable(struct amdgpu_device *adev, bool enable)
 {
-       if (adev->asic_type != CHIP_ARCTURUS)
+       if (adev->gfx.num_gfx_rings)
                gfx_v9_0_cp_gfx_enable(adev, enable);
        gfx_v9_0_cp_compute_enable(adev, enable);
 }
@@ -4025,7 +4025,7 @@ static int gfx_v9_0_soft_reset(void *handle)
                /* stop the rlc */
                adev->gfx.rlc.funcs->stop(adev);
 
-               if (adev->asic_type != CHIP_ARCTURUS)
+               if (adev->gfx.num_gfx_rings)
                        /* Disable GFX parsing/prefetching */
                        gfx_v9_0_cp_gfx_enable(adev, false);