All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: dri-devel@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	David Airlie <airlied@linux.ie>,
	Steven Price <steven.price@arm.com>,
	Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v3 5/8] drm/panfrost: Split mmu_hw_do_operation into locked and unlocked version
Date: Mon, 26 Aug 2019 17:33:14 -0500	[thread overview]
Message-ID: <20190826223317.28509-6-robh@kernel.org> (raw)
In-Reply-To: <20190826223317.28509-1-robh@kernel.org>

In preparation to call mmu_hw_do_operation with the as_lock already held,
Add a mmu_hw_do_operation_locked function.

Fixes: 7282f7645d06 ("drm/panfrost: Implement per FD address spaces")
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Steven Price <steven.price@arm.com>
Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Rob Herring <robh@kernel.org>
---
v3:
 - new patch

 drivers/gpu/drm/panfrost/panfrost_mmu.c | 26 ++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 2204e60f7808..3407b00d0a3a 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -80,19 +80,11 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr,
 }


-static int mmu_hw_do_operation(struct panfrost_device *pfdev,
-			       struct panfrost_mmu *mmu,
-			       u64 iova, size_t size, u32 op)
+static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr,
+				      u64 iova, size_t size, u32 op)
 {
-	int ret, as_nr;
-
-	spin_lock(&pfdev->as_lock);
-	as_nr = mmu->as;
-
-	if (as_nr < 0) {
-		spin_unlock(&pfdev->as_lock);
+	if (as_nr < 0)
 		return 0;
-	}

 	if (op != AS_COMMAND_UNLOCK)
 		lock_region(pfdev, as_nr, iova, size);
@@ -101,10 +93,18 @@ static int mmu_hw_do_operation(struct panfrost_device *pfdev,
 	write_cmd(pfdev, as_nr, op);

 	/* Wait for the flush to complete */
-	ret = wait_ready(pfdev, as_nr);
+	return wait_ready(pfdev, as_nr);
+}

-	spin_unlock(&pfdev->as_lock);
+static int mmu_hw_do_operation(struct panfrost_device *pfdev,
+			       struct panfrost_mmu *mmu,
+			       u64 iova, size_t size, u32 op)
+{
+	int ret;

+	spin_lock(&pfdev->as_lock);
+	ret = mmu_hw_do_operation_locked(pfdev, mmu->as, iova, size, op);
+	spin_unlock(&pfdev->as_lock);
 	return ret;
 }

--
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-26 22:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 22:33 [PATCH v3 0/8] panfrost: Locking and runtime PM fixes Rob Herring
2019-08-26 22:33 ` [PATCH v3 1/8] drm/panfrost: Rework runtime PM initialization Rob Herring
2019-08-27 10:59   ` Robin Murphy
2019-08-28 10:39   ` Steven Price
2019-08-26 22:33 ` [PATCH v3 2/8] drm/panfrost: Hold runtime PM reference until jobs complete Rob Herring
2019-08-28 10:40   ` Steven Price
2019-08-26 22:33 ` [PATCH v3 3/8] drm/panfrost: Remove unnecessary mmu->lock mutex Rob Herring
2019-08-27 11:00   ` Robin Murphy
2019-08-28 10:42   ` Steven Price
2019-08-26 22:33 ` [PATCH v3 4/8] drm/panfrost: Rework page table flushing and runtime PM interaction Rob Herring
2019-08-27 11:06   ` Robin Murphy
2019-08-28 10:54   ` Steven Price
2019-08-26 22:33 ` Rob Herring [this message]
2019-08-28 10:54   ` [PATCH v3 5/8] drm/panfrost: Split mmu_hw_do_operation into locked and unlocked version Steven Price
2019-08-26 22:33 ` [PATCH v3 6/8] drm/panfrost: Add cache/TLB flush before switching address space Rob Herring
2019-08-27 11:30   ` Robin Murphy
2019-08-28 13:17   ` Steven Price
2019-08-26 22:33 ` [PATCH v3 7/8] drm/panfrost: Flush and disable address space when freeing page tables Rob Herring
2019-08-27 11:24   ` Robin Murphy
2019-08-28 10:55   ` Steven Price
2019-08-28 12:35     ` Rob Herring
2019-08-28 13:12       ` Steven Price
2019-08-26 22:33 ` [PATCH v3 8/8] drm/panfrost: Remove unnecessary hwaccess_lock spin_lock Rob Herring
2019-08-28 10:59   ` Steven Price
2019-08-26 23:35 ` [PATCH v3 0/8] panfrost: Locking and runtime PM fixes Alyssa Rosenzweig

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=20190826223317.28509-6-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robin.murphy@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.