mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	"Akash Goel" <akash.goel@arm.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Boris Brezillon <boris.brezillon@collabora.com>
Subject: [PATCH v2 5/5] drm/panthor: Remove redundant panthor_fix_sparse_map_offset() call
Date: Thu, 24 Sep 2026 13:04:42 +0200	[thread overview]
Message-ID: <20260924-panthor-fix-partial-unmap-v2-5-59a68a1f9e14@collabora.com> (raw)
In-Reply-To: <20260924-panthor-fix-partial-unmap-v2-0-59a68a1f9e14@collabora.com>

op->remap.next->gem.offset is adjusted twice in
panthor_gpuva_sm_step_remap() (once on the remap.next object, and once on
the local map_op). Let's do it only once, and move this adjusment closer
to the place it matters.

Reported-by: Akash Goel <akash.goel@arm.com>
Closes: https://lore.kernel.org/dri-devel/b85679e3-5ca2-4d36-8675-2b968d97cb5b@arm.com/
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 01564d250adf..d8fb29ace5c4 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -2397,11 +2397,6 @@ static int panthor_gpuva_sm_step_remap(struct drm_gpuva_op *op,
 
 	drm_gpuva_op_remap_to_unmap_range(&op->remap, &unmap_start, &unmap_range);
 
-	/* op->remap.prev's BO offset is always the same as the unmap va's, but
-	 * that of op->remap.next must be adjusted so as to remain < SZ_2M
-	 */
-	panthor_fix_sparse_map_offset(op->remap.next, unmap_vma->flags);
-
 	if (!unmap_vma->evicted) {
 		/*
 		 * ARM IOMMU page table management code disallows partial unmaps of huge pages,
@@ -2447,6 +2442,12 @@ static int panthor_gpuva_sm_step_remap(struct drm_gpuva_op *op,
 		u64 addr = op->remap.next->va.addr;
 		u64 size = unmap_start + unmap_range - op->remap.next->va.addr;
 
+		/* op->remap.prev's BO offset is always the same as the unmap
+		 * va's, but that of op->remap.next must be adjusted so as to
+		 * remain < SZ_2M
+		 */
+		panthor_fix_sparse_map_offset(op->remap.next, unmap_vma->flags);
+
 		if (!unmap_vma->evicted && size > 0) {
 			struct drm_gpuva_op_map map_op = {
 				.va.addr = addr,
@@ -2454,7 +2455,6 @@ static int panthor_gpuva_sm_step_remap(struct drm_gpuva_op *op,
 				.gem.obj = op->remap.next->gem.obj,
 				.gem.offset = op->remap.next->gem.offset,
 			};
-			panthor_fix_sparse_map_offset(&map_op, unmap_vma->flags);
 
 			ret = panthor_vm_exec_map_op(vm, unmap_vma->flags, &map_op);
 			if (ret)

-- 
2.55.0


  parent reply	other threads:[~2026-09-24 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 11:04 [PATCH v2 0/5] drm/panthor: Fix partial unmaps, again Boris Brezillon
2026-09-24 11:04 ` [PATCH v2 1/5] drm/panthor: Avoid false positives in iova_mapped_as_huge_page() Boris Brezillon
2026-09-24 11:04 ` [PATCH v2 2/5] drm/panthor: Fix iova_mapped_as_huge_page() for imported BOs Boris Brezillon
2026-09-24 11:04 ` [PATCH v2 3/5] drm/panthor: Consolidate the is-huge-page-mapping test Boris Brezillon
2026-09-24 11:04 ` [PATCH v2 4/5] drm/panthor: Actually check huge-page mapping on sparse regions Boris Brezillon
2026-10-01 23:04   ` Adrián Larumbe
2026-09-24 11:04 ` Boris Brezillon [this message]
2026-10-01 22:49 ` [PATCH v2 0/5] drm/panthor: Fix partial unmaps, again Adrián Larumbe

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=20260924-panthor-fix-partial-unmap-v2-5-59a68a1f9e14@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=akash.goel@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®