From: Jacob Pan <jacob.pan@linux.microsoft.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: <linux-kernel@vger.kernel.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
Jason Gunthorpe <jgg@nvidia.com>,
Alex Williamson <alex@shazbot.org>,
Joerg Roedel <joro@8bytes.org>,
Mostafa Saleh <smostafa@google.com>,
David Matlack <dmatlack@google.com>,
Robin Murphy <robin.murphy@arm.com>,
Nicolin Chen <nicolinc@nvidia.com>,
"Tian, Kevin" <kevin.tian@intel.com>, <skhawaja@google.com>,
<pasha.tatashin@soleen.com>, Will Deacon <will@kernel.org>,
Baolu Lu <baolu.lu@linux.intel.com>,
jacob.pan@linux.microsoft.com
Subject: Re: [PATCH V4 10/10] Documentation: Update VFIO NOIOMMU mode
Date: Thu, 30 Apr 2026 16:41:01 -0700 [thread overview]
Message-ID: <20260430164101.000039c8@linux.microsoft.com> (raw)
In-Reply-To: <b82b7f9e-befe-4a45-b242-6d6df0e70bd4@intel.com>
Hi Yi,
On Tue, 28 Apr 2026 15:46:02 +0800
Yi Liu <yi.l.liu@intel.com> wrote:
> On 4/15/26 05:14, Jacob Pan wrote:
> > Document the NOIOMMU mode with newly added cdev support under
> > iommufd.
> >
> > Cc: Jonathan Corbet <corbet@lwn.net>
> > Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
> > ---
> > Documentation/driver-api/vfio.rst | 45
> > +++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2
> > deletions(-)
> >
> > diff --git a/Documentation/driver-api/vfio.rst
> > b/Documentation/driver-api/vfio.rst index
> > 2a21a42c9386..da6f77414c3b 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,49 @@ 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.
>
> not quite get this. Does it mean the the iova field is not used when
> invoking IOMMU_IOAS_MAP ioctl? Hence the iova will be allocated by
> iommufd and returned to userspace? Also, how does kernel know it
> should ignore IOMMU_IOAS_MAP_FIXED_IOVA flag?
>
Good question. Let me clarify — I should reword this in the cover letter.
The IOMMU_IOAS_MAP_FIXED_IOVA flag is NOT silently ignored by the kernel.
Userspace can still pass it as with normal IOMMU mode, otherwise
IOPT_ALLOC_IOVA kicks in and IOMMUFD allocates an IOVA from the allowed
range.
What I meant is that in no-IOMMU mode, the IOVA itself has no physical
significance — there is no DMA remapping hardware programming the
IOVA→PA translation. The IOVA is simply used as a key in the software
IO page table (IOMMU_PT_AMDV1 backed) to track the pinned pages and
their physical addresses.
So from the userspace API perspective, the flow is identical:
1. IOMMU_IOAS_MAP with FIXED_IOVA flag and user VA → pins pages,
stores PA in the SW page table at the given IOVA
2. IOMMU_IOAS_GET_PA with that IOVA → returns the physical address
for DMA command submission
The kernel doesn't need special logic to "know" it should ignore
anything — the same iopt_map code path runs; it's just that the
backing domain is iommufd_noiommu_ops (a software page table) rather
than a hardware IOMMU domain.
The user is assumed to know how to use the special IOVA as the unsafe
noiommu mode is enabled by the user.
I'll fix the misleading wording in the next version.
prev parent reply other threads:[~2026-04-30 23:41 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 21:14 [PATCH V4 00/10] iommufd: Enable noiommu mode for cdev Jacob Pan
2026-04-14 21:14 ` [PATCH V4 01/10] iommufd: Support a HWPT without an iommu driver for noiommu Jacob Pan
2026-04-16 7:25 ` Tian, Kevin
2026-04-17 21:59 ` Jacob Pan
2026-04-22 8:12 ` Tian, Kevin
2026-04-22 16:03 ` Jason Gunthorpe
2026-04-23 7:26 ` Tian, Kevin
2026-04-23 14:51 ` Jason Gunthorpe
2026-04-24 6:31 ` Tian, Kevin
2026-04-28 7:45 ` Yi Liu
2026-04-28 16:42 ` Jacob Pan
2026-04-14 21:14 ` [PATCH V4 02/10] iommufd: Move igroup allocation to a function Jacob Pan
2026-04-16 7:48 ` Tian, Kevin
2026-04-28 7:45 ` Yi Liu
2026-04-14 21:14 ` [PATCH V4 03/10] iommufd: Allow binding to a noiommu device Jacob Pan
2026-04-16 7:56 ` Tian, Kevin
2026-04-28 7:45 ` Yi Liu
2026-04-14 21:14 ` [PATCH V4 04/10] iommufd: Add an ioctl IOMMU_IOAS_GET_PA to query PA from IOVA Jacob Pan
2026-04-16 8:02 ` Tian, Kevin
2026-05-04 23:03 ` Jacob Pan
2026-04-16 19:32 ` Alex Williamson
2026-05-04 22:30 ` Jacob Pan
2026-04-14 21:14 ` [PATCH V4 05/10] vfio: Allow null group for noiommu without containers Jacob Pan
2026-04-16 8:13 ` Tian, Kevin
2026-04-16 21:33 ` Jacob Pan
2026-04-16 20:06 ` Alex Williamson
2026-04-17 17:06 ` Jacob Pan
2026-04-17 23:04 ` Alex Williamson
2026-04-14 21:14 ` [PATCH V4 06/10] vfio: Introduce and set noiommu flag on vfio_device Jacob Pan
2026-04-14 21:14 ` [PATCH V4 07/10] vfio: Enable cdev noiommu mode under iommufd Jacob Pan
2026-04-16 20:49 ` Alex Williamson
2026-04-30 23:31 ` Jacob Pan
2026-04-14 21:14 ` [PATCH V4 08/10] vfio:selftest: Handle VFIO noiommu cdev Jacob Pan
2026-04-14 21:14 ` [PATCH V4 09/10] selftests/vfio: Add iommufd noiommu mode selftest for cdev Jacob Pan
2026-04-14 21:14 ` [PATCH V4 10/10] Documentation: Update VFIO NOIOMMU mode Jacob Pan
2026-04-28 7:46 ` Yi Liu
2026-04-30 23:41 ` Jacob Pan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260430164101.000039c8@linux.microsoft.com \
--to=jacob.pan@linux.microsoft.com \
--cc=alex@shazbot.org \
--cc=baolu.lu@linux.intel.com \
--cc=dmatlack@google.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=pasha.tatashin@soleen.com \
--cc=robin.murphy@arm.com \
--cc=skhawaja@google.com \
--cc=smostafa@google.com \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox