From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: leonro@nvidia.com, francois.dugast@intel.com,
thomas.hellstrom@linux.intel.com,
himal.prasad.ghimiray@intel.com, jgg@ziepe.ca
Subject: [RFC PATCH v3 06/11] drm/pagemap: Add IOVA interface to DRM pagemap
Date: Tue, 27 Jan 2026 16:48:36 -0800 [thread overview]
Message-ID: <20260128004841.2436896-7-matthew.brost@intel.com> (raw)
In-Reply-To: <20260128004841.2436896-1-matthew.brost@intel.com>
Add an IOVA interface to the DRM pagemap layer. This provides a semantic
wrapper around the dma-map IOVA alloc/link/sync/unlink/free API while
remaining flexible enough to support future high-speed interconnects
between devices.
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
include/drm/drm_pagemap.h | 87 +++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/include/drm/drm_pagemap.h b/include/drm/drm_pagemap.h
index 14e1db564c25..0b410113ef95 100644
--- a/include/drm/drm_pagemap.h
+++ b/include/drm/drm_pagemap.h
@@ -72,6 +72,93 @@ drm_pagemap_addr_encode(dma_addr_t addr,
* struct drm_pagemap_ops: Ops for a drm-pagemap.
*/
struct drm_pagemap_ops {
+ /**
+ * @device_iova_alloc: Allocate a IOVA for device access (required)
+ *
+ * @dpagemap: The struct drm_pagemap for the IOVA.
+ * @dev: The device mapper.
+ * @length: Length of IOVA.
+ * @dir: The transfer direction.
+ *
+ * Context: Reclaim unsafe, maybe take dma-resv locks.
+ *
+ * Return: Cookie to IOVA which is passed to other vfuncs, NULL if no
+ * IOVA could be allocated or not needed, ERR_PTR if an IOVA is required
+ * but allocation failed.
+ */
+ void *(*device_iova_alloc)(struct drm_pagemap *dpagemap,
+ struct device *dev, size_t length,
+ enum dma_data_direction dir);
+
+ /**
+ * @device_iova_free: Free a IOVA from device access (optional, required
+ * if @device_iova_alloc returns a valid cookie)
+ *
+ * @dpagemap: The struct drm_pagemap for the IOVA.
+ * @dev: The device mapper.
+ * @length: Length of IOVA.
+ * @cookie: Cookie for IOVA.
+ *
+ * Context: Reclaim unsafe, maybe take dma-resv locks.
+ */
+ void (*device_iova_free)(struct drm_pagemap *dpagemap,
+ struct device *dev, size_t length,
+ void *cookie);
+
+ /**
+ * @device_iova_link: Link IOVA in device (optional, required if
+ * @device_iova_alloc returns a valid cookie)
+ *
+ * @dpagemap: The struct drm_pagemap for the IOVA.
+ * @dev: The device mapper.
+ * @length: Length of mapping.
+ * @offset: Offset in IOVA of mapping.
+ * @cookie: Cookie for IOVA.
+ * @dir: The transfer direction.
+ *
+ * Context: Reclaim safe.
+ */
+ struct drm_pagemap_addr (*device_iova_link)(struct drm_pagemap *dpagemap,
+ struct device *dev,
+ struct page *page,
+ size_t length,
+ size_t offset,
+ void *cookie,
+ enum dma_data_direction dir);
+
+ /**
+ * @device_iova_sync: Sync IOVA in device (optional, required if
+ * @device_iova_alloc returns a valid cookie)
+ *
+ * @dpagemap: The struct drm_pagemap for the IOVA.
+ * @dev: The device mapper.
+ * @length: Length of IOVA.
+ * @cookie: Cookie for IOVA.
+ *
+ * Context: Reclaim safe.
+ *
+ * Return: Zero on success, negative error code on failure.
+ */
+ int (*device_iova_sync)(struct drm_pagemap *dpagemap,
+ struct device *dev, size_t length,
+ void *cookie);
+
+ /**
+ * @device_iova_unlink: Unlink IOVA from device (optional, required if
+ * @device_iova_alloc returns a valid cookie)
+ *
+ * @dpagemap: The struct drm_pagemap for the IOVA.
+ * @dev: The device mapper.
+ * @length: Length of IOVA.
+ * @cookie: Cookie for IOVA.
+ * @dir: The transfer direction.
+ *
+ * Context: Reclaim safe.
+ */
+ void (*device_iova_unlink)(struct drm_pagemap *dpagemap,
+ struct device *dev, size_t length,
+ void *cookie, enum dma_data_direction dir);
+
/**
* @device_map: Map for device access or provide a virtual address suitable for
*
--
2.34.1
next prev parent reply other threads:[~2026-01-28 0:49 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 0:48 [RFC PATCH v3 00/11] Use new dma-map IOVA alloc, link, and sync API in GPU SVM and DRM pagemap Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 01/11] drm/pagemap: Add helper to access zone_device_data Matthew Brost
2026-01-28 13:53 ` Leon Romanovsky
2026-01-28 0:48 ` [RFC PATCH v3 02/11] drm/gpusvm: Use dma-map IOVA alloc, link, and sync API in GPU SVM Matthew Brost
2026-01-28 14:04 ` Leon Romanovsky
2026-01-28 0:48 ` [RFC PATCH v3 03/11] drm/pagemap: Split drm_pagemap_migrate_map_pages into device / system Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 04/11] drm/pagemap: Use dma-map IOVA alloc, link, and sync API for DRM pagemap Matthew Brost
2026-01-28 14:28 ` Leon Romanovsky
2026-01-28 17:46 ` Matthew Brost
[not found] ` <20260128175531.GR1641016@ziepe.ca>
2026-01-28 19:29 ` Matthew Brost
2026-01-28 19:45 ` Leon Romanovsky
2026-01-28 21:04 ` Matthew Brost
2026-01-29 10:14 ` Leon Romanovsky
2026-01-29 18:22 ` Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 05/11] drm/pagemap: Reduce number of IOVA link calls Matthew Brost
2026-01-28 0:48 ` Matthew Brost [this message]
[not found] ` <20260128151458.GJ1641016@ziepe.ca>
2026-01-28 18:42 ` [RFC PATCH v3 06/11] drm/pagemap: Add IOVA interface to DRM pagemap Matthew Brost
2026-01-28 19:41 ` Matthew Brost
[not found] ` <20260128193509.GU1641016@ziepe.ca>
2026-01-28 20:24 ` Matthew Brost
2026-01-29 18:57 ` Jason Gunthorpe
2026-01-29 19:28 ` Matthew Brost
2026-01-29 19:32 ` Jason Gunthorpe
2026-01-28 0:48 ` [RFC PATCH v3 07/11] drm/xe: Stub out DRM pagemap IOVA alloc implementation Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 08/11] drm/pagemap: Use device-to-device IOVA alloc, link, and sync API for DRM pagemap Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 09/11] drm/xe: Drop BO dma-resv lock during SVM migrate-to-device Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 10/11] drm/xe: Implement DRM pagemap IOVA vfuncs Matthew Brost
2026-01-28 0:48 ` [RFC PATCH v3 11/11] drm/gpusvm: Use device-to-device IOVA alloc, link, and sync API in GPU SVM Matthew Brost
2026-01-28 0:59 ` ✗ CI.checkpatch: warning for Use new dma-map IOVA alloc, link, and sync API in GPU SVM and DRM pagemap (rev3) Patchwork
2026-01-28 1:01 ` ✓ CI.KUnit: success " Patchwork
2026-01-28 1:42 ` ✓ Xe.CI.BAT: " Patchwork
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=20260128004841.2436896-7-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jgg@ziepe.ca \
--cc=leonro@nvidia.com \
--cc=thomas.hellstrom@linux.intel.com \
/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