Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v2 0/4] drm/panfrost,panthor: Refuse to export WB_MMAP BOs
@ 2026-11-22 22:14 Maíra Canal
  2026-11-22 22:14 ` [PATCH v2 1/4] drm/shmem: Add a drm_gem_shmem_sync() helper Maíra Canal
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Maíra Canal @ 2026-11-22 22:14 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Faith Ekstrand, Boris Brezillon, Rob Herring,
	Steven Price, Adrián Larumbe, Liviu Dudau, Akash Goel,
	Karunika Choo, Lukas Zapolskas, Chris Diamand, Daniel Almeida,
	Alice Ryhl
  Cc: kernel-dev, dri-devel, rust-for-linux, Maíra Canal

This series follows up on the discussion in the V3D cached maps series
[1], about how to handle CPU-cached BOs that are shared through dma-buf.

As pointed by Faith and Boris, when a buffer is shared through dma-buf,
there's no way to ensure that a client will properly bracket their CPU
accesses with DMA_BUF_IOCTL_SYNC. With WC mappings, waiting on fences is
enough to guarantee consistency. However, with WB mappings, a missed sync
can leave dirty cache lines behind, which another client can end up
writing over.

PanVK already keeps WB_MMAP BOs private, so this series only makes the
kernel enforce the same policy on Panfrost and Panthor. As discussed in
v1, the custom dma_buf_ops are kept, as they're still needed for
IO-coherent GPUs.

- Patch 1 adds the drm_gem_shmem_sync() helper, taken from [2], with
  locking around the sgt walk and handling of unbacked/purged BOs.
- Patch 2 converts Panfrost to drm_gem_shmem_sync(). V3D will also use it
  to implement its cached maps, which I'll send in a separate series.
- Patches 3 and 4 refuse to export WB_MMAP BOs in Panfrost and Panthor.

The Panthor changes were tested locally on hardware and the series was
also tested in Mesa CI (Panfrost and Panthor) without regressions.

[1] https://lore.kernel.org/dri-devel/20261030-v3d-cached-maps-v1-0-0a6a6b363382@igalia.com/T/
[2] https://lore.kernel.org/dri-devel/20251126124455.3656651-1-boris.brezillon@collabora.com/

Best regards,
- Maíra

---
Changes in v2:

- Dropped the patches "[PATCH 3/6] drm/panfrost: Drop custom dma_buf_ops"
  and "[PATCH 6/6] drm/panthor: Drop custom dma_buf_ops" (Boris Brezillon)
- [1/4] Dropped Steven Price's R-b, as the locking changed.
- [1/4] Added a resv lock across the sgt walk, similarly to what's done in
  panthor_gem_sync() (Sashiko)
- [1/4] Stop populating pages on purged or unbacked BOs (Sashiko)
- [2/4] Move right after the drm_gem_shmem_sync() patch, add Fixes: tag
  and reword the commit message.
- Link to v1: https://lore.kernel.org/r/20261119-pan-drop-dma-buf-hooks-v1-0-6c6f1629e7f9@igalia.com

---
Faith Ekstrand (1):
      drm/shmem: Add a drm_gem_shmem_sync() helper

Maíra Canal (3):
      drm/panfrost: Use drm_gem_shmem_sync()
      drm/panfrost: Refuse to export WB_MMAP BOs
      drm/panthor: Refuse to export WB_MMAP BOs

 drivers/gpu/drm/drm_gem_shmem_helper.c  | 108 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/panfrost/panfrost_gem.c |  78 +++--------------------
 drivers/gpu/drm/panthor/panthor_gem.c   |   4 ++
 include/drm/drm_gem_shmem_helper.h      |  17 +++++
 include/uapi/drm/panfrost_drm.h         |   1 +
 include/uapi/drm/panthor_drm.h          |   2 +
 6 files changed, 141 insertions(+), 69 deletions(-)
---
base-commit: ce335050d9a670491139f5e4337934c3e963e7f4
change-id: 20261119-pan-drop-dma-buf-hooks-98f7f19f3b51


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-24 21:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 22:14 [PATCH v2 0/4] drm/panfrost,panthor: Refuse to export WB_MMAP BOs Maíra Canal
2026-11-22 22:14 ` [PATCH v2 1/4] drm/shmem: Add a drm_gem_shmem_sync() helper Maíra Canal
2026-11-24 21:56   ` Liviu Dudau
2026-11-22 22:14 ` [PATCH v2 2/4] drm/panfrost: Use drm_gem_shmem_sync() Maíra Canal
2026-11-22 22:14 ` [PATCH v2 3/4] drm/panfrost: Refuse to export WB_MMAP BOs Maíra Canal
2026-11-22 22:14 ` [PATCH v2 4/4] drm/panthor: " Maíra Canal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox