drm/amdgpu:alloc mqd backup
authorMonk Liu <Monk.Liu@amd.com>
Thu, 26 Jan 2017 07:33:52 +0000 (15:33 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:53:13 +0000 (23:53 -0400)
this is required for restoring the mqds after GPU reset.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

index 9b3b2a3001cc03f3dcaaaec5640928493c858ae4..fa831a8030e4c3414f94e90c609d3399df09d0a5 100644 (file)
@@ -783,6 +783,7 @@ struct amdgpu_mec {
        u32 num_pipe;
        u32 num_mec;
        u32 num_queue;
+       struct vi_mqd   *mqd_backup[AMDGPU_MAX_COMPUTE_RINGS + 1];
 };
 
 struct amdgpu_kiq {
index 919c02f975fe58d9be95bac3c175d94694d4f71f..b2bfee3e5b675c9cf05d9bc98dafe041848a6dc0 100644 (file)
@@ -7315,6 +7315,11 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
                        dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
                        return r;
                }
+
+               /* prepare MQD backup */
+               adev->gfx.mec.mqd_backup[AMDGPU_MAX_COMPUTE_RINGS] = kmalloc(sizeof(struct vi_mqd), GFP_KERNEL);
+               if (!adev->gfx.mec.mqd_backup[AMDGPU_MAX_COMPUTE_RINGS])
+                               dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
        }
 
        /* create MQD for each KCQ */
@@ -7329,6 +7334,11 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
                                dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
                                return r;
                        }
+
+                       /* prepare MQD backup */
+                       adev->gfx.mec.mqd_backup[i] = kmalloc(sizeof(struct vi_mqd), GFP_KERNEL);
+                       if (!adev->gfx.mec.mqd_backup[i])
+                               dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
                }
        }