summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYong Zhao <Yong.Zhao@amd.com>2019-11-08 22:54:07 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-11-13 15:29:45 -0500
commit681a9167ddb2d5f5fd9821f5e484e51b31a073bb (patch)
tree3d067ba805a5b1744bf36d2179d29c121371df09 /drivers
parent4d428e912bb2634e6ba3f7ce8309517a12419174 (diff)
downloadlinux-stable-681a9167ddb2d5f5fd9821f5e484e51b31a073bb.tar.gz
linux-stable-681a9167ddb2d5f5fd9821f5e484e51b31a073bb.tar.bz2
linux-stable-681a9167ddb2d5f5fd9821f5e484e51b31a073bb.zip
drm/amdkfd: Update get_wave_state() for GFX10
Given control stack is now in the userspace context save restore area on GFX10, the same as GFX8, it is not needed to copy it back to userspace. Signed-off-by: Yong Zhao <Yong.Zhao@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
index 4884cd6c65ce..954dc8ac4ff1 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
@@ -251,18 +251,22 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,
{
struct v10_compute_mqd *m;
- /* Control stack is located one page after MQD. */
- void *mqd_ctl_stack = (void *)((uintptr_t)mqd + PAGE_SIZE);
-
m = get_mqd(mqd);
+ /* Control stack is written backwards, while workgroup context data
+ * is written forwards. Both starts from m->cp_hqd_cntl_stack_size.
+ * Current position is at m->cp_hqd_cntl_stack_offset and
+ * m->cp_hqd_wg_state_offset, respectively.
+ */
*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 -
m->cp_hqd_cntl_stack_size;
- if (copy_to_user(ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))
- return -EFAULT;
+ /* Control stack is not copied to user mode for GFXv10 because
+ * it's part of the context save area that is already
+ * accessible to user mode
+ */
return 0;
}