This commit keeps CWSR registers when init_mqd
with modify == true

Signed-off-by: Zhu Lingshan <[email protected]>
Reviewed-by: Benjamin Welton <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index fe6e9ac7b170..e49c1f55e34d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -3313,8 +3313,11 @@ static int gfx_v12_0_compute_mqd_init(struct 
amdgpu_device *adev, void *m,
                        upper_32_bits(prop->ctx_save_area_addr);
                mqd->cp_hqd_ctx_save_size = prop->ctx_save_area_size;
                mqd->cp_hqd_cntl_stack_size = prop->ctl_stack_size;
-               mqd->cp_hqd_cntl_stack_offset = prop->ctl_stack_size;
-               mqd->cp_hqd_wg_state_offset = prop->ctl_stack_size;
+               /* MODIFY keeps the firmware-saved CWSR offsets; otherwise 
reset them */
+               if (!prop->modify) {
+                       mqd->cp_hqd_cntl_stack_offset = prop->ctl_stack_size;
+                       mqd->cp_hqd_wg_state_offset = prop->ctl_stack_size;
+               }
        }
 
        return 0;
-- 
2.53.0

Reply via email to