On Tue, 26 Mar 2024 12:12:03 +0100 Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote: > When mapping an IO region, the pseudo-file offset is dependent on the > userspace architecture. panthor_device_mmio_offset() abstracts that > away for us by turning a userspace MMIO offset into its kernel > equivalent, but we were not updating vm_area_struct::vm_pgoff > accordingly, leading us to attach the MMIO region to the wrong file > offset. > > This has implications when we start mixing 64 bit and 32 bit apps, but > that's only really a problem when we start having more that 2^43 bytes of > memory allocated, which is very unlikely to happen. > > What's more problematic is the fact this turns our > unmap_mapping_range(DRM_PANTHOR_USER_MMIO_OFFSET) calls, which are > supposed to kill the MMIO mapping when entering suspend, into NOPs. > Which means we either keep the dummy flush_id mapping active at all > times, or we risk a BUS_FAULT if the MMIO region was mapped, and the > GPU is suspended after that. > > Solve that by patching vm_pgoff early in panthor_mmap(). With > this in place, we no longer need the panthor_device_mmio_offset() > helper. > > v3: > - No changes > > v2: > - Kill panthor_device_mmio_offset() > > Fixes: 5fe909cae118 ("drm/panthor: Add the device logical block") > Reported-by: Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> > Reported-by: Lukas F. Hartmann <lukas@xxxxxxxxx> > Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10835 > Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> > Reviewed-by: Steven Price <steven.price@xxxxxxx> All 3 patches queued to drm-misc-next.