On Wed, 15 Oct 2025 16:32:54 +0100 Steven Price <[email protected]> wrote:
> On 15/10/2025 14:01, Boris Brezillon wrote: > > From: Faith Ekstrand <[email protected]> > > > > Will be used by the UMD to optimize CPU accesses to buffers > > that are frequently read by the CPU, or on which the access > > pattern makes non-cacheable mappings inefficient. > > > > Mapping buffers CPU-cached implies taking care of the CPU > > cache maintenance in the UMD, unless the GPU is IO coherent. > > > > v2: > > - Add more to the commit message > > > > v3: > > - No changes > > > > Signed-off-by: Faith Ekstrand <[email protected]> > > Signed-off-by: Boris Brezillon <[email protected]> > > --- > > drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++++-- > > drivers/gpu/drm/panfrost/panfrost_gem.c | 3 +++ > > include/uapi/drm/panfrost_drm.h | 1 + > > 3 files changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c > > b/drivers/gpu/drm/panfrost/panfrost_drv.c > > index 00c0881fa2f0..0f51b1dc1abc 100644 > > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c > > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c > > @@ -125,6 +125,10 @@ static int panfrost_ioctl_get_param(struct drm_device > > *ddev, void *data, struct > > return 0; > > } > > > > +#define PANFROST_BO_FLAGS (PANFROST_BO_NOEXEC | \ > > + PANFROST_BO_HEAP | \ > > + PANFROST_BO_WB_MMAP) > > + > > static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data, > > struct drm_file *file) > > { > > @@ -134,8 +138,7 @@ static int panfrost_ioctl_create_bo(struct drm_device > > *dev, void *data, > > struct panfrost_gem_mapping *mapping; > > int ret; > > > > - if (!args->size || args->pad || > > - (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP))) > > + if (!args->size || args->pad || (args->flags & ~PANFROST_BO_FLAGS)) > > return -EINVAL; > > > > /* Heaps should never be executable */ > > @@ -661,6 +664,9 @@ static int panfrost_ioctl_query_bo_info(struct > > drm_device *dev, void *data, > > > > if (bo->is_heap) > > args->create_flags |= PANFROST_BO_HEAP; > > + > > + if (bo->base.map_wc) > > + args->create_flags |= PANFROST_BO_WB_MMAP; > > This test is still reversed (or I'm confused?) WTF?! I had that fixed. I must have stashed the changes before amending the commit :face_palm:. > > Thanks, > Steve > > > } > > > > drm_gem_object_put(gem_obj); > > diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c > > b/drivers/gpu/drm/panfrost/panfrost_gem.c > > index da0362202d94..0e8028ee9d1f 100644 > > --- a/drivers/gpu/drm/panfrost/panfrost_gem.c > > +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c > > @@ -320,6 +320,9 @@ panfrost_gem_create(struct drm_device *dev, size_t > > size, u32 flags) > > bo->noexec = !!(flags & PANFROST_BO_NOEXEC); > > bo->is_heap = !!(flags & PANFROST_BO_HEAP); > > > > + if (flags & PANFROST_BO_WB_MMAP) > > + bo->base.map_wc = false; > > + > > return bo; > > } > > > > diff --git a/include/uapi/drm/panfrost_drm.h > > b/include/uapi/drm/panfrost_drm.h > > index e7d01e744efd..244d2f96c2d7 100644 > > --- a/include/uapi/drm/panfrost_drm.h > > +++ b/include/uapi/drm/panfrost_drm.h > > @@ -104,6 +104,7 @@ struct drm_panfrost_wait_bo { > > /* Valid flags to pass to drm_panfrost_create_bo */ > > #define PANFROST_BO_NOEXEC 1 > > #define PANFROST_BO_HEAP 2 > > +#define PANFROST_BO_WB_MMAP 4 > > > > /** > > * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost > > BOs. >
