public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panthor: Fix handling of partial GPU mapping of BOs
@ 2024-11-11  9:26 Akash Goel
  2024-11-11 11:31 ` Steven Price
  2024-11-11 12:03 ` Liviu Dudau
  0 siblings, 2 replies; 4+ messages in thread
From: Akash Goel @ 2024-11-11  9:26 UTC (permalink / raw)
  To: boris.brezillon, liviu.dudau, steven.price
  Cc: dri-devel, linux-kernel, mihail.atanassov, ketil.johnsen,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel, nd,
	Akash Goel

This commit fixes the handling of partial GPU mapping of buffer objects
in Panthor.
VM_BIND ioctl allows Userspace to partially map the BOs to GPU.
To map a BO, Panthor walks through the sg_table to retrieve the physical
address of pages. If the mapping is created at an offset into the BO,
then the scatterlist(s) at the beginning have to be skipped to reach the
one corresponding to the offset. But the case where the offset didn't
point to the first page of desired scatterlist wasn't handled correctly.
The bug caused the partial GPU mapping of BO to go wrong for the said
case, as the pages didn't get map at the expected virtual address and
consequently there were kernel warnings on unmap.

Signed-off-by: Akash Goel <akash.goel@arm.com>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index d8cc9e7d064e..6bc188d9a9ad 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -957,6 +957,7 @@ panthor_vm_map_pages(struct panthor_vm *vm, u64 iova, int prot,
 
 		paddr += offset;
 		len -= offset;
+		offset = 0;
 		len = min_t(size_t, len, size);
 		size -= len;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-12  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11  9:26 [PATCH] drm/panthor: Fix handling of partial GPU mapping of BOs Akash Goel
2024-11-11 11:31 ` Steven Price
2024-11-12  9:07   ` Boris Brezillon
2024-11-11 12:03 ` Liviu Dudau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox