Skip to content

Commit fc237ec

Browse files
larunbestevenprice-arm
authored andcommitted
drm/panfrost: Don't rework job IRQ enable mask in the enable path
Up until now, panfrost_job_enable_interrupts() would always recalculate the same job IRQ enablement mask, which is effectively a constant. Replace it with a compile-time constant value, and also in another couple places where an equivalent expression was being used. Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> Link: https://lore.kernel.org/r/20251019145225.3621989-8-adrian.larumbe@collabora.com Signed-off-by: Steven Price <steven.price@arm.com>
1 parent 4da352c commit fc237ec

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

drivers/gpu/drm/panfrost/panfrost_device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ struct panfrost_perfcnt;
2626

2727
#define MAX_PM_DOMAINS 5
2828

29+
#define ALL_JS_INT_MASK \
30+
(GENMASK(16 + NUM_JOB_SLOTS - 1, 16) | \
31+
GENMASK(NUM_JOB_SLOTS - 1, 0))
32+
2933
enum panfrost_drv_comp_bits {
3034
PANFROST_COMP_BIT_GPU,
3135
PANFROST_COMP_BIT_JOB,

drivers/gpu/drm/panfrost/panfrost_job.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -432,17 +432,10 @@ static struct dma_fence *panfrost_job_run(struct drm_sched_job *sched_job)
432432

433433
void panfrost_job_enable_interrupts(struct panfrost_device *pfdev)
434434
{
435-
int j;
436-
u32 irq_mask = 0;
437-
438435
clear_bit(PANFROST_COMP_BIT_JOB, pfdev->is_suspended);
439436

440-
for (j = 0; j < NUM_JOB_SLOTS; j++) {
441-
irq_mask |= MK_JS_MASK(j);
442-
}
443-
444-
job_write(pfdev, JOB_INT_CLEAR, irq_mask);
445-
job_write(pfdev, JOB_INT_MASK, irq_mask);
437+
job_write(pfdev, JOB_INT_CLEAR, ALL_JS_INT_MASK);
438+
job_write(pfdev, JOB_INT_MASK, ALL_JS_INT_MASK);
446439
}
447440

448441
void panfrost_job_suspend_irq(struct panfrost_device *pfdev)
@@ -761,9 +754,7 @@ panfrost_reset(struct panfrost_device *pfdev,
761754
drm_sched_start(&pfdev->js->queue[i].sched, 0);
762755

763756
/* Re-enable job interrupts now that everything has been restarted. */
764-
job_write(pfdev, JOB_INT_MASK,
765-
GENMASK(16 + NUM_JOB_SLOTS - 1, 16) |
766-
GENMASK(NUM_JOB_SLOTS - 1, 0));
757+
job_write(pfdev, JOB_INT_MASK, ALL_JS_INT_MASK);
767758

768759
dma_fence_end_signalling(cookie);
769760
}
@@ -836,9 +827,7 @@ static irqreturn_t panfrost_job_irq_handler_thread(int irq, void *data)
836827

837828
/* Enable interrupts only if we're not about to get suspended */
838829
if (!test_bit(PANFROST_COMP_BIT_JOB, pfdev->is_suspended))
839-
job_write(pfdev, JOB_INT_MASK,
840-
GENMASK(16 + NUM_JOB_SLOTS - 1, 16) |
841-
GENMASK(NUM_JOB_SLOTS - 1, 0));
830+
job_write(pfdev, JOB_INT_MASK, ALL_JS_INT_MASK);
842831

843832
return IRQ_HANDLED;
844833
}

0 commit comments

Comments
 (0)