On Sun, 19 Jan 2025 at 12:50, Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> wrote: > > ret = io_remap_pfn_range(vma, vma->vm_start, > > - vram->vram_node.start >> PAGE_SHIFT, > > + (vram->vram_node.start >> PAGE_SHIFT) + vma->vm_pgoff, > > vm_size, vma->vm_page_prot); > > return ret; > > } > > The vma->vm_pgoff is fake in DRM, it's used for looking up DRM GEM > object based on the vma->vm_pgoff value when mmap is invoked. If my understanding is correct, vm_pgoff gets "unfaked" by https://elixir.bootlin.com/linux/v6.12.6/source/drivers/gpu/drm/virtio/virtgpu_vram.c#L48 > vma->vm_pgoff should be treated as zero here. Hence we can map a part of > GEM, but only from its start. See drm_gem_mmap(). I've had a "v0" (not on ml) of this patch that always treated vma->vm_pgoff as zero. This broke when anything tried to mmap with a non-zero offset. Adding vm_pgoff made it work correctly. > Please correct vma->vm_pgoff in v2. I need apps to be able to mmap with a non-zero offset for my usecase. While the correct value may be something else other than what is in the current patch, 0 is definitely incorrect for at least some workloads.