On Thu, 12 Nov 2026 08:54:29 -0500
Faith Ekstrand <[email protected]> wrote:

> From: Maíra Canal <[email protected]>
> To: "Maarten Lankhorst"<[email protected]>, "Maxime
> Ripard"<[email protected]>, "Thomas
> Zimmermann"<[email protected]>, "David Airlie"<[email protected]>,
> "Simona Vetter"<[email protected]>, "Faith
> Ekstrand"<[email protected]>, "Boris
> Brezillon"<[email protected]>, "Rob
> Herring"<[email protected]>, "Steven Price"<[email protected]>,
> "Adrián Larumbe"<[email protected]>, "Liviu
> Dudau"<[email protected]>, "Alex
> Deucher"<[email protected]>, "Christian
> König"<[email protected]>, "Melissa
> Wen"<[email protected]>, "Iago Toral"<[email protected]>, "JaeHoon
> Lee"<[email protected]> Cc: <[email protected]>,
> <[email protected]>, "Maíra Canal"<[email protected]>
> Date: Fri., 30 Oct. 2026 16:50:18 -0400 Subject: [PATCH RFC 00/12]
> drm/v3d: Add support for write-back cacheable BOs
> 
>  > This series aims to implement cached maps and explicit flushing
>  > for the V3D driver, which is mostly motivated by Vulkan's host
>  > cached memory. 
>  > V3D's implementation of cached maps is quite similar to Panfrost's
>  > and therefore, I decided to revamp Panthor/Panfrost's efforts [1]
>  > to implement common shmem helpers for CPU cache maintenance. The
>  > other option would be copying the same code in V3D, so I preferred
>  > to retake the discussion and see if we can reach some consensus. 
>  >  
>  > The most controversial part of this series are the first three
>  > patches, which were extensively discussed in Boris' series. 
>  >  
>  > Patch 1 lets the PRIME helpers work with custom dma_buf_ops,
>  > following Thomas' feedback on [1]: drm_gem_prime_export_with_ops()
>  > exports with driver-provided ops, and gem_prime_is_exporter() lets
>  > a driver recognize its own DMA-BUFs on import, without adding
>  > buffer callbacks to struct drm_driver, as requested by Thomas. 
>  >
>  > Patches 2-3 are taken from [1], rebased on top of drm-misc-next
>  > with some minor kernel-doc fixes.   
> 
> Not entirely included in the mailing list discussion was why we
> abandon this approach for panfrost/panthor:  CPU mapping shared
> dma-bufs is tricky, especialy with non-coherent caching.  Gone are
> the days when we dma-buf had an ownership concept and clients
> properly bookended usage with begin/end.  With explicit cache
> management, there are too many ways that one client can screw up
> another if the BO is shared.
> 
> The solution was to disallow BO sharing for any BOs that weren't
> mapped write-combined or uncached. A number of DRM drivers already
> have a concept of non-sharable BOs for locking reasons.  We simply
> required that for write-back caching.

Hm, I think the confusion comes from the fact I kept this logic in
panthor/panfrost, just made it panfrost/panthor specific. We also don't
enforce !WB_MMAP on shareable at the KMD level, but we have it filtered
out in panvk.

Honestly, I still have a hard time making sense of how this whole
dma-buf sharing can work if importers/exporter clients are free to CPU
map the thing without proper signalling of CPU accesses, and
importers/exporter devices are not IO coherent (which is often the case
on Arm SoCs). Yes, making the CPU mapping non-cached ensures that two
CPU accesses from two clients can't step on each other, but there's
still device <-> CPU synchronization I can't make sense of, especially
if the importer doesn't know about CPU accesses done by the exporter
and has device accesses that weren't flushed for some reason.

Anyway, I'm happy to drop all the cpu_start/end implementation in
panfrost/panthor if that helps clearing the confusion.


> 
> This wasn't obvious from the ML discussions because a lot of the
> back-and-forth happened in chat or in meetings inside Collabora.
> 
> ~Faith Ekstrand
> 
> 

Reply via email to