All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: "Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	dri-devel@lists.freedesktop.org, kernel@collabora.com
Subject: Re: [PATCH 2/2] drm/panthor: Fix the user MMIO offset logic for emulators
Date: Thu, 17 Apr 2025 14:49:38 +0200	[thread overview]
Message-ID: <20250417144938.1488a2f7@collabora.com> (raw)
In-Reply-To: <20250417141031.35b17c68@collabora.com>

On Thu, 17 Apr 2025 14:10:31 +0200
Boris Brezillon <boris.brezillon@collabora.com> wrote:

> > I can't help feeling we can just simplify this to:
> > 
> > 	u64 mmio_offset = pfile->user_mmio.offset;
> > 
> > 	if (offset >= mmio_offset) {
> > 		offset -= mmio_offset;
> > 		offset += DRM_PANTHOR_USER_MMIO_OFFSET;
> > 		vma->vm_pgoff = offset >> PAGE_SHIFT;
> > 
> > 		ret = panthor_device_mmap_io(ptdev, vma);
> > 	} else {
> > 		ret = drm_gem_mmap(filp, vma);
> > 	}
> > 
> > Or even go further and push the offset calculations into
> > panthor_device_mmap_io().  
> 
> Sure, I can do that.

Actually, if I drop the lock in favor of a

	u64 mmio_offset = READ_ONCE(pfile->user_mmio.offset);

I can't move the vm_pgoff/offset adjustement to
panthor_device_mmap_io() because userspace might have called
SET_MMIO_OFFSET in the meantime, thus changing the final offset. One
option would be to pass the mmio_offset to panthor_device_mmap_io(),
but I think I prefer keeping the offset adjustment here if you don't
mind.

  reply	other threads:[~2025-04-17 12:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 10:05 [PATCH 0/2] drm/panthor: Fix panthor+FEX-Emu Boris Brezillon
2025-04-17 10:05 ` [PATCH 1/2] drm/panthor: Fix missing explicit padding in drm_panthor_gpu_info Boris Brezillon
2025-04-17 10:24   ` Steven Price
2025-04-17 11:24     ` Boris Brezillon
2025-04-17 11:26   ` Liviu Dudau
2025-04-17 10:05 ` [PATCH 2/2] drm/panthor: Fix the user MMIO offset logic for emulators Boris Brezillon
2025-04-17 10:41   ` Steven Price
2025-04-17 11:33     ` Liviu Dudau
2025-04-17 12:16       ` Boris Brezillon
2025-04-17 13:05         ` Liviu Dudau
2025-04-17 12:10     ` Boris Brezillon
2025-04-17 12:49       ` Boris Brezillon [this message]
2025-04-17 14:58       ` Steven Price

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=20250417144938.1488a2f7@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=liviu.dudau@arm.com \
    --cc=steven.price@arm.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.