Skip to content

Commit

Permalink
drm/amdgpu/sdma7: properly reference trap interrupts for userqs
Browse files Browse the repository at this point in the history
We need to take a reference to the interrupts to make
sure they stay enabled even if the kernel queues have
disabled them.

Reviewed-by: Sunil Khatri <sunil.khatri@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Apr 21, 2025
1 parent 1197cfb commit 0ed032d
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
Original file line number Diff line number Diff line change
@@ -1353,11 +1353,39 @@ static int sdma_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
return 0;
}

static int sdma_v7_0_set_userq_trap_interrupts(struct amdgpu_device *adev,
bool enable)
{
unsigned int irq_type;
int i, r;

if (adev->userq_funcs[AMDGPU_HW_IP_DMA]) {
for (i = 0; i < adev->sdma.num_instances; i++) {
irq_type = AMDGPU_SDMA_IRQ_INSTANCE0 + i;
if (enable)
r = amdgpu_irq_get(adev, &adev->sdma.trap_irq,
irq_type);
else
r = amdgpu_irq_put(adev, &adev->sdma.trap_irq,
irq_type);
if (r)
return r;
}
}

return 0;
}

static int sdma_v7_0_hw_init(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
int r;

return sdma_v7_0_start(adev);
r = sdma_v7_0_start(adev);
if (r)
return r;

return sdma_v7_0_set_userq_trap_interrupts(adev, true);
}

static int sdma_v7_0_hw_fini(struct amdgpu_ip_block *ip_block)
@@ -1369,6 +1397,7 @@ static int sdma_v7_0_hw_fini(struct amdgpu_ip_block *ip_block)

sdma_v7_0_ctx_switch_enable(adev, false);
sdma_v7_0_enable(adev, false);
sdma_v7_0_set_userq_trap_interrupts(adev, false);

return 0;
}

0 comments on commit 0ed032d

Please sign in to comment.