[vfio-users] Question about DMA from user space buffers

Nikos Dragazis ndragazis at outlook.com.gr
Fri Nov 30 23:56:34 UTC 2018


Hi all,

I am trying to understand how vfio enables DMA from user space memory. I
would appreciate any help on this.

Suppose we have a system with x86 architecture and an IOMMU. When a user
space driver in that system wants to ask from a PCI device to perform
DMA from user space memory, it has to register that memory with
VFIO_IOMMU_MAP_DMA ioctl. What are the restrictions that this user space
memory has to meet? How are the DMA memory limitations met? Is this
totally arranged by vfio? Or is it a responsibility of the user space
process (eg. use hugepages)?

I had a conversation on the SPDK mailing list about this. SPDK is a
storage framework running entirely in user space and uses vfio to
control the PCI storage devices. This is the relevant email:
https://lists.01.org/pipermail/spdk/2018-November/002733.html

I am a little bit confused about the purpose of hugepages in SPDK and
whether they are related to vfio.

To summarize, I am trying to find the answer to the following questions:

Is there any constraint about the DMA memory buffers passed to vfio?
Is it possible to pass a buffer allocated with malloc?
Or is it necessary to use hugepages which by design serve all the DMA
memory limitations (pinned, non-swappable, physically contiguous)?

Thanks,
Nikos






More information about the vfio-users mailing list