The new interface unmaps queues with reset mode for the process consumes
RAS poison, it's only for compute queue.

Signed-off-by: Tao Zhou <tao.zh...@amd.com>
---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c    | 16 ++++++++++++++++
 .../drm/amd/amdkfd/kfd_device_queue_manager.h    |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 01a2cc3928ac..b4b0495c7024 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1476,6 +1476,21 @@ static int unmap_queues_cpsch(struct 
device_queue_manager *dqm,
        return retval;
 }
 
+/* only for compute queue */
+static int unmap_queues_cpsch_poison(struct device_queue_manager *dqm,
+                       uint16_t pasid)
+{
+       int retval;
+
+       dqm_lock(dqm);
+
+       retval = unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_BY_PASID,
+                       pasid, true);
+
+       dqm_unlock(dqm);
+       return retval;
+}
+
 /* dqm->lock mutex has to be locked before calling this function */
 static int execute_queues_cpsch(struct device_queue_manager *dqm,
                                enum kfd_unmap_queues_filter filter,
@@ -1896,6 +1911,7 @@ struct device_queue_manager 
*device_queue_manager_init(struct kfd_dev *dev)
                dqm->ops.evict_process_queues = evict_process_queues_cpsch;
                dqm->ops.restore_process_queues = restore_process_queues_cpsch;
                dqm->ops.get_wave_state = get_wave_state;
+               dqm->ops.unmap_queues_cpsch_poison = unmap_queues_cpsch_poison;
                break;
        case KFD_SCHED_POLICY_NO_HWS:
                /* initialize dqm for no cp scheduling */
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
index 499fc0ea387f..19ec3e8859e8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@ -81,6 +81,8 @@ struct device_process_node {
  *
  * @get_wave_state: Retrieves context save state and optionally copies the
  * control stack, if kept in the MQD, to the given userspace address.
+ *
+ * @unmap_queues_cpsch_poison: reset queue which consumes RAS poison
  */
 
 struct device_queue_manager_ops {
@@ -134,6 +136,9 @@ struct device_queue_manager_ops {
                                  void __user *ctl_stack,
                                  u32 *ctl_stack_used_size,
                                  u32 *save_area_used_size);
+
+       int (*unmap_queues_cpsch_poison)(struct device_queue_manager *dqm,
+                                       uint16_t pasid);
 };
 
 struct device_queue_manager_asic_ops {
-- 
2.17.1

Reply via email to