Skip to content

Commit

Permalink
drm/panfrost: Convert MMU IRQ handler to threaded handler
Browse files Browse the repository at this point in the history
In preparation to handle mapping of page faults, we need the MMU handler
to be threaded as code paths take a mutex.

As the IRQ may be shared, we can't use the default handler and must
disable the MMU interrupts locally.

Cc: Tomeu Vizoso <[email protected]>
Cc: Boris Brezillon <[email protected]>
Cc: Robin Murphy <[email protected]>
Reviewed-by: Steven Price <[email protected]>
Acked-by: Alyssa Rosenzweig <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
robherring committed Aug 12, 2019
1 parent 73e467f commit b31bdd1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions drivers/gpu/drm/panfrost/panfrost_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,20 @@ static const char *access_type_name(struct panfrost_device *pfdev,
static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data)
{
struct panfrost_device *pfdev = data;
u32 status = mmu_read(pfdev, MMU_INT_STAT);
int i;

if (!status)
if (!mmu_read(pfdev, MMU_INT_STAT))
return IRQ_NONE;

mmu_write(pfdev, MMU_INT_MASK, 0);
return IRQ_WAKE_THREAD;
}

static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
{
struct panfrost_device *pfdev = data;
u32 status = mmu_read(pfdev, MMU_INT_RAWSTAT);
int i;

dev_err(pfdev->dev, "mmu irq status=%x\n", status);

for (i = 0; status; i++) {
Expand Down Expand Up @@ -355,6 +363,7 @@ static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data)
status &= ~mask;
}

mmu_write(pfdev, MMU_INT_MASK, ~0);
return IRQ_HANDLED;
};

Expand All @@ -373,8 +382,9 @@ int panfrost_mmu_init(struct panfrost_device *pfdev)
if (irq <= 0)
return -ENODEV;

err = devm_request_irq(pfdev->dev, irq, panfrost_mmu_irq_handler,
IRQF_SHARED, "mmu", pfdev);
err = devm_request_threaded_irq(pfdev->dev, irq, panfrost_mmu_irq_handler,
panfrost_mmu_irq_handler_thread,
IRQF_SHARED, "mmu", pfdev);

if (err) {
dev_err(pfdev->dev, "failed to request mmu irq");
Expand Down

0 comments on commit b31bdd1

Please sign in to comment.