diff mbox series

[v3,16/23] Documentation: userspace-api: iommufd: Update vQUEUE

Message ID 0beddeaaa4a8a7a45ce93ff21c543ae58be64908.1746139811.git.nicolinc@nvidia.com
State New
Headers show
Series iommufd: Add vIOMMU infrastructure (Part-4 vQUEUE) | expand

Commit Message

Nicolin Chen May 1, 2025, 11:01 p.m. UTC
With the introduction of the new object and its infrastructure, update the
doc to reflect that.

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 Documentation/userspace-api/iommufd.rst | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Bagas Sanjaya May 2, 2025, 3:50 a.m. UTC | #1
On Thu, May 01, 2025 at 04:01:22PM -0700, Nicolin Chen wrote:
> +- IOMMUFD_OBJ_VQUEUE, representing a hardware accelerated virtual queue, as a
> +  subset of IOMMU's virtualization features, for the IOMMU HW to directly read
> +  or write the virtual queue memory owned by a guest OS. This HW-acceleration
> +  allows VM to work with the IOMMU HW directly without a VM Exit, i.e. reducing
> +  overhead from the hypercalls. Along with this vQUEUE object, iommufd provides
> +  user space an mmap interface for VMM to mmap a physical MMIO region from the
> +  host physical address space to the guest physical address space, allowing the
> +  guest OS to control the allocated vQUEUE HW. Thus, when allocating a vQUEUE,
> +  the VMM must request a pair of VMA info (vm_pgoff/size) for an mmap syscall.
> +  The length argument of an mmap syscall can be smaller than the given size for
> +  a partial mmap, but the addr argument of the mmap syscall should never offset
> +  from the returned vm_pgoff, which implies that an mmap will always start from

Did you mean never be offset from returned vm_pgoff?

> +  the beginning of the physical MMIO region.
> +

Confused...
Nicolin Chen May 2, 2025, 5:29 a.m. UTC | #2
On Fri, May 02, 2025 at 10:50:07AM +0700, Bagas Sanjaya wrote:
> On Thu, May 01, 2025 at 04:01:22PM -0700, Nicolin Chen wrote:
> > +- IOMMUFD_OBJ_VQUEUE, representing a hardware accelerated virtual queue, as a
> > +  subset of IOMMU's virtualization features, for the IOMMU HW to directly read
> > +  or write the virtual queue memory owned by a guest OS. This HW-acceleration
> > +  allows VM to work with the IOMMU HW directly without a VM Exit, i.e. reducing
> > +  overhead from the hypercalls. Along with this vQUEUE object, iommufd provides
> > +  user space an mmap interface for VMM to mmap a physical MMIO region from the
> > +  host physical address space to the guest physical address space, allowing the
> > +  guest OS to control the allocated vQUEUE HW. Thus, when allocating a vQUEUE,
> > +  the VMM must request a pair of VMA info (vm_pgoff/size) for an mmap syscall.
> > +  The length argument of an mmap syscall can be smaller than the given size for
> > +  a partial mmap, but the addr argument of the mmap syscall should never offset
> > +  from the returned vm_pgoff, which implies that an mmap will always start from
> 
> Did you mean never be offset from returned vm_pgoff?

Yes. Will fix this.

> > +  the beginning of the physical MMIO region.
> > +
> 
> Confused...

Meaning that VMM should just use the given vm_pgoff as is, without
adding any offset to the vm_pgoff.

Thanks
Nicolin
Bagas Sanjaya May 2, 2025, 7:31 a.m. UTC | #3
On Thu, May 01, 2025 at 10:29:58PM -0700, Nicolin Chen wrote:
> On Fri, May 02, 2025 at 10:50:07AM +0700, Bagas Sanjaya wrote:
> > On Thu, May 01, 2025 at 04:01:22PM -0700, Nicolin Chen wrote:
> > > +- IOMMUFD_OBJ_VQUEUE, representing a hardware accelerated virtual queue, as a
> > > +  subset of IOMMU's virtualization features, for the IOMMU HW to directly read
> > > +  or write the virtual queue memory owned by a guest OS. This HW-acceleration
> > > +  allows VM to work with the IOMMU HW directly without a VM Exit, i.e. reducing
> > > +  overhead from the hypercalls. Along with this vQUEUE object, iommufd provides
> > > +  user space an mmap interface for VMM to mmap a physical MMIO region from the
> > > +  host physical address space to the guest physical address space, allowing the
> > > +  guest OS to control the allocated vQUEUE HW. Thus, when allocating a vQUEUE,
> > > +  the VMM must request a pair of VMA info (vm_pgoff/size) for an mmap syscall.
> > > +  The length argument of an mmap syscall can be smaller than the given size for
> > > +  a partial mmap, but the addr argument of the mmap syscall should never offset
> > > +  from the returned vm_pgoff, which implies that an mmap will always start from
> > 
> > Did you mean never be offset from returned vm_pgoff?
> 
> Yes. Will fix this.
> 
> > > +  the beginning of the physical MMIO region.
> > > +
> > 
> > Confused...
> 
> Meaning that VMM should just use the given vm_pgoff as is, without
> adding any offset to the vm_pgoff.

Understood, thanks!
diff mbox series

Patch

diff --git a/Documentation/userspace-api/iommufd.rst b/Documentation/userspace-api/iommufd.rst
index b0df15865dec..ed32713a97a3 100644
--- a/Documentation/userspace-api/iommufd.rst
+++ b/Documentation/userspace-api/iommufd.rst
@@ -124,6 +124,20 @@  Following IOMMUFD objects are exposed to userspace:
   used to allocate a vEVENTQ. Each vIOMMU can support multiple types of vEVENTS,
   but is confined to one vEVENTQ per vEVENTQ type.
 
+- IOMMUFD_OBJ_VQUEUE, representing a hardware accelerated virtual queue, as a
+  subset of IOMMU's virtualization features, for the IOMMU HW to directly read
+  or write the virtual queue memory owned by a guest OS. This HW-acceleration
+  allows VM to work with the IOMMU HW directly without a VM Exit, i.e. reducing
+  overhead from the hypercalls. Along with this vQUEUE object, iommufd provides
+  user space an mmap interface for VMM to mmap a physical MMIO region from the
+  host physical address space to the guest physical address space, allowing the
+  guest OS to control the allocated vQUEUE HW. Thus, when allocating a vQUEUE,
+  the VMM must request a pair of VMA info (vm_pgoff/size) for an mmap syscall.
+  The length argument of an mmap syscall can be smaller than the given size for
+  a partial mmap, but the addr argument of the mmap syscall should never offset
+  from the returned vm_pgoff, which implies that an mmap will always start from
+  the beginning of the physical MMIO region.
+
 All user-visible objects are destroyed via the IOMMU_DESTROY uAPI.
 
 The diagrams below show relationships between user-visible objects and kernel
@@ -270,6 +284,7 @@  User visible objects are backed by following datastructures:
 - iommufd_viommu for IOMMUFD_OBJ_VIOMMU.
 - iommufd_vdevice for IOMMUFD_OBJ_VDEVICE.
 - iommufd_veventq for IOMMUFD_OBJ_VEVENTQ.
+- iommufd_vqueue for IOMMUFD_OBJ_VQUEUE.
 
 Several terminologies when looking at these datastructures: