diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3823-drm-amdkfd-fix-queue-snapshot-input-handling-and-ret.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3823-drm-amdkfd-fix-queue-snapshot-input-handling-and-ret.patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3823-drm-amdkfd-fix-queue-snapshot-input-handling-and-ret.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3823-drm-amdkfd-fix-queue-snapshot-input-handling-and-ret.patch new file mode 100644 index 00000000..9c904339 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3823-drm-amdkfd-fix-queue-snapshot-input-handling-and-ret.patch @@ -0,0 +1,99 @@ +From d3247f280efdb81b94cc45cf6aea5e2c32321be8 Mon Sep 17 00:00:00 2001 +From: Jonathan Kim <jonathan.kim@amd.com> +Date: Wed, 11 Sep 2019 09:30:07 -0400 +Subject: [PATCH 3823/4256] drm/amdkfd: fix queue snapshot input handling and + return + +queue snapshot doesn't need to set gpu id. should get queues +from target process, not calling process. set queues copied +to 0 if there are 0 queues or on errno. + +New queue should clear unconditionally on any queue status word update. + +Change-Id: If8bcf35ce27da2a8e07061a67298b5a29d5f7b99 +Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> +Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> +--- + drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 15 +++++++++------ + drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c | 6 +++--- + 2 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +index 547e7f511775..fa1385d60235 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +@@ -2611,6 +2611,7 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep, + uint32_t data2; + uint32_t data3; + bool is_suspend_or_resume; ++ bool is_q_snapshot; + + debug_trap_action = args->op; + gpu_id = args->gpu_id; +@@ -2628,6 +2629,9 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep, + debug_trap_action == KFD_IOC_DBG_TRAP_NODE_SUSPEND || + debug_trap_action == KFD_IOC_DBG_TRAP_NODE_RESUME; + ++ is_q_snapshot = ++ debug_trap_action == KFD_IOC_DBG_TRAP_GET_QUEUE_SNAPSHOT; ++ + pid = find_get_pid(args->pid); + if (!pid) { + pr_err("Cannot find pid info for %i\n", +@@ -2661,7 +2665,7 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep, + + mutex_lock(&target->mutex); + +- if (!is_suspend_or_resume) { ++ if (!(is_suspend_or_resume || is_q_snapshot)) { + + dev = kfd_device_by_id(args->gpu_id); + if (!dev) { +@@ -2705,7 +2709,7 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep, + r = -EINVAL; + goto unlock_out; + } +- } else { ++ } else if (!is_q_snapshot) { + /* data 2 has the number of queue IDs */ + size_t queue_id_array_size = sizeof(uint32_t) * data2; + +@@ -2801,14 +2805,13 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep, + &args->data3); + break; + case KFD_IOC_DBG_TRAP_GET_QUEUE_SNAPSHOT: +- r = pqm_get_queue_snapshot(&p->pqm, args->data1, ++ r = pqm_get_queue_snapshot(&target->pqm, args->data1, + (void __user *)args->ptr, + args->data2); + +- if (r > 0) { +- args->data2 = r; ++ args->data2 = r < 0 ? 0 : r; ++ if (r > 0) + r = 0; +- } + + break; + default: +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c +index 5433b6527bae..cabf26f03077 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c +@@ -112,10 +112,10 @@ uint32_t kfd_dbg_get_queue_status_word(struct queue *q, int flags) + KFD_DBG_EV_SET_NEW_QUEUE_STATE(queue_status_word, + q->properties.is_new); + +- if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS) { +- q->properties.is_new = false; ++ if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS) + q->properties.debug_event_type = 0; +- } ++ ++ q->properties.is_new = false; + + return queue_status_word; + } +-- +2.17.1 + |