On Fri, 6 Jun 2025 10:09:30 +0200 Boris Brezillon <boris.brezil...@collabora.com> wrote:
> 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 > > Changes in v3: > - Fix a comment > > [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 Queued to drm-misc-next. > > 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(-) >