Re: [PATCH v7 5/6] drm/panthor: Support sparse mappings

From: Boris Brezillon

Date: Fri Apr 17 2026 - 04:20:48 EST


On Thu, 16 Apr 2026 19:25:01 +0100
Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> wrote:

> > > +/**
> > > + * panthor_dummy_bo_create() - Create a Panthor BO meant to back sparse bindings.
> > > + * @ptdev: Device.
> > > + *
> > > + * Return: A valid pointer in case of success, an ERR_PTR() otherwise.
> > > + */
> > > +struct panthor_gem_object *
> > > +panthor_dummy_bo_create(struct panthor_device *ptdev)
> > > +{
> > > + u32 dummy_flags = DRM_PANTHOR_BO_NO_MMAP;
> > > + struct panthor_gem_object *bo;
> > > + struct page **pages;
> > > +
> > > + bo = panthor_gem_create(&ptdev->base, SZ_2M, dummy_flags, NULL, 0);
> > > + if (IS_ERR_OR_NULL(bo))
> > > + return bo;
> > > +
> > > + pages = drm_gem_get_pages(&bo->base);
> >
> > Why not use panthor_gem_backing_get_pages_locked() here? Also,
> > drm_gem_get_pages() doesn't give any guarantee that you'll get a huge
> > page, nor can you guarantee that the 2M won't be reclaimed and later
> > on be re-allocated as 4k chunks. I'd probably keep things simple for
> > now, and
> >
> > - keep it a 2M GEM object
> > - force the page allocation at map time, just like we do for regular BOs
>
> On a second thought, if I force page allocation at map time, then there's no need to wait
> until a sparse vm_bind operation to create the dummy BO. I can just do it at VM creation time
> and then let the vm_bind ioctl path allocate the pages.

Yep, you can do that, indeed.