dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: dri-devel@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>, Steven Price <steven.price@arm.com>,
	David Airlie <airlied@linux.ie>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v3 6/8] drm/panfrost: Convert MMU IRQ handler to threaded handler
Date: Fri,  2 Aug 2019 13:51:48 -0600	[thread overview]
Message-ID: <20190802195150.23207-7-robh@kernel.org> (raw)
In-Reply-To: <20190802195150.23207-1-robh@kernel.org>

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 <tomeu.vizoso@collabora.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Steven Price <steven.price@arm.com>
Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/gpu/drm/panfrost/panfrost_mmu.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index eba6ce785ef0..7d44328b280f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -300,12 +300,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++) {
@@ -350,6 +358,7 @@ static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data)
 		status &= ~mask;
 	}
 
+	mmu_write(pfdev, MMU_INT_MASK, ~0);
 	return IRQ_HANDLED;
 };
 
@@ -368,8 +377,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");
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-08-02 19:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 19:51 [PATCH v3 0/8] drm/panfrost: Add heap and no execute buffer allocation Rob Herring
2019-08-02 19:51 ` [PATCH v3 1/8] drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages Rob Herring
2019-08-02 19:51 ` [PATCH v3 2/8] drm/shmem: Put pages independent of a SG table being set Rob Herring
2019-08-02 19:51 ` [PATCH v3 3/8] drm/panfrost: Restructure the GEM object creation Rob Herring
2019-08-02 19:51 ` [PATCH v3 4/8] drm/panfrost: Split panfrost_mmu_map SG list mapping to its own function Rob Herring
2019-08-08 12:57   ` Steven Price
2019-08-02 19:51 ` [PATCH v3 5/8] drm/panfrost: Add a no execute flag for BO allocations Rob Herring
2019-08-02 19:51 ` Rob Herring [this message]
2019-08-02 22:28   ` [PATCH v3 6/8] drm/panfrost: Convert MMU IRQ handler to threaded handler Alyssa Rosenzweig
2019-08-08 12:57   ` Steven Price
2019-08-02 19:51 ` [PATCH v3 7/8] drm/panfrost: Add support for GPU heap allocations Rob Herring
2019-08-08 13:37   ` Steven Price
2019-08-02 19:51 ` [PATCH v3 8/8] drm/panfrost: Bump driver version to 1.1 Rob Herring
2019-08-05 16:09 ` [PATCH v3 0/8] drm/panfrost: Add heap and no execute buffer allocation Tomeu Vizoso
2019-08-05 21:10   ` Rob Herring
2019-08-06  5:23     ` Tomeu Vizoso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190802195150.23207-7-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=robin.murphy@arm.com \
    --cc=sean@poorly.run \
    --cc=steven.price@arm.com \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).