drm/amdgpu: Init the cp MQD if it's not be initialized before
Subsystems (2)
PATCH 4/4 drm/amdgpu: Init the cp MQD if it's not be initialized before
The MQD might not be initialized duirng first init period if the device need to be reset druing probe. Driver need to proper init them in gpu recovery period
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +17 -3
@@ -3696,11 +3696,18 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx =AMDGPU_MAX_COMPUTE_RINGS ; +struct v9_mqd *tmp_mqd;gfx_v9_0_kiq_setting (ring); -if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ +/* GPU could be in bad state during probe, driver trigger the reset +* after load the SMU, in this case , the mqd is not be initialized. +* driver need to re-init the mqd in this case. +* check mqd->cp_hqd_pq_control since this value should not be 0 +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; +if (amdgpu_in_reset (adev) && tmp_mqd->cp_hqd_pq_control){ +/* for GPU_RESET case , reset MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct v9_mqd_allocation ));
@@ -3736,8 +3743,15 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx = ring - &adev->gfx.compute_ring[0 ]; +struct v9_mqd *tmp_mqd; -if (!amdgpu_in_reset (adev) && !adev->in_suspend) { +/* Samw as above kiq init, driver need to re-init the mqd if mqd->cp_hqd_pq_control +* is not be initialized before +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; + +if (!tmp_mqd->cp_hqd_pq_control || + (!amdgpu_in_reset (adev) && !adev->in_suspend)) {memset ((void *)mqd,0 ,sizeof (struct v9_mqd_allocation )); ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask =0xFFFFFFFF ; ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask =0xFFFFFFFF ;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Thursday, February 18, 2021 8:20 PM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Init the cp MQD if it's not be initialized before
The MQD might not be initialized duirng first init period if the device need to be reset druing probe. Driver need to proper init them in gpu recovery period
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +17 -3
@@ -3696,11 +3696,18 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx =AMDGPU_MAX_COMPUTE_RINGS ; +struct v9_mqd *tmp_mqd;gfx_v9_0_kiq_setting (ring); -if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ +/* GPU could be in bad state during probe, driver trigger the reset +* after load the SMU, in this case , the mqd is not be initialized. +* driver need to re-init the mqd in this case. +* check mqd->cp_hqd_pq_control since this value should not be 0 +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; +if (amdgpu_in_reset (adev) && tmp_mqd->cp_hqd_pq_control){ +/* for GPU_RESET case , reset MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct v9_mqd_allocation ));
@@ -3736,8 +3743,15 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx = ring - &adev->gfx.compute_ring[0 ]; +struct v9_mqd *tmp_mqd; -if (!amdgpu_in_reset (adev) && !adev->in_suspend) { +/* Samw as above kiq init, driver need to re-init the mqd if mqd->cp_hqd_pq_control +* is not be initialized before +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; + +if (!tmp_mqd->cp_hqd_pq_control || + (!amdgpu_in_reset (adev) && !adev->in_suspend)) {memset ((void *)mqd,0 ,sizeof (struct v9_mqd_allocation )); ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask =0xFFFFFFFF ; ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask =0xFFFFFFFF ;
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 36 lines · shaoyunl
The MQD might not be initialized duirng first init period if the device need to be reset druing probe. Driver need to proper init them in gpu recovery period
Signed-off-by shaoyunl <[email protected]>Change-Id Iad58a050939af2afa46d1c74a90866c47ba9efd2--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9
-2@@ -3696,11 +3696,18 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx =AMDGPU_MAX_COMPUTE_RINGS ; +struct v9_mqd *tmp_mqd;gfx_v9_0_kiq_setting (ring); -if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ +/* GPU could be in bad state during probe, driver trigger the reset +* after load the SMU, in this case , the mqd is not be initialized. +* driver need to re-init the mqd in this case. +* check mqd->cp_hqd_pq_control since this value should not be 0 +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; +if (amdgpu_in_reset (adev) && tmp_mqd->cp_hqd_pq_control){ +/* for GPU_RESET case , reset MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct v9_mqd_allocation ));
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) · line 3748
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-1@@ -3736,8 +3743,15 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v9_mqd *mqd = ring->mqd_ptr;int mqd_idx = ring - &adev->gfx.compute_ring[0 ]; +struct v9_mqd *tmp_mqd; -if (!amdgpu_in_reset (adev) && !adev->in_suspend) { +/* Samw as above kiq init, driver need to re-init the mqd if mqd->cp_hqd_pq_control
Samw -> Same
I think this also needs to come before patch 1. With these comments fixed:
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-1+* is not be initialized before +*/ + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; + +if (!tmp_mqd->cp_hqd_pq_control || + (!amdgpu_in_reset (adev) && !adev->in_suspend)) {memset ((void *)mqd,0 ,sizeof (struct v9_mqd_allocation )); ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask =0xFFFFFFFF ; ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask =0xFFFFFFFF ; --2.17.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx