Skip to contentSkip to conversation

dma-buf: Document how exporters and importers agree on mapping lifetime

PATCH New Leon Romanovsky 1 participant 1 message Sep 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dma-buf: Document how exporters and importers agree on mapping lifetime

From: Leon Romanovsky <[email protected]>

Nothing in DMA-buf declares whether a mapping may be moved or taken away. Nearly every callback on both sides is optional, so the answer follows from which ones are implemented and from whether dma_buf_pin() succeeds. Documentation/ says none of this, and the rules sit in the kdoc of dma_buf_ops.pin, dma_buf_attach_ops.invalidate_mappings and dma_buf_invalidate_mappings(), which a driver author has to know by name before finding them.

Describe the three flows an importer has to handle, the callbacks each one asks of both sides, and dma_buf_pin() as the runtime negotiation.

---
Let's try this variant from importer POV.

Thanks

Changes in v2:
- Split pci p2p documentation patch to separate series
- Improved dma-buf documentation patch.
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/driver-api/dma-buf.rst |  6 ++++
 drivers/dma-buf/dma-buf.c            | 69 +++++++++++++++++++++++++++++++++++-
 2 files changed, 74 insertions(+), 1 deletion(-)
Documentation/driver-api/dma-buf.rst +6 -0
index 2f36c21d9948..39c201f38aa6 100644
@@ -113,6 +113,12 @@ Basic Operation and Device DMA Access
 .. kernel-doc:: drivers/dma-buf/dma-buf.c
    :doc: dma buf device access
 
+Mapping Lifetime Negotiation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. kernel-doc:: drivers/dma-buf/dma-buf.c
+   :doc: mapping lifetime negotiation
+
 CPU Access to DMA Buffer Objects
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
drivers/dma-buf/dma-buf.c +68 -1

75 lines not on this page · raw message

---
base-commit: 63367df6e7255067ad6a83abe0d2799dfa491876
change-id: 20260820-document-dma-buf-3f8b41e32f57

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>