[PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size

Zhao, Yong Yong.Zhao at amd.com
Tue Nov 12 21:14:50 UTC 2019


+ Laurent
________________________________
From: Zhao, Yong <Yong.Zhao at amd.com>
Sent: Monday, November 11, 2019 6:25 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>; Cornwall, Jay <Jay.Cornwall at amd.com>
Cc: Zhao, Yong <Yong.Zhao at amd.com>
Subject: [PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size

workgroup context data writes from m->cp_hqd_cntl_stack_size, so we
should deduct it when calculating the used size.

Change-Id: I5252e25662c3b8221f451c39115bf084d1911eae
Signed-off-by: Yong Zhao <Yong.Zhao at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index d3380c5bdbde..3a2ee1f01aae 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -302,7 +302,8 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,

         *ctl_stack_used_size = m->cp_hqd_cntl_stack_size -
                 m->cp_hqd_cntl_stack_offset;
-       *save_area_used_size = m->cp_hqd_wg_state_offset;
+       *save_area_used_size = m->cp_hqd_wg_state_offset -
+               m->cp_hqd_cntl_stack_size;;

         if (copy_to_user(ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))
                 return -EFAULT;
--
2.17.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20191112/eb7823aa/attachment-0001.html>


More information about the amd-gfx mailing list