drm/amdgpu: Polish SQ IH.
Subsystems (2)
PATCH v3 1/2 drm/amdgpu: Polish SQ IH.
Switch to using reg fields defines istead of magic values. Add SH_ID and PRIV fields reading for instr. and err cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +20 -16
@@ -6958,10 +6958,11 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev, {u8 enc, se_id;char type[20 ]; +unsigned ih_data = entry->src_data[0 ]; -/* Parse all fields according to SQ_INTERRUPT* registers */ - enc = (entry->src_data[0 ] >>26 ) &0x3 ; - se_id = (entry->src_data[0 ] >>24 ) &0x3 ; + + enc =REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_CMN ,ENCODING ); + se_id =REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_CMN ,SE_ID );switch (enc) {case 0 :
@@ -6971,14 +6972,14 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev,"reg_timestamp %d, thread_trace_buff_full %d," "wlt %d, thread_trace %d.\n" , se_id, - (entry->src_data[0 ] >>7 ) &0x1 , - (entry->src_data[0 ] >>6 ) &0x1 , - (entry->src_data[0 ] >>5 ) &0x1 , - (entry->src_data[0 ] >>4 ) &0x1 , - (entry->src_data[0 ] >>3 ) &0x1 , - (entry->src_data[0 ] >>2 ) &0x1 , - (entry->src_data[0 ] >>1 ) &0x1 , - entry->src_data[0 ] &0x1 +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,IMMED_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,HOST_REG_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,HOST_CMD_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,CMD_TIMESTAMP ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,REG_TIMESTAMP ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,THREAD_TRACE_BUF_FULL ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,WLT ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,THREAD_TRACE ) );break ;case 1 :
@@ -6991,12 +6992,15 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev,DRM_INFO ("SQ %s detected: " -"se_id %d, cu_id %d, simd_id %d, wave_id %d, vm_id %d\n" , +"se_id %d, cu_id %d, simd_id %d, wave_id %d, vm_id %d\n" +"trap %s, sh_id %d. " , type, se_id, - (entry->src_data[0 ] >>20 ) &0xf , - (entry->src_data[0 ] >>18 ) &0x3 , - (entry->src_data[0 ] >>14 ) &0xf , - (entry->src_data[0 ] >>10 ) &0xf +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,CU_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,SIMD_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,WAVE_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,VM_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,PRIV ) ?"true" :"false" , +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,SH_ID ) );break ;default :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1529518643-21499-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH v3 2/2 drm/amdgpu: Add parsing SQ_EDC_INFO to SQ IH.
Access to SQ_EDC_INFO requires selecting register instance and hence mutex lock when accessing GRBM_GFX_INDEX for which a work is schedueled from IH. But SQ interrupt can be raised on many instances at once which means queuing work will usually succeed for the first one but fail for the rest since the work takes time to process. To avoid losing info about other interrupt instances call the parsing function directly from high IRQ when current work hasn't finished and avoid accessing SQ_EDC_INFO in that case.
v2:
Simplify high IRQ and BH handlers synchronization using work_pending. Remove {READ,WRITE}_ONCE notations since smp_{r,w}mb are implicit compiler barriers.
v3:
Remove exlicit memory barriers as scedule_work has r/w barriers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 +++ drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 82 +++++++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +7 -0
@@ -930,6 +930,11 @@ struct amdgpu_ngg {bool init; }; +struct sq_work { +struct work_struct work; +unsigned ih_data; +}; +struct amdgpu_gfx {struct mutex gpu_clock_mutex;struct amdgpu_gfx_config config;
@@ -970,6 +975,8 @@ struct amdgpu_gfx {struct amdgpu_irq_src priv_inst_irq;struct amdgpu_irq_src cp_ecc_error_irq;struct amdgpu_irq_src sq_irq; +struct sq_work sq_work; +/* gfx status */ uint32_t gfx_current_status;/* ce ram size*/
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +69 -13
127 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Series is:
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Andrey Grodzovsky <[email protected]>
Sent: Wednesday, June 20, 2018 2:17:22 PM
To: [email protected]; [email protected]
Cc: Panariti, David; Haehnle, Nicolai; Grodzovsky, Andrey
Subject: [PATCH v3 1/2] drm/amdgpu: Polish SQ IH.
Switch to using reg fields defines istead of magic values. Add SH_ID and PRIV fields reading for instr. and err cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +20 -16
@@ -6958,10 +6958,11 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev, {u8 enc, se_id;char type[20 ]; +unsigned ih_data = entry->src_data[0 ]; -/* Parse all fields according to SQ_INTERRUPT* registers */ - enc = (entry->src_data[0 ] >>26 ) &0x3 ; - se_id = (entry->src_data[0 ] >>24 ) &0x3 ; + + enc =REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_CMN ,ENCODING ); + se_id =REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_CMN ,SE_ID );switch (enc) {case 0 :
@@ -6971,14 +6972,14 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev,"reg_timestamp %d, thread_trace_buff_full %d," "wlt %d, thread_trace %d.\n" , se_id, - (entry->src_data[0 ] >>7 ) &0x1 , - (entry->src_data[0 ] >>6 ) &0x1 , - (entry->src_data[0 ] >>5 ) &0x1 , - (entry->src_data[0 ] >>4 ) &0x1 , - (entry->src_data[0 ] >>3 ) &0x1 , - (entry->src_data[0 ] >>2 ) &0x1 , - (entry->src_data[0 ] >>1 ) &0x1 , - entry->src_data[0 ] &0x1 +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,IMMED_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,HOST_REG_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,HOST_CMD_OVERFLOW ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,CMD_TIMESTAMP ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,REG_TIMESTAMP ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,THREAD_TRACE_BUF_FULL ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,WLT ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_AUTO ,THREAD_TRACE ) );break ;case 1 :
@@ -6991,12 +6992,15 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev,DRM_INFO ("SQ %s detected: " -"se_id %d, cu_id %d, simd_id %d, wave_id %d, vm_id %d\n" , +"se_id %d, cu_id %d, simd_id %d, wave_id %d, vm_id %d\n" +"trap %s, sh_id %d. " , type, se_id, - (entry->src_data[0 ] >>20 ) &0xf , - (entry->src_data[0 ] >>18 ) &0x3 , - (entry->src_data[0 ] >>14 ) &0xf , - (entry->src_data[0 ] >>10 ) &0xf +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,CU_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,SIMD_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,WAVE_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,VM_ID ), +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,PRIV ) ?"true" :"false" , +REG_GET_FIELD (ih_data,SQ_INTERRUPT_WORD_WAVE ,SH_ID ) );break ;default :
--
2.7.4
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx