[PATCH V2 11/11] Doc: Update VFIO NOIOMMU mode

Jacob Pan posted 11 patches 3 weeks, 4 days ago
[PATCH V2 11/11] Doc: Update VFIO NOIOMMU mode
Posted by Jacob Pan 3 weeks, 4 days ago
Document the NOIOMMU mode with newly added cdev support under iommufd.

Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
---
 Documentation/driver-api/vfio.rst | 44 +++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/Documentation/driver-api/vfio.rst b/Documentation/driver-api/vfio.rst
index 2a21a42c9386..d1ee13dc6e98 100644
--- a/Documentation/driver-api/vfio.rst
+++ b/Documentation/driver-api/vfio.rst
@@ -275,8 +275,6 @@ in a VFIO group.
 With CONFIG_VFIO_DEVICE_CDEV=y the user can now acquire a device fd
 by directly opening a character device /dev/vfio/devices/vfioX where
 "X" is the number allocated uniquely by VFIO for registered devices.
-cdev interface does not support noiommu devices, so user should use
-the legacy group interface if noiommu is wanted.
 
 The cdev only works with IOMMUFD.  Both VFIO drivers and applications
 must adapt to the new cdev security model which requires using
@@ -370,6 +368,48 @@ IOMMUFD IOAS/HWPT to enable userspace DMA::
 
 	/* Other device operations as stated in "VFIO Usage Example" */
 
+VFIO NOIOMMU mode
+-------------------------------------------------------------------------------
+VFIO also supports a no-IOMMU mode, intended for usages where unsafe DMA can
+be performed by userspace drivers w/o physical IOMMU protection. This mode
+is controlled by the parameter:
+
+/sys/module/vfio/parameters/enable_unsafe_noiommu_mode
+
+Upon enabling this mode, with an assigned device, the user will be presented
+with a VFIO group and device file, e.g.
+
+/dev/vfio/
+|-- devices
+|   `-- noiommu-vfio0	/* VFIO device cdev */
+|-- noiommu-0		/* VFIO group */
+`-- vfio
+
+The capabilities vary depending on the device programming interface and kernel
+configuration used. The following table summarizes the differences:
+
++-------------------+---------------------+---------------------+
+| Feature           | VFIO group          | VFIO device cdev   |
++===================+=====================+=====================+
+| VFIO device UAPI  | Yes                 | Yes                |
++-------------------+---------------------+---------------------+
+| VFIO container    | No                  | No                 |
++-------------------+---------------------+---------------------+
+| IOMMUFD IOAS      | No                  | Yes*               |
++-------------------+---------------------+---------------------+
+Note that the VFIO container case includes IOMMUFD provided VFIO compatibility
+interfaces when either CONFIG_VFIO_CONTAINER or CONFIG_IOMMUFD_VFIO_CONTAINER is
+enabled.
+
+* IOMMUFD UAPI is available for VFIO device cdev to pin and map user memory with
+the ability to retrieve physical addresses for DMA command submission.
+
+A new IOMMUFD ioctl IOMMU_IOAS_GET_PA is added to retrieve the physical address
+for a given user virtual address. Note that IOMMU_IOAS_MAP_FIXED_IOVA flag is
+ignored in no-IOMMU mode since there is no physical DMA remapping hardware.
+tools/testing/selftests/vfio/vfio_iommufd_noiommu_test.c provides an example of
+using this ioctl in no-IOMMU mode.
+
 VFIO User API
 -------------------------------------------------------------------------------
 
-- 
2.34.1
Re: [PATCH V2 11/11] Doc: Update VFIO NOIOMMU mode
Posted by kernel test robot 3 weeks, 3 days ago
Hi Jacob,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20260313]
[cannot apply to awilliam-vfio/next awilliam-vfio/for-linus v6.16-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jacob-Pan/iommufd-Support-a-HWPT-without-an-iommu-driver-for-noiommu/20260313-182818
base:   linus/master
patch link:    https://lore.kernel.org/r/20260312155637.376854-12-jacob.pan%40linux.microsoft.com
patch subject: [PATCH V2 11/11] Doc: Update VFIO NOIOMMU mode
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux)
reproduce: (https://download.01.org/0day-ci/archive/20260313/202603131832.GiQt3WWE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603131832.GiQt3WWE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   Ring Design
   ----------- [docutils]
   WARNING: ./include/linux/usb/typec_altmode.h:44 struct member 'priority' not described in 'typec_altmode'
   WARNING: ./include/linux/usb/typec_altmode.h:44 struct member 'mode_selection' not described in 'typec_altmode'
>> Documentation/driver-api/vfio.rst:382: WARNING: Inline substitution_reference start-string without end-string. [docutils]
>> Documentation/driver-api/vfio.rst:382: WARNING: Inline interpreted text or phrase reference start-string without end-string. [docutils]
>> Documentation/driver-api/vfio.rst:382: WARNING: Inline emphasis start-string without end-string. [docutils]
>> Documentation/driver-api/vfio.rst:382: WARNING: Inline interpreted text or phrase reference start-string without end-string. [docutils]
   Documentation/driver-api/vfio.rst:392: ERROR: Malformed table.
   Right border not aligned or missing.
--
   +-------------------+---------------------+---------------------+
   | VFIO container    | No                  | No                 |
   +-------------------+---------------------+---------------------+
   | IOMMUFD IOAS      | No                  | Yes*               |
   +-------------------+---------------------+---------------------+ [docutils]
>> Documentation/driver-api/vfio.rst:400: WARNING: Blank line required after table. [docutils]
>> Documentation/driver-api/vfio.rst:405: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils]
   WARNING: ./include/linux/virtio.h:188 struct member 'map' not described in 'virtio_device'
   WARNING: ./include/linux/virtio.h:188 struct member 'VIRTIO_DECLARE_FEATURES(features' not described in 'virtio_device'
   WARNING: ./include/linux/virtio.h:188 struct member 'vmap' not described in 'virtio_device'
   Documentation/gpu/amdgpu/display/display-manager:47: ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c:61: ERROR: Unexpected section title.


vim +382 Documentation/driver-api/vfio.rst

   381	
 > 382	/dev/vfio/
   383	|-- devices
   384	|   `-- noiommu-vfio0	/* VFIO device cdev */
   385	|-- noiommu-0		/* VFIO group */
   386	`-- vfio
   387	
   388	The capabilities vary depending on the device programming interface and kernel
   389	configuration used. The following table summarizes the differences:
   390	
   391	+-------------------+---------------------+---------------------+
   392	| Feature           | VFIO group          | VFIO device cdev   |
   393	+===================+=====================+=====================+
   394	| VFIO device UAPI  | Yes                 | Yes                |
   395	+-------------------+---------------------+---------------------+
   396	| VFIO container    | No                  | No                 |
   397	+-------------------+---------------------+---------------------+
   398	| IOMMUFD IOAS      | No                  | Yes*               |
   399	+-------------------+---------------------+---------------------+
 > 400	Note that the VFIO container case includes IOMMUFD provided VFIO compatibility
   401	interfaces when either CONFIG_VFIO_CONTAINER or CONFIG_IOMMUFD_VFIO_CONTAINER is
   402	enabled.
   403	
   404	* IOMMUFD UAPI is available for VFIO device cdev to pin and map user memory with
 > 405	the ability to retrieve physical addresses for DMA command submission.
   406	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki