mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommufd: Clarify IOAS_MAP_FILE dma-buf support
@ 2026-06-10 20:44 Alex Mastro
  2026-06-12 13:11 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Mastro @ 2026-06-10 20:44 UTC (permalink / raw)
  To: Jason Gunthorpe, Kevin Tian, Nicolin Chen
  Cc: iommu, linux-kernel, Alex Mastro

IOMMU_IOAS_MAP_FILE is documented as mapping a memfd, but the
implementation first tries to resolve the fd as a dma-buf and has a
special path for supported dma-buf exporters. In particular, VFIO PCI
dma-bufs exported through VFIO_DEVICE_FEATURE_DMA_BUF can be mapped when
they describe a single DMA range.

Update the UAPI comment so userspace understands that certain kinds of
dma-buf are supported in addition to memfd.

Fixes: 44ebaa1744fd ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE")
Signed-off-by: Alex Mastro <amastro@fb.com>
Assisted-by: Codex:gpt-5.5-high
---
 include/uapi/linux/iommufd.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
index e998dfbd6960..0425d452d41e 100644
--- a/include/uapi/linux/iommufd.h
+++ b/include/uapi/linux/iommufd.h
@@ -224,13 +224,17 @@ struct iommu_ioas_map {
  * @size: sizeof(struct iommu_ioas_map_file)
  * @flags: same as for iommu_ioas_map
  * @ioas_id: same as for iommu_ioas_map
- * @fd: the memfd to map
- * @start: byte offset from start of file to map from
+ * @fd: the memfd or supported dma-buf file to map
+ * @start: byte offset from start of the file to map from
  * @length: same as for iommu_ioas_map
  * @iova: same as for iommu_ioas_map
  *
- * Set an IOVA mapping from a memfd file.  All other arguments and semantics
- * match those of IOMMU_IOAS_MAP.
+ * Set an IOVA mapping from a memfd file. On kernels with dma-buf support,
+ * supported dma-buf files may also be accepted. This is not a generic
+ * dma-buf import path; currently supported dma-bufs include single-range
+ * VFIO PCI dma-bufs exported through VFIO_DEVICE_FEATURE_DMA_BUF, and
+ * other dma-bufs may be rejected. All other arguments and semantics match
+ * those of IOMMU_IOAS_MAP.
  */
 struct iommu_ioas_map_file {
 	__u32 size;

---
base-commit: 61d525d96ade3367ce65e340b33aa2f1fd5a3602
change-id: 20260610-tmp-b39b94ec1ff4

Best regards,
--  
Alex Mastro <amastro@fb.com>


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

* Re: [PATCH] iommufd: Clarify IOAS_MAP_FILE dma-buf support
  2026-06-10 20:44 [PATCH] iommufd: Clarify IOAS_MAP_FILE dma-buf support Alex Mastro
@ 2026-06-12 13:11 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2026-06-12 13:11 UTC (permalink / raw)
  To: Alex Mastro; +Cc: Kevin Tian, Nicolin Chen, iommu, linux-kernel

On Wed, Jun 10, 2026 at 01:44:41PM -0700, Alex Mastro wrote:
> IOMMU_IOAS_MAP_FILE is documented as mapping a memfd, but the
> implementation first tries to resolve the fd as a dma-buf and has a
> special path for supported dma-buf exporters. In particular, VFIO PCI
> dma-bufs exported through VFIO_DEVICE_FEATURE_DMA_BUF can be mapped when
> they describe a single DMA range.
> 
> Update the UAPI comment so userspace understands that certain kinds of
> dma-buf are supported in addition to memfd.
> 
> Fixes: 44ebaa1744fd ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE")
> Signed-off-by: Alex Mastro <amastro@fb.com>
> Assisted-by: Codex:gpt-5.5-high
> ---
>  include/uapi/linux/iommufd.h | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Applied thanks

Jason

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

end of thread, other threads:[~2026-06-12 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 20:44 [PATCH] iommufd: Clarify IOAS_MAP_FILE dma-buf support Alex Mastro
2026-06-12 13:11 ` Jason Gunthorpe

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

Powered by JetHome