dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: "Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	dri-devel@lists.freedesktop.org,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Faith Ekstrand" <faith.ekstrand@collabora.com>,
	kernel@collabora.com
Subject: Re: [PATCH v2 12/13] drm/panfrost: Add flag to map GEM object Write-Back Cacheable
Date: Fri, 10 Oct 2025 18:31:34 +0200	[thread overview]
Message-ID: <20251010183134.6e8c4152@fedora> (raw)
In-Reply-To: <ae4cb263-ac1c-49ee-a3fb-3937c6982e1c@arm.com>

On Fri, 10 Oct 2025 16:00:45 +0100
Steven Price <steven.price@arm.com> wrote:

> On 10/10/2025 11:11, Boris Brezillon wrote:
> > From: Faith Ekstrand <faith.ekstrand@collabora.com>
> > 
> > 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
> > 
> > Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>  
> 
> Should we not expose the PANFROST_BO_WB_MMAP flag through
> DRM_IOCTL_PANFROST_QUERY_BO_INFO? The documentation states that we
> return "Flags passed at creation time", but then this new flag isn't
> returned.

It was meant to be, I just got the test reversed in
panfrost_ioctl_query_bo_info().

> 
> Thanks,
> Steve
> 
> > ---
> >  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;

Oops, it's actually

		if (!bo->base.map_wc)
			args->create_flags |= PANFROST_BO_WB_MMAP;

> >  	}
> >  
> >  	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 5832a291adc4..2c1e28f9dd07 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.  
> 


  reply	other threads:[~2025-10-10 16:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10 10:11 [PATCH v2 00/13] drm/panfrost, panthor: Cached maps and explicit flushing Boris Brezillon
2025-10-10 10:11 ` [PATCH v2 01/13] drm/gem: Add a drm_gem_object_funcs::sync() and a drm_gem_sync() helper Boris Brezillon
2025-10-10 10:11 ` [PATCH v2 02/13] drm/prime: Provide default ::{begin, end}_cpu_access() implementations Boris Brezillon
2025-10-10 14:11   ` [PATCH v2 02/13] drm/prime: Provide default ::{begin,end}_cpu_access() implementations Steven Price
2025-10-10 15:03     ` Boris Brezillon
2025-10-10 15:34       ` Steven Price
2025-10-10 16:02         ` Boris Brezillon
2025-10-10 10:11 ` [PATCH v2 03/13] drm/shmem: Add a drm_gem_shmem_sync() helper Boris Brezillon
2025-10-10 10:11 ` [PATCH v2 04/13] drm/panthor: Expose the selected coherency protocol to the UMD Boris Brezillon
2025-10-10 14:22   ` Steven Price
2025-10-10 15:08     ` Boris Brezillon
2025-10-10 15:36       ` Steven Price
2025-10-10 10:11 ` [PATCH v2 05/13] drm/panthor: Add a PANTHOR_BO_SYNC ioctl Boris Brezillon
2025-10-10 14:31   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 06/13] drm/panthor: Add an ioctl to query BO flags Boris Brezillon
2025-10-10 14:31   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 07/13] drm/panthor: Add flag to map GEM object Write-Back Cacheable Boris Brezillon
2025-10-10 14:41   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 08/13] drm/panthor: Bump the driver version to 1.6 Boris Brezillon
2025-10-10 14:41   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 09/13] drm/panfrost: Expose the selected coherency protocol to the UMD Boris Brezillon
2025-10-10 14:50   ` Steven Price
2025-10-15 11:41     ` Boris Brezillon
2025-10-15 13:18       ` Steven Price
2025-10-10 10:11 ` [PATCH v2 10/13] drm/panfrost: Add a PANFROST_SYNC_BO ioctl Boris Brezillon
2025-10-10 14:57   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 11/13] drm/panfrost: Add an ioctl to query BO flags Boris Brezillon
2025-10-10 15:00   ` Steven Price
2025-10-10 10:11 ` [PATCH v2 12/13] drm/panfrost: Add flag to map GEM object Write-Back Cacheable Boris Brezillon
2025-10-10 15:00   ` Steven Price
2025-10-10 16:31     ` Boris Brezillon [this message]
2025-10-10 10:11 ` [PATCH v2 13/13] drm/panfrost: Bump the driver version to 1.6 Boris Brezillon
2025-10-10 15:01   ` Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251010183134.6e8c4152@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith.ekstrand@collabora.com \
    --cc=kernel@collabora.com \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).