Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: userspace-api: iommufd: Update vDEVICE

With the introduction of the new object and its infrastructure, update the
doc and the vIOMMU graph to reflect that.

Link: https://patch.msgid.link/r/e1ff278b7163909b2641ae04ff364bb41d2a2a2e.1730836308.git.nicolinc@nvidia.com
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Nicolin Chen and committed by
Jason Gunthorpe
b047c064 49ad1277

+32 -9
+32 -9
Documentation/userspace-api/iommufd.rst
··· 96 96 backed by corresponding vIOMMU objects, in which case a guest OS would do 97 97 the "dispatch" naturally instead of VMM trappings. 98 98 99 + - IOMMUFD_OBJ_VDEVICE, representing a virtual device for an IOMMUFD_OBJ_DEVICE 100 + against an IOMMUFD_OBJ_VIOMMU. This virtual device holds the device's virtual 101 + information or attributes (related to the vIOMMU) in a VM. An immediate vDATA 102 + example can be the virtual ID of the device on a vIOMMU, which is a unique ID 103 + that VMM assigns to the device for a translation channel/port of the vIOMMU, 104 + e.g. vSID of ARM SMMUv3, vDeviceID of AMD IOMMU, and vRID of Intel VT-d to a 105 + Context Table. Potential use cases of some advanced security information can 106 + be forwarded via this object too, such as security level or realm information 107 + in a Confidential Compute Architecture. A VMM should create a vDEVICE object 108 + to forward all the device information in a VM, when it connects a device to a 109 + vIOMMU, which is a separate ioctl call from attaching the same device to an 110 + HWPT_PAGING that the vIOMMU holds. 111 + 99 112 All user-visible objects are destroyed via the IOMMU_DESTROY uAPI. 100 113 101 114 The diagrams below show relationships between user-visible objects and kernel ··· 148 135 |____________| |____________| |______| 149 136 150 137 _______________________________________________________________________ 151 - | iommufd (with vIOMMU) | 138 + | iommufd (with vIOMMU/vDEVICE) | 152 139 | | 153 - | [5] | 154 - | _____________ | 155 - | | | | 156 - | |----------------| vIOMMU | | 157 - | | | | | 158 - | | | | | 159 - | | [1] | | [4] [2] | 160 - | | ______ | | _____________ ________ | 140 + | [5] [6] | 141 + | _____________ _____________ | 142 + | | | | | | 143 + | |----------------| vIOMMU |<---| vDEVICE |<----| | 144 + | | | | |_____________| | | 145 + | | | | | | 146 + | | [1] | | [4] | [2] | 147 + | | ______ | | _____________ _|______ | 161 148 | | | | | [3] | | | | | | 162 149 | | | IOAS |<---|(HWPT_PAGING)|<---| HWPT_NESTED |<--| DEVICE | | 163 150 | | |______| |_____________| |_____________| |________| | ··· 230 217 the vIOMMU object and the HWPT_PAGING, then this vIOMMU object can be used 231 218 as a nesting parent object to allocate an HWPT_NESTED object described above. 232 219 220 + 6. IOMMUFD_OBJ_VDEVICE can be only manually created via the IOMMU_VDEVICE_ALLOC 221 + uAPI, provided a viommu_id for an iommufd_viommu object and a dev_id for an 222 + iommufd_device object. The vDEVICE object will be the binding between these 223 + two parent objects. Another @virt_id will be also set via the uAPI providing 224 + the iommufd core an index to store the vDEVICE object to a vDEVICE array per 225 + vIOMMU. If necessary, the IOMMU driver may choose to implement a vdevce_alloc 226 + op to init its HW for virtualization feature related to a vDEVICE. Successful 227 + completion of this operation sets up the linkages between vIOMMU and device. 228 + 233 229 A device can only bind to an iommufd due to DMA ownership claim and attach to at 234 230 most one IOAS object (no support of PASID yet). 235 231 ··· 252 230 - iommufd_hwpt_paging for IOMMUFD_OBJ_HWPT_PAGING. 253 231 - iommufd_hwpt_nested for IOMMUFD_OBJ_HWPT_NESTED. 254 232 - iommufd_viommu for IOMMUFD_OBJ_VIOMMU. 233 + - iommufd_vdevice for IOMMUFD_OBJ_VDEVICE. 255 234 256 235 Several terminologies when looking at these datastructures: 257 236