drm/amdgpu: enable IH ring 1 and ring 2 v3
Subsystems (2)
PATCH 1/3 drm/amdgpu: enable IH ring 1 and ring 2 v3
The entries are ignored for now, but it at least stops crashing the hardware when somebody tries to push something to the other IH rings.
v2: limit ring size, add TODO comment
v3: only program rings if they are actually allocated
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 4 +- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 143 ++++++++++++++++++++---- 2 files changed, 121 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +2 -2
@@ -87,8 +87,8 @@ struct amdgpu_irq {/* status, etc. */ bool msi_enabled;/* msi enabled */ -/* interrupt ring */ -struct amdgpu_ih_ring ih; +/* interrupt rings */ +struct amdgpu_ih_ring ih, ih1, ih2;const struct amdgpu_ih_funcs *ih_funcs;/* gen irq stuff */
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +119 -24
196 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ 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): 20190109131246.1274-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amdgpu: add support for processing IH ring 1 & 2
Previously we only added the ring buffer memory, now add the handling as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 33 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 4 ++- 2 files changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +33 -0
@@ -176,6 +176,36 @@ irqreturn_t amdgpu_irq_handler(int irq, void *arg)return ret; } +/** +* amdgpu_irq_handle_ih1 - kick of processing for IH1 +* +* @work: work structure in struct amdgpu_irq +* +* Kick of processing IH ring 1. +*/ +static void amdgpu_irq_handle_ih1 (struct work_struct *work) +{ + struct amdgpu_device *adev = container_of(work, struct amdgpu_device, + irq.ih1_work); + +amdgpu_ih_process (adev, &adev->irq.ih1, amdgpu_irq_callback); +} + +/** +* amdgpu_irq_handle_ih2 - kick of processing for IH2 +* +* @work: work structure in struct amdgpu_irq +* +* Kick of processing IH ring 2. +*/ +static void amdgpu_irq_handle_ih2 (struct work_struct *work) +{ + struct amdgpu_device *adev = container_of(work, struct amdgpu_device, + irq.ih2_work); + +amdgpu_ih_process (adev, &adev->irq.ih2, amdgpu_irq_callback); +} +/** * amdgpu_msi_ok - check whether MSI functionality is enabled *
@@ -240,6 +270,9 @@ int amdgpu_irq_init(struct amdgpu_device *adev) amdgpu_hotplug_work_func); } +INIT_WORK (&adev->irq.ih1_work, amdgpu_irq_handle_ih1); +INIT_WORK (&adev->irq.ih2_work, amdgpu_irq_handle_ih2); + adev->irq.installed = true; r =drm_irq_install (adev->ddev, adev->ddev->pdev->irq);if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +3 -1
@@ -89,7 +89,9 @@ struct amdgpu_irq {/* interrupt rings */ struct amdgpu_ih_ring ih, ih1, ih2; -const struct amdgpu_ih_funcs *ih_funcs; +const struct amdgpu_ih_funcs *ih_funcs; +struct work_struct ih1_work, ih2_work; +struct amdgpu_irq_src self_irq;/* gen irq stuff */ struct irq_domain *domain;/* GPU irq controller domain */
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: add support for self irq on Vega10 v2
In reply to a message not in the archiveThis finally enables processing of ring 1 & 2.
v2: fix copy&paste error
--- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 80 ++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +74 -6
@@ -272,7 +272,7 @@ static void vega10_ih_irq_disable(struct amdgpu_device *adev)static u32 vega10_ih_get_wptr (struct amdgpu_device *adev,struct amdgpu_ih_ring *ih) { -u32 wptr, tmp; +u32 wptr, reg, tmp; wptr =le32_to_cpu (*ih->wptr_cpu);
@@ -280,7 +280,17 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev, goto out;/* Double check that the overflow wasn't already cleared. */ - wptr =RREG32_NO_KIQ (SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_WPTR)); + +if (ih == &adev->irq.ih) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_WPTR); +else if (ih == &adev->irq.ih1) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_WPTR_RING1); +else if (ih == &adev->irq.ih2) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_WPTR_RING2); +else +BUG (); + + wptr =RREG32_NO_KIQ (reg);if (!REG_GET_FIELD (wptr,IH_RB_WPTR ,RB_OVERFLOW )) goto out;
@@ -296,9 +306,18 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev, wptr, ih->rptr, tmp); ih->rptr = tmp; - tmp =RREG32_NO_KIQ (SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_CNTL)); +if (ih == &adev->irq.ih) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_CNTL); +else if (ih == &adev->irq.ih1) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_CNTL_RING1); +else if (ih == &adev->irq.ih2) + reg =SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_CNTL_RING2); +else +BUG (); + + tmp =RREG32_NO_KIQ (reg); tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); -WREG32_NO_KIQ (SOC15_REG_OFFSET (OSSSYS ,0 , mmIH_RB_CNTL), tmp); +WREG32_NO_KIQ (reg, tmp); out:return (wptr & ih->ptr_mask);
@@ -361,9 +380,52 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,/* XXX check if swapping is necessary on BE */ *ih->rptr_cpu = ih->rptr;WDOORBELL32 (ih->doorbell_index, ih->rptr); - }else { + }else if (ih == &adev->irq.ih) {WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR, ih->rptr); + }else if (ih == &adev->irq.ih1) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1, ih->rptr); + }else if (ih == &adev->irq.ih2) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2, ih->rptr); + } +} + +/** +* vega10_ih_self_irq - dispatch work for ring 1 and 2 +* +* @adev: amdgpu_device pointer +* @source: irq source +* @entry: IV with WPTR update +* +* Update the WPTR from the IV and schedule work to handle the entries. +*/ +static int vega10_ih_self_irq (struct amdgpu_device *adev, +struct amdgpu_irq_src *source, +struct amdgpu_iv_entry *entry) +{ +uint32_t wptr =cpu_to_le32 (entry->src_data[0 ]); + +switch (entry->ring_id) { +case 1 : + *adev->irq.ih1.wptr_cpu = wptr; +schedule_work (&adev->irq.ih1_work); +break ; +case 2 : + *adev->irq.ih2.wptr_cpu = wptr; +schedule_work (&adev->irq.ih2_work); +break ; +default :break ; } +return 0 ; +} + +static const struct amdgpu_irq_src_funcs vega10_ih_self_irq_funcs = { + .process = vega10_ih_self_irq, +}; + +static void vega10_ih_set_self_irq_funcs (struct amdgpu_device *adev) +{ + adev->irq.self_irq.num_types =0 ; + adev->irq.self_irq.funcs = &vega10_ih_self_irq_funcs; }static int vega10_ih_early_init (void *handle)
@@ -371,13 +433,19 @@ static int vega10_ih_early_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;vega10_ih_set_interrupt_funcs (adev); +vega10_ih_set_self_irq_funcs (adev);return 0 ; }static int vega10_ih_sw_init (void *handle) { -int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int r; + + r =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_IH ,0 , + &adev->irq.self_irq); +if (r) +return r; r =amdgpu_ih_ring_init (adev, &adev->irq.ih,256 *1024 , true);if (r)
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 09.01.19 um 14:12 schrieb Christian König:
Quoted 7 lines
The entries are ignored for now, but it at least stops crashing the hardware when somebody tries to push something to the other IH rings.
v2: limit ring size, add TODO comment
v3: only program rings if they are actually allocatedSigned-off-by Christian König <[email protected]>
Ping Alex & Felix any more comments on this series?
Christian.
Quoted 219 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 4 +- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 143 ++++++++++++++++++++---- 2 files changed, 121 insertions(+), 26 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +2
-2@@ -87,8 +87,8 @@ struct amdgpu_irq {/* status, etc. */ bool msi_enabled;/* msi enabled */ -/* interrupt ring */ -struct amdgpu_ih_ring ih; +/* interrupt rings */ +struct amdgpu_ih_ring ih, ih1, ih2;const struct amdgpu_ih_funcs *ih_funcs;/* gen irq stuff */ drivers/gpu/drm/amd/amdgpu/vega10_ih.c +117
-24@@ -50,6 +50,22 @@ static void vega10_ih_enable_interrupts(struct amdgpu_device *adev) ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,ENABLE_INTR ,1 );WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl); adev->irq.ih.enabled = true; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + adev->irq.ih1.enabled = true; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + adev->irq.ih2.enabled = true; + } }/** @@ -71,6 +87,53 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR,0 ); adev->irq.ih.enabled = false; adev->irq.ih.rptr =0 ; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + adev->irq.ih1.enabled = false; + adev->irq.ih1.rptr =0 ; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + adev->irq.ih2.enabled = false; + adev->irq.ih2.rptr =0 ; + } +} + +static uint32_t vega10_ih_rb_cntl (struct amdgpu_ih_ring *ih,uint32_t ih_rb_cntl) +{ +int rb_bufsz =order_base_2 (ih->ring_size /4 ); + + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +MC_SPACE , ih->use_bus_addr ?1 :4 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_CLEAR ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); +/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register +* value is written to memory +*/ + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_WRITEBACK_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); + +return ih_rb_cntl; }/** @@ -86,9 +149,8 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)*/ static int vega10_ih_irq_init (struct amdgpu_device *adev) { -struct amdgpu_ih_ring *ih = &adev->irq.ih; +struct amdgpu_ih_ring *ih;int ret =0 ; -int rb_bufsz;u32 ih_rb_cntl, ih_doorbell_rtpr;u32 tmp;@@ -97,26 +159,15 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) adev->nbio_funcs->ih_control (adev); - ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih = &adev->irq.ih;/* Ring Buffer base. [39:8] of 40-bit address of the beginning of the ring buffer*/ -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, adev->irq.ih.gpu_addr >>8 ); -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, - (adev->irq.ih.gpu_addr >>40 ) &0xff ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SPACE , - ih->use_bus_addr ?1 :4 ); - rb_bufsz =order_base_2 (adev->irq.ih.ring_size /4 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); -/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register value is written to memory */ - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_WRITEBACK_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); - -if (adev->irq.msi_enabled) - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, (ih->gpu_addr >>40 ) &0xff ); + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM , + !!adev->irq.msi_enabled);WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl);/* set the writeback address whether it's enabled or not */ @@ -131,18 +182,51 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) ih_doorbell_rtpr =RREG32_SOC15 (OSSSYS ,0 , mmIH_DOORBELL_RPTR);if (adev->irq.ih.use_doorbell) { - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , -OFFSET , adev->irq.ih.doorbell_index); - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,OFFSET , + adev->irq.ih.doorbell_index); + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,1 ); }else { - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,0 ); }WREG32_SOC15 (OSSSYS ,0 , mmIH_DOORBELL_RPTR, ih_doorbell_rtpr); adev->nbio_funcs->ih_doorbell_range (adev, adev->irq.ih.use_doorbell, adev->irq.ih.doorbell_index); + ih = &adev->irq.ih1; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING1, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING1, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + } + + ih = &adev->irq.ih2; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING2, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING2, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + } + tmp =RREG32_SOC15 (OSSSYS ,0 , mmIH_STORM_CLIENT_LIST_CNTL); tmp =REG_SET_FIELD (tmp,IH_STORM_CLIENT_LIST_CNTL ,CLIENT18_IS_STORM_CLIENT ,1 );@@ -299,6 +383,15 @@ static int vega10_ih_sw_init(void *handle)if (r)return r; + r =amdgpu_ih_ring_init (adev, &adev->irq.ih1,PAGE_SIZE , true); +if (r) +return r; + + r =amdgpu_ih_ring_init (adev, &adev->irq.ih2,PAGE_SIZE , true); +if (r) +return r; + +/* TODO add doorbell for IH1 & IH2 as well */ adev->irq.ih.use_doorbell = true; adev->irq.ih.doorbell_index = adev->doorbell_index.ih <<1 ;
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static int vega10_ih_sw_fini(void *handle) · line 412
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +2
-0@@ -312,6 +405,8 @@ static int vega10_ih_sw_fini(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;amdgpu_irq_fini (adev); +amdgpu_ih_ring_fini (adev, &adev->irq.ih2); +amdgpu_ih_ring_fini (adev, &adev->irq.ih1);amdgpu_ih_ring_fini (adev, &adev->irq.ih);return 0 ;
_______________________________________________
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): 59e5acca-73f8-dd94-ad4a-f6798c7551c6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
The series is Reviewed-by: Felix Kuehling <[email protected]>
-----Original Message-----
From: Christian König <[email protected]>
Sent: Friday, January 11, 2019 7:02 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH 1/3] drm/amdgpu: enable IH ring 1 and ring 2 v3
Am 09.01.19 um 14:12 schrieb Christian König:
Quoted 7 lines
The entries are ignored for now, but it at least stops crashing the hardware when somebody tries to push something to the other IH rings.
v2: limit ring size, add TODO comment
v3: only program rings if they are actually allocatedSigned-off-by Christian König <[email protected]>
Ping Alex & Felix any more comments on this series?
Christian.
Quoted 224 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 4 +- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 143 ++++++++++++++++++++---- 2 files changed, 121 insertions(+), 26 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +2
-2@@ -87,8 +87,8 @@ struct amdgpu_irq {/* status, etc. */ bool msi_enabled;/* msi enabled */ -/* interrupt ring */ -struct amdgpu_ih_ring ih; +/* interrupt rings */ +struct amdgpu_ih_ring ih, ih1, ih2;const struct amdgpu_ih_funcs *ih_funcs;/* gen irq stuff */ drivers/gpu/drm/amd/amdgpu/vega10_ih.c +72
-21@@ -50,6 +50,22 @@ static void vega10_ih_enable_interrupts(struct amdgpu_device *adev) ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,ENABLE_INTR ,1 );WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl); adev->irq.ih.enabled = true; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + adev->irq.ih1.enabled = true; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + adev->irq.ih2.enabled = true; + } }/** @@ -71,6 +87,53 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR,0 ); adev->irq.ih.enabled = false; adev->irq.ih.rptr =0 ; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + adev->irq.ih1.enabled = false; + adev->irq.ih1.rptr =0 ; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + adev->irq.ih2.enabled = false; + adev->irq.ih2.rptr =0 ; + } +} + +static uint32_t vega10_ih_rb_cntl (struct amdgpu_ih_ring *ih,uint32_t +ih_rb_cntl) { +int rb_bufsz =order_base_2 (ih->ring_size /4 ); + + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +MC_SPACE , ih->use_bus_addr ?1 :4 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_CLEAR ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); +/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register +* value is written to memory +*/ + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_WRITEBACK_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); + +return ih_rb_cntl; }/** @@ -86,9 +149,8 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)*/ static int vega10_ih_irq_init (struct amdgpu_device *adev) { -struct amdgpu_ih_ring *ih = &adev->irq.ih; +struct amdgpu_ih_ring *ih;int ret =0 ; -int rb_bufsz;u32 ih_rb_cntl, ih_doorbell_rtpr;u32 tmp;@@ -97,26 +159,15 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) adev->nbio_funcs->ih_control(adev); - ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih = &adev->irq.ih;/* Ring Buffer base. [39:8] of 40-bit address of the beginning of the ring buffer*/ -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, adev->irq.ih.gpu_addr >>8 ); -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, - (adev->irq.ih.gpu_addr >>40 ) &0xff ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SPACE , - ih->use_bus_addr ?1 :4 ); - rb_bufsz =order_base_2 (adev->irq.ih.ring_size /4 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); -/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register value is written to memory */ - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_WRITEBACK_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); - -if (adev->irq.msi_enabled) - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, (ih->gpu_addr >>40 ) & +0xff ); + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM , + !!adev->irq.msi_enabled);WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl); /* set the writeback address whether it's enabled or not */ @@ -131,18 +182,51 @@ static int vega10_ih_irq_init(struct amdgpu_device*adev)
ih_doorbell_rtpr = RREG32_SOC15(OSSSYS, 0, mmIH_DOORBELL_RPTR); if (adev->irq.ih.use_doorbell) {drivers/gpu/drm/amd/amdgpu/vega10_ih.c +37
-4- ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , -OFFSET , adev->irq.ih.doorbell_index); - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,OFFSET , + adev->irq.ih.doorbell_index); + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,1 ); }else { - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,0 ); }WREG32_SOC15 (OSSSYS ,0 , mmIH_DOORBELL_RPTR, ih_doorbell_rtpr); adev->nbio_funcs->ih_doorbell_range (adev, adev->irq.ih.use_doorbell, adev->irq.ih.doorbell_index); + ih = &adev->irq.ih1; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING1, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING1, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + } + + ih = &adev->irq.ih2; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING2, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING2, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + } + tmp =RREG32_SOC15 (OSSSYS ,0 , mmIH_STORM_CLIENT_LIST_CNTL); tmp =REG_SET_FIELD (tmp,IH_STORM_CLIENT_LIST_CNTL , CLIENT18_IS_STORM_CLIENT, 1); @@ -299,6 +383,15 @@ static int
vega10_ih_sw_init(void *handle)
if (r)
return r;drivers/gpu/drm/amd/amdgpu/vega10_ih.c +9
-0+ r =amdgpu_ih_ring_init (adev, &adev->irq.ih1,PAGE_SIZE , true); +if (r) +return r; + + r =amdgpu_ih_ring_init (adev, &adev->irq.ih2,PAGE_SIZE , true); +if (r) +return r; + +/* TODO add doorbell for IH1 & IH2 as well */ adev->irq.ih.use_doorbell = true; adev->irq.ih.doorbell_index = adev->doorbell_index.ih <<1 ;
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static int vega10_ih_sw_fini(void *handle) · line 412
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +2
-0@@ -312,6 +405,8 @@ static int vega10_ih_sw_fini(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;amdgpu_irq_fini (adev); +amdgpu_ih_ring_fini (adev, &adev->irq.ih2); +amdgpu_ih_ring_fini (adev, &adev->irq.ih1);amdgpu_ih_ring_fini (adev, &adev->irq.ih);return 0 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Reviewed-byQuoted 211 lines · Christian König
The entries are ignored for now, but it at least stops crashing the hardware when somebody tries to push something to the other IH rings.
v2: limit ring size, add TODO comment
v3: only program rings if they are actually allocatedSigned-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 4 +- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 143 ++++++++++++++++++++---- 2 files changed, 121 insertions(+), 26 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +2
-2@@ -87,8 +87,8 @@ struct amdgpu_irq {/* status, etc. */ bool msi_enabled;/* msi enabled */ -/* interrupt ring */ -struct amdgpu_ih_ring ih; +/* interrupt rings */ +struct amdgpu_ih_ring ih, ih1, ih2;const struct amdgpu_ih_funcs *ih_funcs;/* gen irq stuff */ drivers/gpu/drm/amd/amdgpu/vega10_ih.c +108
-24@@ -50,6 +50,22 @@ static void vega10_ih_enable_interrupts(struct amdgpu_device *adev) ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,ENABLE_INTR ,1 );WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl); adev->irq.ih.enabled = true; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + adev->irq.ih1.enabled = true; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + adev->irq.ih2.enabled = true; + } }/** @@ -71,6 +87,53 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR,0 ); adev->irq.ih.enabled = false; adev->irq.ih.rptr =0 ; + +if (adev->irq.ih1.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING1 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + adev->irq.ih1.enabled = false; + adev->irq.ih1.rptr =0 ; + } + +if (adev->irq.ih2.ring_size) { + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL_RING2 , +RB_ENABLE ,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + adev->irq.ih2.enabled = false; + adev->irq.ih2.rptr =0 ; + } +} + +static uint32_t vega10_ih_rb_cntl (struct amdgpu_ih_ring *ih,uint32_t ih_rb_cntl) +{ +int rb_bufsz =order_base_2 (ih->ring_size /4 ); + + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +MC_SPACE , ih->use_bus_addr ?1 :4 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_CLEAR ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_OVERFLOW_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); +/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register +* value is written to memory +*/ + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL , +WPTR_WRITEBACK_ENABLE ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); + +return ih_rb_cntl; }/** @@ -86,9 +149,8 @@ static void vega10_ih_disable_interrupts(struct amdgpu_device *adev)*/ static int vega10_ih_irq_init (struct amdgpu_device *adev) { -struct amdgpu_ih_ring *ih = &adev->irq.ih; +struct amdgpu_ih_ring *ih;int ret =0 ; -int rb_bufsz;u32 ih_rb_cntl, ih_doorbell_rtpr;u32 tmp;@@ -97,26 +159,15 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) adev->nbio_funcs->ih_control (adev); - ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih = &adev->irq.ih;/* Ring Buffer base. [39:8] of 40-bit address of the beginning of the ring buffer*/ -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, adev->irq.ih.gpu_addr >>8 ); -WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, - (adev->irq.ih.gpu_addr >>40 ) &0xff ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SPACE , - ih->use_bus_addr ?1 :4 ); - rb_bufsz =order_base_2 (adev->irq.ih.ring_size /4 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_OVERFLOW_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RB_SIZE , rb_bufsz); -/* Ring Buffer write pointer writeback. If enabled, IH_RB_WPTR register value is written to memory */ - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,WPTR_WRITEBACK_ENABLE ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_SNOOP ,1 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_RO ,0 ); - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,MC_VMID ,0 ); - -if (adev->irq.msi_enabled) - ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM ,1 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI, (ih->gpu_addr >>40 ) &0xff ); + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); + ih_rb_cntl =REG_SET_FIELD (ih_rb_cntl,IH_RB_CNTL ,RPTR_REARM , + !!adev->irq.msi_enabled);WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL, ih_rb_cntl);/* set the writeback address whether it's enabled or not */ @@ -131,18 +182,51 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) ih_doorbell_rtpr =RREG32_SOC15 (OSSSYS ,0 , mmIH_DOORBELL_RPTR);if (adev->irq.ih.use_doorbell) { - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , -OFFSET , adev->irq.ih.doorbell_index); - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,OFFSET , + adev->irq.ih.doorbell_index); + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,1 ); }else { - ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr,IH_DOORBELL_RPTR , + ih_doorbell_rtpr =REG_SET_FIELD (ih_doorbell_rtpr, +IH_DOORBELL_RPTR ,ENABLE ,0 ); }WREG32_SOC15 (OSSSYS ,0 , mmIH_DOORBELL_RPTR, ih_doorbell_rtpr); adev->nbio_funcs->ih_doorbell_range (adev, adev->irq.ih.use_doorbell, adev->irq.ih.doorbell_index); + ih = &adev->irq.ih1; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING1, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING1, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING1,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING1,0 ); + } + + ih = &adev->irq.ih2; +if (ih->ring_size) { +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_RING2, ih->gpu_addr >>8 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_BASE_HI_RING2, + (ih->gpu_addr >>40 ) &0xff ); + + ih_rb_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING1); + ih_rb_cntl =vega10_ih_rb_cntl (ih, ih_rb_cntl); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_CNTL_RING2, ih_rb_cntl); + +/* set rptr, wptr to 0 */ +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_RPTR_RING2,0 ); +WREG32_SOC15 (OSSSYS ,0 , mmIH_RB_WPTR_RING2,0 ); + } + tmp =RREG32_SOC15 (OSSSYS ,0 , mmIH_STORM_CLIENT_LIST_CNTL); tmp =REG_SET_FIELD (tmp,IH_STORM_CLIENT_LIST_CNTL ,CLIENT18_IS_STORM_CLIENT ,1 );
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static int vega10_ih_sw_init(void *handle) · line 392
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +7
-0@@ -299,6 +383,15 @@ static int vega10_ih_sw_init(void *handle)if (r)return r; + r =amdgpu_ih_ring_init (adev, &adev->irq.ih1,PAGE_SIZE , true); +if (r) +return r; + + r =amdgpu_ih_ring_init (adev, &adev->irq.ih2,PAGE_SIZE , true); +if (r) +return r;
We may want to limit this to vega10 for now until we've tested other soc15 asics more thoroughly with the changes. Maybe add a has_secondary_ih_rings flag like we did for the paging queue on SDMA. Then we can set it early_init on a per-asic basis. With that fixed the series is:
Alex
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +4
-1+ +/* TODO add doorbell for IH1 & IH2 as well */ adev->irq.ih.use_doorbell = true; adev->irq.ih.doorbell_index = adev->doorbell_index.ih <<1 ;@@ -312,6 +405,8 @@ static int vega10_ih_sw_fini(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;amdgpu_irq_fini (adev); +amdgpu_ih_ring_fini (adev, &adev->irq.ih2); +amdgpu_ih_ring_fini (adev, &adev->irq.ih1);amdgpu_ih_ring_fini (adev, &adev->irq.ih);return 0 ; --2.17.1
Quoted 4 lines
_______________________________________________
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