drm/amdgpu: Create hqd info structure
Subsystems (3)
PATCH v4 4/10 drm/amdgpu: Create hqd info structure
Create hung_queue_hqd_info structure and fill in hung queses information passed by MES, including queue type, pipe id, and queue id.
Suggested-by Jonathan Kim <[email protected]>
Signed-off-by Amber Lin <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 20 ++++++++------------ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 13 +++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +8 -12
@@ -447,7 +447,7 @@ int amdgpu_mes_detect_and_reset_hung_queues(struct amdgpu_device *adev, {struct mes_detect_and_reset_queue_input input;u32 *db_array = adev->mes.hung_queue_db_array_cpu_addr[xcc_id]; -int r, i; +int hqd_info_offset = adev->mes.hung_queue_hqd_info_offset, r, i;if (!hung_db_num || !hung_db_array)return -EINVAL ;
@@ -466,8 +466,9 @@ int amdgpu_mes_detect_and_reset_hung_queues(struct amdgpu_device *adev, r = adev->mes.funcs->detect_and_reset_hung_queues (&adev->mes, &input); -if (r && detect_only) { -dev_err (adev->dev,"Failed to detect hung queues\n" ); +if (r) { +dev_warn (adev->dev,"Failed to %s hung queues\n" , + detect_only?"detect" :"reset" );return r; }
@@ -481,18 +482,13 @@ int amdgpu_mes_detect_and_reset_hung_queues(struct amdgpu_device *adev, } } -if (r && !hung_db_num) { -dev_err (adev->dev,"Failed to detect and reset hung queues\n" ); +if (!hung_db_num) { +dev_warn (adev->dev,"No hung queues info from MES\n" );return r; } -/* -* TODO: return HQD info for MES scheduled user compute queue reset cases -* stored in hung_db_array hqd info offset to full array size -*/ - -if (r) -dev_err (adev->dev,"failed to reset\n" ); +for (i = hqd_info_offset; i < hqd_info_offset + *hung_db_num; i++) + hung_db_array[i] = db_array[i];return r; }
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +13 -0
@@ -170,6 +170,19 @@ struct amdgpu_mes {uint64_t shared_cmd_buf_gpu_addr[AMDGPU_MAX_MES_INST_PIPES ]; }; +struct amdgpu_mes_hung_queue_hqd_info { +union { +struct { +uint32_t queue_type:3 ;// queue type +uint32_t pipe_index:4 ;// pipe index +uint32_t queue_index:8 ;// queue index +uint32_t reserved:17 ; + }; + +uint32_t bit0_31; + }; +}; +struct amdgpu_mes_gang {int gang_id;int priority;
Signature · 1 line
2.43.0
PATCH v4 9/10 drm/amdkfd: Reset queue/pipe in MES
When removing queues fails, KFD calls amdgpu_mes to detect and reset hung queues, then cleans up those hung queues in KFD.
Suggested-by Jonathan Kim <[email protected]>
Signed-off-by Amber Lin <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 + .../drm/amd/amdkfd/kfd_device_queue_manager.c | 147 +++++++++++++++++- .../drm/amd/amdkfd/kfd_device_queue_manager.h | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + 5 files changed, 156 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +6 -0
@@ -788,6 +788,12 @@ bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev) amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(12, 0, 0)); } +bool amdgpu_mes_queue_reset_by_mes_supported (struct amdgpu_device *adev) +{ +return (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (12 ,1 ,0 ) && + (adev->mes.sched_version &AMDGPU_MES_VERSION_MASK ) >=0x73 ); +} +/* Fix me -- node_id is used to identify the correct MES instances in the future */ static int amdgpu_mes_set_enforce_isolation (struct amdgpu_device *adev,uint32_t node_id,bool enable)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +1 -0
@@ -548,6 +548,7 @@ static inline void amdgpu_mes_unlock(struct amdgpu_mes *mes) }bool amdgpu_mes_suspend_resume_all_supported (struct amdgpu_device *adev); +bool amdgpu_mes_queue_reset_by_mes_supported (struct amdgpu_device *adev);int amdgpu_mes_update_enforce_isolation (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +145 -2
225 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +3 -1
@@ -32,7 +32,6 @@#include "kfd_priv.h" #include "kfd_mqd_manager.h" -#define VMID_NUM 16#define KFD_MES_PROCESS_QUANTUM 100000
@@ -285,6 +284,9 @@ struct device_queue_manager {struct dqm_detect_hang_info *detect_hang_info;size_t detect_hang_info_size;int detect_hang_count; +/* for per-queue reset with mes */ +uint32_t *hung_db_array; +struct amdgpu_mes_hung_queue_hqd_info *hqd_info; }; void device_queue_manager_init_cik(
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -0
@@ -523,6 +523,7 @@ struct queue_properties {uint32_t pm4_target_xcc;bool is_dbg_wa;bool is_user_cu_masked; +bool is_reset;/* Not relevant for user mode queues in cp scheduling */ unsigned int vmid;/* Relevant only for sdma queues*/
Signature · 1 line
2.43.0