<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+ Laurent</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Zhao, Yong <Yong.Zhao@amd.com><br>
<b>Sent:</b> Monday, November 11, 2019 6:25 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Cornwall, Jay <Jay.Cornwall@amd.com><br>
<b>Cc:</b> Zhao, Yong <Yong.Zhao@amd.com><br>
<b>Subject:</b> [PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">workgroup context data writes from m->cp_hqd_cntl_stack_size, so we<br>
should deduct it when calculating the used size.<br>
<br>
Change-Id: I5252e25662c3b8221f451c39115bf084d1911eae<br>
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++-<br>
1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c<br>
index d3380c5bdbde..3a2ee1f01aae 100644<br>
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c<br>
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c<br>
@@ -302,7 +302,8 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,<br>
<br>
*ctl_stack_used_size = m->cp_hqd_cntl_stack_size -<br>
m->cp_hqd_cntl_stack_offset;<br>
- *save_area_used_size = m->cp_hqd_wg_state_offset;<br>
+ *save_area_used_size = m->cp_hqd_wg_state_offset -<br>
+ m->cp_hqd_cntl_stack_size;;<br>
<br>
if (copy_to_user(ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))<br>
return -EFAULT;<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>