drm/amdgpu/gfx10: implement iqueue reset via MMIO
Subsystems (2)
PATCH v2 1/2 drm/amdgpu/gfx10: implement iqueue reset via MMIO
From: "[email protected]" <[email protected]>
Using mmio to do queue reset.
v2: Alignment this function with gfx9/gfx9.4.3.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +34 -0
@@ -3790,12 +3790,46 @@ static void gfx10_kiq_invalidate_tlbs(struct amdgpu_ring *kiq_ring,gfx_v10_0_ring_invalidate_tlbs (kiq_ring, pasid, flush_type, all_hub,1 ); } +static void gfx_v10_0_kiq_reset_hw_queue (struct amdgpu_ring *kiq_ring,uint32_t queue_type, +uint32_t me_id,uint32_t pipe_id,uint32_t queue_id, +uint32_t xcc_id,uint32_t vmid) +{ +struct amdgpu_device *adev = kiq_ring->adev; +unsigned i; + +/* enter save mode */ +amdgpu_gfx_rlc_enter_safe_mode (adev, xcc_id); +mutex_lock (&adev->srbm_mutex); +nv_grbm_select (adev, me_id, pipe_id, queue_id,0 ); + +if (queue_type ==AMDGPU_RING_TYPE_COMPUTE ) { +WREG32_SOC15 (GC ,0 , mmCP_HQD_DEQUEUE_REQUEST,0x2 ); +WREG32_SOC15 (GC ,0 , mmSPI_COMPUTE_QUEUE_RESET,0x1 ); +/* wait till dequeue take effects */ +for (i =0 ; i < adev->usec_timeout; i++) { +if (!(RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 )) +break ; +udelay (1 ); + } +if (i >= adev->usec_timeout) +dev_err (adev->dev,"fail to wait on hqd deactive\n" ); + }else { +dev_err (adev->dev,"reset queue_type(%d) not supported\n" , queue_type); + } + +nv_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +/* exit safe mode */ +amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); +} +static const struct kiq_pm4_funcs gfx_v10_0_kiq_pm4_funcs = { .kiq_set_resources = gfx10_kiq_set_resources, .kiq_map_queues = gfx10_kiq_map_queues, .kiq_unmap_queues = gfx10_kiq_unmap_queues, .kiq_query_status = gfx10_kiq_query_status, .kiq_invalidate_tlbs = gfx10_kiq_invalidate_tlbs, + .kiq_reset_hw_queue = gfx_v10_0_kiq_reset_hw_queue, .set_resources_size =8 , .map_queues_size =7 , .unmap_queues_size =6 ,
Signature · 1 line
2.25.1
PATCH v2 2/2 drm/amdgpu/gfx10: implement gfx queue reset via MMIO
From: "[email protected]" <[email protected]>
Using mmio to do queue reset
v2: Alignment the function with gfx9/gfx9.4.3.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +20 -1
@@ -3796,6 +3796,7 @@ static void gfx_v10_0_kiq_reset_hw_queue(struct amdgpu_ring *kiq_ring, uint32_t {struct amdgpu_device *adev = kiq_ring->adev;unsigned i; +uint32_t tmp;/* enter save mode */ amdgpu_gfx_rlc_enter_safe_mode (adev, xcc_id);
@@ -3813,7 +3814,25 @@ static void gfx_v10_0_kiq_reset_hw_queue(struct amdgpu_ring *kiq_ring, uint32_t }if (i >= adev->usec_timeout)dev_err (adev->dev,"fail to wait on hqd deactive\n" ); - }else { + }else if (queue_type ==AMDGPU_RING_TYPE_GFX ) { +WREG32_SOC15 (GC ,0 , mmGRBM_GFX_INDEX, + (uint32_t )(0x1 <<GRBM_GFX_INDEX__SE_BROADCAST_WRITES__SHIFT )); + tmp =REG_SET_FIELD (0 ,CP_VMID_RESET ,RESET_REQUEST ,1 << vmid); +if (pipe_id ==0 ) + tmp =REG_SET_FIELD (tmp,CP_VMID_RESET ,PIPE0_QUEUES ,1 << queue_id); +else + tmp =REG_SET_FIELD (tmp,CP_VMID_RESET ,PIPE1_QUEUES ,1 << queue_id); +WREG32_SOC15 (GC ,0 , mmCP_VMID_RESET, tmp); + +/* wait till dequeue take effects */ +for (i =0 ; i < adev->usec_timeout; i++) { +if (!(RREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_ACTIVE) &1 )) +break ; +udelay (1 ); + } +if (i >= adev->usec_timeout) +dev_err (adev->dev,"failed to wait on gfx hqd deactivate\n" ); + }else {dev_err (adev->dev,"reset queue_type(%d) not supported\n" , queue_type); }
Signature · 1 line
2.25.1
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, January 10, 2025 1:22 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhu, Jiadong <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 1/2 V2] drm/amdgpu/gfx10: implement iqueue reset via MMIO
From: "[email protected]" <[email protected]>
Using mmio to do queue reset.
v2: Alignment this function with gfx9/gfx9.4.3.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +33 -1
@@ -3790,12 +3790,46 @@ static void gfx10_kiq_invalidate_tlbs(struct amdgpu_ring *kiq_ring,gfx_v10_0_ring_invalidate_tlbs (kiq_ring, pasid, flush_type, all_hub,1 ); } +static void gfx_v10_0_kiq_reset_hw_queue (struct amdgpu_ring *kiq_ring,uint32_t queue_type, +uint32_t me_id,uint32_t pipe_id,uint32_t queue_id, +uint32_t xcc_id,uint32_t vmid) +{ +struct amdgpu_device *adev = kiq_ring->adev; +unsigned i; + +/* enter save mode */ +amdgpu_gfx_rlc_enter_safe_mode (adev, xcc_id); +mutex_lock (&adev->srbm_mutex); +nv_grbm_select (adev, me_id, pipe_id, queue_id,0 ); + +if (queue_type ==AMDGPU_RING_TYPE_COMPUTE ) { +WREG32_SOC15 (GC ,0 , mmCP_HQD_DEQUEUE_REQUEST,0x2 ); +WREG32_SOC15 (GC ,0 , mmSPI_COMPUTE_QUEUE_RESET,0x1 ); +/* wait till dequeue take effects */ +for (i =0 ; i < adev->usec_timeout; i++) { +if (!(RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 )) +break ; +udelay (1 ); + } +if (i >= adev->usec_timeout) +dev_err (adev->dev,"fail to wait on hqd deactive\n" ); + }else { +dev_err (adev->dev,"reset queue_type(%d) not supported\n" , queue_type); + } + +nv_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +/* exit safe mode */ +amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); } +static const struct kiq_pm4_funcs gfx_v10_0_kiq_pm4_funcs = { .kiq_set_resources = gfx10_kiq_set_resources, .kiq_map_queues = gfx10_kiq_map_queues, .kiq_unmap_queues = gfx10_kiq_unmap_queues, .kiq_query_status = gfx10_kiq_query_status, .kiq_invalidate_tlbs = gfx10_kiq_invalidate_tlbs, + .kiq_reset_hw_queue = gfx_v10_0_kiq_reset_hw_queue, .set_resources_size =8 , .map_queues_size =7 , .unmap_queues_size =6 , --
2.25.1
Alex Deucher
Reviewed-byQuoted 5 lines · Jesse(Jie)
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
Series is:
Quoted 70 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, January 10, 2025 1:22 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhu, Jiadong <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 1/2 V2] drm/amdgpu/gfx10: implement iqueue reset via MMIOFrom: "[email protected]" <[email protected]>
Using mmio to do queue reset.
v2: Alignment this function with gfx9/gfx9.4.3.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +33
-1@@ -3790,12 +3790,46 @@ static void gfx10_kiq_invalidate_tlbs(struct amdgpu_ring *kiq_ring,gfx_v10_0_ring_invalidate_tlbs (kiq_ring, pasid, flush_type, all_hub,1 ); } +static void gfx_v10_0_kiq_reset_hw_queue (struct amdgpu_ring *kiq_ring,uint32_t queue_type, +uint32_t me_id,uint32_t pipe_id,uint32_t queue_id, +uint32_t xcc_id,uint32_t vmid) +{ +struct amdgpu_device *adev = kiq_ring->adev; +unsigned i; + +/* enter save mode */ +amdgpu_gfx_rlc_enter_safe_mode (adev, xcc_id); +mutex_lock (&adev->srbm_mutex); +nv_grbm_select (adev, me_id, pipe_id, queue_id,0 ); + +if (queue_type ==AMDGPU_RING_TYPE_COMPUTE ) { +WREG32_SOC15 (GC ,0 , mmCP_HQD_DEQUEUE_REQUEST,0x2 ); +WREG32_SOC15 (GC ,0 , mmSPI_COMPUTE_QUEUE_RESET,0x1 ); +/* wait till dequeue take effects */ +for (i =0 ; i < adev->usec_timeout; i++) { +if (!(RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 )) +break ; +udelay (1 ); + } +if (i >= adev->usec_timeout) +dev_err (adev->dev,"fail to wait on hqd deactive\n" ); + }else { +dev_err (adev->dev,"reset queue_type(%d) not supported\n" , queue_type); + } + +nv_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +/* exit safe mode */ +amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); } +static const struct kiq_pm4_funcs gfx_v10_0_kiq_pm4_funcs = { .kiq_set_resources = gfx10_kiq_set_resources, .kiq_map_queues = gfx10_kiq_map_queues, .kiq_unmap_queues = gfx10_kiq_unmap_queues, .kiq_query_status = gfx10_kiq_query_status, .kiq_invalidate_tlbs = gfx10_kiq_invalidate_tlbs, + .kiq_reset_hw_queue = gfx_v10_0_kiq_reset_hw_queue, .set_resources_size =8 , .map_queues_size =7 , .unmap_queues_size =6 , --2.25.1