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 04/13] drm/panthor: Expose the selected coherency protocol to the UMD
Date: Fri, 10 Oct 2025 17:08:27 +0200	[thread overview]
Message-ID: <20251010170827.37b750aa@fedora> (raw)
In-Reply-To: <9664ba34-c02e-446a-bfc7-5b7f32a60833@arm.com>

On Fri, 10 Oct 2025 15:22:50 +0100
Steven Price <steven.price@arm.com> wrote:

> On 10/10/2025 11:11, Boris Brezillon wrote:
> > If we want to be able to skip CPU cache maintenance operations on
> > CPU-cached mappings, the UMD needs to know the kind of coherency
> > in place. Add a field to drm_panthor_gpu_info to do that. We can re-use
> > a padding field for that since this object is write-only from the
> > KMD perspective, and the UMD should just ignore it.
> > 
> > v2:
> > - New commit
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >  drivers/gpu/drm/panthor/panthor_device.c |  6 +++-
> >  drivers/gpu/drm/panthor/panthor_gpu.c    |  2 +-
> >  include/uapi/drm/panthor_drm.h           | 39 ++++++++++++++++++++++--
> >  3 files changed, 42 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> > index c7033d82cef5..afe24a03a71c 100644
> > --- a/drivers/gpu/drm/panthor/panthor_device.c
> > +++ b/drivers/gpu/drm/panthor/panthor_device.c
> > @@ -25,6 +25,8 @@
> >  
> >  static int panthor_gpu_coherency_init(struct panthor_device *ptdev)
> >  {
> > +	/* Start with no coherency, and update it if the device is flagged coherent. */
> > +	ptdev->gpu_info.selected_coherency = GPU_COHERENCY_NONE;
> >  	ptdev->coherent = device_get_dma_attr(ptdev->base.dev) == DEV_DMA_COHERENT;
> >  
> >  	if (!ptdev->coherent)
> > @@ -34,8 +36,10 @@ static int panthor_gpu_coherency_init(struct panthor_device *ptdev)
> >  	 * ACE protocol has never been supported for command stream frontend GPUs.
> >  	 */
> >  	if ((gpu_read(ptdev, GPU_COHERENCY_FEATURES) &
> > -		      GPU_COHERENCY_PROT_BIT(ACE_LITE)))
> > +		      GPU_COHERENCY_PROT_BIT(ACE_LITE))) {
> > +		ptdev->gpu_info.selected_coherency = GPU_COHERENCY_PROT_BIT(ACE_LITE);
> >  		return 0;
> > +	}
> >  
> >  	drm_err(&ptdev->base, "Coherency not supported by the device");
> >  	return -ENOTSUPP;
> > diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
> > index 9d98720ce03f..a95c0b94ef58 100644
> > --- a/drivers/gpu/drm/panthor/panthor_gpu.c
> > +++ b/drivers/gpu/drm/panthor/panthor_gpu.c
> > @@ -49,7 +49,7 @@ struct panthor_gpu {
> >  static void panthor_gpu_coherency_set(struct panthor_device *ptdev)
> >  {
> >  	gpu_write(ptdev, GPU_COHERENCY_PROTOCOL,
> > -		ptdev->coherent ? GPU_COHERENCY_PROT_BIT(ACE_LITE) : GPU_COHERENCY_NONE);
> > +		  ptdev->gpu_info.selected_coherency);  
> 
> It looks like an existing bug, but GPU_COHERENCY_PROTOCOL doesn't take a
> bit mask. So we should be just writing GPU_COHERENCY_ACE_LITE not
> GPU_COHERENCY_PROT_BIT(ACE_LITE).

Oops. Should I prepare a fix, or does someone at Arm intend to send a
fix for this one?

> 
> >  }
> >  
> >  static void panthor_gpu_l2_config_set(struct panthor_device *ptdev)
> > diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
> > index 467d365ed7ba..b9e483ff5e21 100644
> > --- a/include/uapi/drm/panthor_drm.h
> > +++ b/include/uapi/drm/panthor_drm.h
> > @@ -245,6 +245,26 @@ enum drm_panthor_dev_query_type {
> >  	DRM_PANTHOR_DEV_QUERY_GROUP_PRIORITIES_INFO,
> >  };
> >  
> > +/**
> > + * enum drm_panthor_gpu_coherency: Type of GPU coherency
> > + */
> > +enum drm_panthor_gpu_coherency {
> > +	/**
> > +	 * @DRM_PANTHOR_GPU_COHERENCY_ACE_LITE: ACE Lite coherency.
> > +	 */
> > +	DRM_PANTHOR_GPU_COHERENCY_ACE_LITE = 1 << 0,
> > +
> > +	/**
> > +	 * @DRM_PANTHOR_GPU_COHERENCY_ACE_LITE: ACE coherency.  
> 
> Copy/paste mistake                       ^^^^^

Will fix.

> 
> > +	 */
> > +	DRM_PANTHOR_GPU_COHERENCY_ACE = 1 << 1,
> > +
> > +	/**
> > +	 * @DRM_PANTHOR_GPU_COHERENCY_NONE: No coherency.
> > +	 */
> > +	DRM_PANTHOR_GPU_COHERENCY_NONE = 31,
> > +};  
> 
> This is a mix of bit mask and non-bit mask. I'm assuming this was
> intended for the newly added selected_coherency field, in which case it
> shouldn't be shifting - the values are 0 and 1 for ace_lite and ace.

Yeah, I think I went back and forth on this, and just picked the worst
option in the end. I'll make it a real enum with the mapping you
suggested.

  reply	other threads:[~2025-10-10 15:08 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 [this message]
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
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=20251010170827.37b750aa@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).