drm/amdgpu/gfx: fix MEC interrupt enablement for pipes != 0
Subsystems (2)
PATCH 1/2 drm/amdgpu/gfx: fix MEC interrupt enablement for pipes != 0
The interrupt registers are not indexed.
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59 +++++++++++++++++++++++++---------- 3 files changed, 124 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +40 -17
@@ -5015,28 +5015,51 @@ static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is for graphics and Me 2 is reserved for HW scheduling - * So we should only really be configuring ME 1 i.e. MEC0 + u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ - if (me != 1) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41 -16
67 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +43 -16
69 lines not on this page · raw message
Signature · 6 lines
2.5.5 _______________________________________________ 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): 1497012570-24173-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Now that interrupts are properly enabled for all pipes, this should be function properly.
---
Shirish,
Can you test this change on your Stoney setup?
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -9
@@ -125,15 +125,9 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -if (adev->gfx.mec.num_mec >1 ) { -/* policy: amdgpu owns the first two queues of the first MEC */ -if (mec ==0 && queue <2 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - }else { -/* policy: amdgpu owns all queues in the first pipe */ -if (mec ==0 && pipe ==0 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - } +/* policy: amdgpu owns the first two queues of the first MEC */ +if (mec ==0 && queue <2 ) +set_bit (i, adev->gfx.mec.queue_bitmap); }/* update the number of active compute rings */
Signature · 6 lines
2.5.5 _______________________________________________ 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): 1497012570-24173-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Sure Alex.
I shall update the result on stoney soon.
Regards,
Shirish S
________________________________
From: Alex Deucher <[email protected]>
Sent: Friday, June 9, 2017 6:19:30 PM
To: [email protected]
Cc: Deucher, Alexander; S, Shirish
Subject: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Now that interrupts are properly enabled for all pipes, this should be function properly.
---
Shirish,
Can you test this change on your Stoney setup?
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -9
@@ -125,15 +125,9 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -if (adev->gfx.mec.num_mec >1 ) { -/* policy: amdgpu owns the first two queues of the first MEC */ -if (mec ==0 && queue <2 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - }else { -/* policy: amdgpu owns all queues in the first pipe */ -if (mec ==0 && pipe ==0 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - } +/* policy: amdgpu owns the first two queues of the first MEC */ +if (mec ==0 && queue <2 ) +set_bit (i, adev->gfx.mec.queue_bitmap); }/* update the number of active compute rings */
--
2.5.5
_______________________________________________
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): BN6PR12MB18266449B47EF151EF8A6C6AF2CE0-/b2+HYfkarSCndJ3FSsNdQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Please include patch 1 of this series as well.
From: S, Shirish
Sent: Friday, June 09, 2017 8:53 AM
To: [email protected]; Alex Deucher
Cc: Deucher, Alexander
Subject: Re: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Sure Alex.
I shall update the result on stoney soon.
Regards,
Shirish S
________________________________
From: Alex Deucher <[email protected]<mailto:[email protected]>>
Sent: Friday, June 9, 2017 6:19:30 PM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander; S, Shirish
Subject: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Now that interrupts are properly enabled for all pipes, this should be function properly.
---
Shirish,
Can you test this change on your Stoney setup?
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -9
@@ -125,15 +125,9 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -if (adev->gfx.mec.num_mec >1 ) { -/* policy: amdgpu owns the first two queues of the first MEC */ -if (mec ==0 && queue <2 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - }else { -/* policy: amdgpu owns all queues in the first pipe */ -if (mec ==0 && pipe ==0 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - } +/* policy: amdgpu owns the first two queues of the first MEC */ +if (mec ==0 && queue <2 ) +set_bit (i, adev->gfx.mec.queue_bitmap); }/* update the number of active compute rings */
--
2.5.5
_______________________________________________
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): CY4PR12MB1653373171BC28933F881561F7CE0-rpdhrqHFk06apTa93KjAaQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
OK.
Regards,
Shirish S
________________________________
From: Deucher, Alexander
Sent: Friday, June 9, 2017 6:23:12 PM
To: S, Shirish; [email protected]; Alex Deucher
Subject: RE: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Please include patch 1 of this series as well.
From: S, Shirish
Sent: Friday, June 09, 2017 8:53 AM
To: [email protected]; Alex Deucher
Cc: Deucher, Alexander
Subject: Re: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Sure Alex.
I shall update the result on stoney soon.
Regards,
Shirish S
________________________________
From: Alex Deucher <[email protected]<mailto:[email protected]>>
Sent: Friday, June 9, 2017 6:19:30 PM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander; S, Shirish
Subject: [PATCH 2/2] drm/amdgpu/gfx: spread queues across pipes again for 1 MEC parts
Now that interrupts are properly enabled for all pipes, this should be function properly.
---
Shirish,
Can you test this change on your Stoney setup?
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -9
@@ -125,15 +125,9 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -if (adev->gfx.mec.num_mec >1 ) { -/* policy: amdgpu owns the first two queues of the first MEC */ -if (mec ==0 && queue <2 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - }else { -/* policy: amdgpu owns all queues in the first pipe */ -if (mec ==0 && pipe ==0 ) -set_bit (i, adev->gfx.mec.queue_bitmap); - } +/* policy: amdgpu owns the first two queues of the first MEC */ +if (mec ==0 && queue <2 ) +set_bit (i, adev->gfx.mec.queue_bitmap); }/* update the number of active compute rings */
--
2.5.5
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Acked-byAm 09.06.2017 um 14:49 schrieb Alex Deucher:
Quoted 4 lines
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interrupts for any pipe v3)Signed-off-by Alex Deucher <[email protected]>.
Quoted 215 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59 +++++++++++++++++++++++++---------- 3 files changed, 124 insertions(+), 49 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +40
-17@@ -5015,28 +5015,51 @@ static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is for graphics and Me 2 is reserved for HW scheduling - * So we should only really be configuring ME 1 i.e. MEC0 + u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ - if (me != 1) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41
-16@@ -6610,26 +6610,51 @@ static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +36
-16@@ -3982,26 +3982,53 @@ static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE0_INT_CNTL); +break ; +case 1 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE1_INT_CNTL); +break ; +case 2 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE2_INT_CNTL); +break ; +case 3 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE3_INT_CNTL); +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,0 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, · line 4034
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-0+ mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,1 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v9_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 216 lines · Alex Deucher
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interrupts for any pipe v3)Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59 +++++++++++++++++++++++++---------- 3 files changed, 124 insertions(+), 49 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +40
-17@@ -5015,28 +5015,51 @@ static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is for graphics and Me 2 is reserved for HW scheduling - * So we should only really be configuring ME 1 i.e. MEC0 + u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ - if (me != 1) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41
-16@@ -6610,26 +6610,51 @@ static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +33
-16@@ -3982,26 +3982,53 @@ static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE0_INT_CNTL); +break ; +case 1 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE1_INT_CNTL); +break ; +case 2 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE2_INT_CNTL); +break ; +case 3 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE3_INT_CNTL); +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,0 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, · line 4031
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-0+break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,1 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + }
Could use WREG32_FIELD() here to simplify these.
Cheers,
Tom
_______________________________________________
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): a0862427-6b30-2f3b-1046-fa4d6c0cf35c-5C7GfCeVMHo@public.gmane.org
Quoted 260 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Tom St Denis
Sent: Friday, June 09, 2017 9:19 AM
To: [email protected]
Subject: Re: [PATCH 1/2] drm/amdgpu/gfx: fix MEC interrupt enablement for pipes != 0Quoted 3 lines · Alex Deucher
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interruptsfor any pipe v3)
Quoted 3 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59+++++++++++++++++++++++++----------
Review
Quoted 3 lines
3 files changed, 124 insertions(+), 49 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void
Quoted 4 lines
index e30c7d0..fb0a94c 100644
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0@@ -5015,28 +5015,51 @@ static voidgfx_v7_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void · line 5016
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6
-4{ -/* Me 0 is for graphics and Me 2 is reserved for HW scheduling -* So we should only really be configuring ME 1 i.e. MEC0 +u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ -if (me !=1 ) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-4-return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +20
-3- "me:%d pipe:%d\n", pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void
Quoted 4 lines
index 6e541af..1a75ab1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0@@ -6610,26 +6610,51 @@ static voidgfx_v8_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6611
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +26
-3- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6652
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6660
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void
Quoted 4 lines
index 375620a..e9dd2c1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3982,26 +3982,53 @@ static voidgfx_v9_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3983
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3987
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3992
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3996
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-1- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE0_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3999
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 1 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE1_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4002
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 2 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE2_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4005
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 3 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE3_INT_CNTL);Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-2+break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 0); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, · line 4031
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 1); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + }Could use
WREG32_FIELD()here to simplify these.
That doesn't work if you have variable register names as we do in this case.
Alex
Quoted 7 lines
Cheers,
Tom
_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1653B87B56497B1F48C120DEF7CE0-rpdhrqHFk06apTa93KjAaQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 3 lines · Alexander
Quoted 1 line
Could use
WREG32_FIELD()here to simplify these.That doesn't work if you have variable register names as we do in this case.
Which is why we have WREG32_FIELD_OFFSET :-)
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
I'm a little curious about the failures test cases. Is it related to a specific ASIC?
Using CPC_INT_CNTL seemed to be working well for me on polaris10 (I was getting terrible perf on pipes 1+ without the original patch).
Regards,
Andres
Quoted 220 lines · Alex Deucher
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interrupts for any pipe v3)Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57 +++++++++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59 +++++++++++++++++++++++++---------- 3 files changed, 124 insertions(+), 49 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +40
-17@@ -5015,28 +5015,51 @@ static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is for graphics and Me 2 is reserved for HW scheduling - * So we should only really be configuring ME 1 i.e. MEC0 + u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ - if (me != 1) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41
-16@@ -6610,26 +6610,51 @@ static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &= ~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK ; +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +36
-16@@ -3982,26 +3982,53 @@ static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, int me, int pipe, enum amdgpu_interrupt_state state) { - /* Me 0 is reserved for graphics */ - if (me < 1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts for invalid me:%d\n", me); -return ; - } + u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { -DRM_ERROR ("Ignoring request to enable interrupts for invalid " -"me:%d pipe:%d\n" , pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE0_INT_CNTL); +break ; +case 1 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE1_INT_CNTL); +break ; +case 2 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE2_INT_CNTL); +break ; +case 3 : + mec_int_cntl_reg =SOC15_REG_OFFSET (GC ,0 , mmCP_ME1_PIPE3_INT_CNTL); +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 ); - -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,0 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, · line 4034
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-0+ mec_int_cntl =REG_SET_FIELD (mec_int_cntl,CP_ME1_PIPE0_INT_CNTL , +TIME_STAMP_INT_ENABLE ,1 ); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v9_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
_______________________________________________
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): 47b28e3e-31f6-7ca9-edee-66ba5c6dbe9a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 11 lines
-----Original Message-----
From: Andres Rodriguez [mailto:[email protected]]
Sent: Friday, June 09, 2017 7:49 PM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/2] drm/amdgpu/gfx: fix MEC interrupt enablement for pipes != 0I'm a little curious about the failures test cases. Is it related to a specific ASIC?
Terrible performance on a range of gfx8 parts.
Quoted 3 lines
Using
CPC_INT_CNTLseemed to be working well for me on polaris10 (I was getting terrible perf on pipes 1+ without the original patch).
Weird, not sure. Maybe the indexing works on Polaris.
Alex
Quoted 264 lines
Regards,
AndresQuoted 3 lines · Alex Deucher
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interruptsfor any pipe v3)
Quoted 3 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59+++++++++++++++++++++++++----------
Review
Quoted 3 lines
3 files changed, 124 insertions(+), 49 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void
Quoted 4 lines
index e30c7d0..fb0a94c 100644
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0@@ -5015,28 +5015,51 @@ static voidgfx_v7_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void · line 5016
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6
-4{ -/* Me 0 is for graphics and Me 2 is reserved for HW scheduling -* So we should only really be configuring ME 1 i.e. MEC0 +u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ -if (me !=1 ) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-4-return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +20
-3- "me:%d pipe:%d\n", pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void
Quoted 4 lines
index 6e541af..1a75ab1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0@@ -6610,26 +6610,51 @@ static voidgfx_v8_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6611
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +26
-3- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6652
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6660
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void
Quoted 4 lines
index 375620a..e9dd2c1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3982,26 +3982,53 @@ static voidgfx_v9_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3983
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3987
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3992
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3996
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-1- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE0_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3999
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 1 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE1_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4002
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 2 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE2_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4005
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 3 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE3_INT_CNTL);Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-2+break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 0); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 1); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } }
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4034
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0static int gfx_v9_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Quoted 1 line
_______________________________________________
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): BN6PR12MB1652CA505EE99A9FCEE32C42F7CF0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 9 lines · Alexander
Quoted 9 lines
-----Original Message-----
From: Andres Rodriguez [mailto:[email protected]]
Sent: Friday, June 09, 2017 7:49 PM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/2] drm/amdgpu/gfx: fix MEC interrupt enablement for pipes != 0
Quoted 9 lines
Quoted 2 lines
I'm a little curious about the failures test cases. Is it related to a specific ASIC?
Terrible performance on a range of gfx8 parts. >>
Quoted 2 lines
Using
CPC_INT_CNTLseemed to be working well for me on polaris10 (I was getting terrible perf on pipes 1+ without the original patch).Weird, not sure. Maybe the indexing works on Polaris.
Maybe it only works on some parts and not others?
This is also how current kfd and ROCM enable interrupts:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/radeon/radeon_kfd.c#L441
Might want to keep an eye on that if kfd ends up supporting those ASICs.
Regards,
Andres
Quoted 269 lines
Alex
Quoted 267 lines
Regards,
AndresQuoted 3 lines · Alex Deucher
The interrupt registers are not indexed.
Fixes 763a47b8e (drm/amdgpu: teach amdgpu how to enable interruptsfor any pipe v3)
Quoted 3 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 57+++++++++++++++++++++++----------
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59+++++++++++++++++++++++++----------
Review
Quoted 3 lines
3 files changed, 124 insertions(+), 49 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void
Quoted 4 lines
index e30c7d0..fb0a94c 100644
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0@@ -5015,28 +5015,51 @@ static voidgfx_v7_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void · line 5016
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6
-4{ -/* Me 0 is for graphics and Me 2 is reserved for HW scheduling -* So we should only really be configuring ME 1 i.e. MEC0 +u32 mec_int_cntl, mec_int_cntl_reg; + +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. */ -if (me !=1 ) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-4-return ; - } -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +20
-3- "me:%d pipe:%d\n", pipe, me); +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -cik_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -cik_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void
Quoted 4 lines
index 6e541af..1a75ab1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0@@ -6610,26 +6610,51 @@ static voidgfx_v8_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6611
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +26
-3- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = mmCP_ME1_PIPE0_INT_CNTL; +break ; +case 1 : + mec_int_cntl_reg = mmCP_ME1_PIPE1_INT_CNTL; +break ; +case 2 : + mec_int_cntl_reg = mmCP_ME1_PIPE2_INT_CNTL; +break ; +case 3 : + mec_int_cntl_reg = mmCP_ME1_PIPE3_INT_CNTL; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -vi_srbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -vi_srbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl &=~CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6652
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl |=
CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 6660
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v8_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.cdrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void
Quoted 4 lines
index 375620a..e9dd2c1 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3982,26 +3982,53 @@ static voidgfx_v9_0_set_compute_eop_interrupt_state(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3983
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0int me, int pipe, enum
amdgpu_interrupt_statestate)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3987
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-3{ -/* Me 0 is reserved for graphics */ -if (me <1 || me > adev->gfx.mec.num_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid me:%d\n", me);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3992
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-4-return ; - } +u32 mec_int_cntl, mec_int_cntl_reg; -if (pipe >= adev->gfx.mec.num_pipe_per_mec) { - DRM_ERROR("Ignoring request to enable interrupts forinvalid "
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3996
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-1- "me:%d pipe:%d\n", pipe, me); +/* +* amdgpu controls only the first MEC. That's why this function only +* handles the setting of interrupts for this specific MEC. All other +* pipes' interrupts are set by amdkfd. +*/ + +if (me ==1 ) { +switch (pipe) { +case 0 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE0_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 3999
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 1 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE1_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4002
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 2 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE2_INT_CNTL);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 4005
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+break ; +case 3 : + mec_int_cntl_reg = SOC15_REG_OFFSET(GC, 0,
mmCP_ME1_PIPE3_INT_CNTL);Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-2+break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + }else { +DRM_DEBUG ("invalid me %d\n" , me);return ; } -mutex_lock (&adev->srbm_mutex); -soc15_grbm_select (adev, me, pipe,0 ,0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-6- -WREG32_FIELD (CPC_INT_CNTL ,TIME_STAMP_INT_ENABLE , - state ==AMDGPU_IRQ_STATE_DISABLE ?0 :1 ); - -soc15_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 0); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +case AMDGPU_IRQ_STATE_ENABLE : + mec_int_cntl =RREG32 (mec_int_cntl_reg); + mec_int_cntl = REG_SET_FIELD(mec_int_cntl,
CP_ME1_PIPE0_INT_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-0+ TIME_STAMP_INT_ENABLE, 1); +WREG32 (mec_int_cntl_reg, mec_int_cntl); +break ; +default : +break ; + } } static int gfx_v9_0_set_priv_reg_fault_state(struct amdgpu_device*adev,
Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx