All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/panthor: Fix panthor+FEX-Emu
@ 2025-04-17 14:49 Boris Brezillon
  2025-04-17 14:49 ` [PATCH v2 1/2] drm/panthor: Add missing explicit padding in drm_panthor_gpu_info Boris Brezillon
  2025-04-17 14:49 ` [PATCH v2 2/2] drm/panthor: Fix the user MMIO offset logic for emulators Boris Brezillon
  0 siblings, 2 replies; 9+ messages in thread
From: Boris Brezillon @ 2025-04-17 14:49 UTC (permalink / raw)
  To: Boris Brezillon, Steven Price, Liviu Dudau, Adrián Larumbe
  Cc: dri-devel, kernel

Hello,

This is an attempt a couple bugs exposed by FEX-Emu. The first one
is pretty trivial and should be uncontroversial, since it's just
a missing padding field in one of our uAPI structs. We are getting
away with it on arm32 because of the alignment rules provided by
the Arm ABI, but x86 has relaxed constraints for u64 fields, and
this bug is definitely hit when running a 32-bit x86 mesa binary
under FEX Emu.

The second fix is addressing a problem we have because FEX-Emu is
an aarch64 process executing 32-bit x86 code, meaning the check
we do on the is-32bit-task check we do to figure out the MMIO
offset seen by the user won't work. In order to fix that, we add
an ioctl to let the user explicitly set this offset. The offset
can only be set early on, if no MMIO range has been mapped before.

With those, and the mesa MR at [1], I managed to run a 32-bit x86
glmark2 through FEX without using the host mesa (if we were to use
the thunked mesa lib, both the kernel and mesa would use
MMIO_OFFSET_64BIT, and the problem doesn't exist anymore).

Regards,

Boris

Changes in v2:
- Simplify the logic in patch2 to have a lockless solution that's
  still safe for what we need

[1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34573

Boris Brezillon (2):
  drm/panthor: Add missing explicit padding in drm_panthor_gpu_info
  drm/panthor: Fix the user MMIO offset logic for emulators

 drivers/gpu/drm/panthor/panthor_device.h | 18 ++++++++
 drivers/gpu/drm/panthor/panthor_drv.c    | 56 +++++++++++++++++-------
 include/uapi/drm/panthor_drm.h           | 41 +++++++++++++++++
 3 files changed, 99 insertions(+), 16 deletions(-)

-- 
2.49.0


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

end of thread, other threads:[~2025-04-24 14:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 14:49 [PATCH v2 0/2] drm/panthor: Fix panthor+FEX-Emu Boris Brezillon
2025-04-17 14:49 ` [PATCH v2 1/2] drm/panthor: Add missing explicit padding in drm_panthor_gpu_info Boris Brezillon
2025-04-17 15:07   ` Steven Price
2025-04-24 14:32   ` Adrián Larumbe
2025-04-17 14:49 ` [PATCH v2 2/2] drm/panthor: Fix the user MMIO offset logic for emulators Boris Brezillon
2025-04-17 15:13   ` Steven Price
2025-04-17 15:37     ` Boris Brezillon
2025-04-22  9:20   ` Liviu Dudau
2025-04-24 14:31   ` Adrián Larumbe

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.