From: Yi Liu <yi.l.liu@intel.com>
To: Jacob Pan <jacob.pan@linux.microsoft.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>,
Saurabh Sengar <ssengar@linux.microsoft.com>,
<skhawaja@google.com>, <pasha.tatashin@soleen.com>,
Will Deacon <will@kernel.org>,
Baolu Lu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH v5 4/9] iommufd: Allow binding to a noiommu device
Date: Thu, 21 May 2026 11:27:51 +0800 [thread overview]
Message-ID: <7d276cc9-8fd7-4d47-af90-82cef79a89c9@intel.com> (raw)
In-Reply-To: <20260520085459.000067ac@linux.microsoft.com>
On 5/20/26 23:54, Jacob Pan wrote:
> Hi Yi,
>
> On Wed, 20 May 2026 15:20:06 +0800
> Yi Liu <yi.l.liu@intel.com> wrote:
>
>> On 5/12/26 02:41, Jacob Pan wrote:
>>> From: Jason Gunthorpe <jgg@nvidia.com>
>>>
>>> Allow iommufd to bind devices without an IOMMU (noiommu mode) by
>>> creating a dummy IOMMU group for such devices and skipping hwpt
>>> operations.
>>>
>>> This enables noiommu devices to operate through the same iommufd
>>> API as IOMMU- capable devices.
>>>
>>> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
>>> Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
>>> ---
>>> v5:
>>> - simplify logic and rename iommufd_device_is_noiommu (Kevin,
>>> Yi)
>>> - use a helper iommufd_bind_noiommu instead of open coding
>>> (Kevin)
>>> - move IOMMU cap check under iommufd_bind_iommu() (Yi)
>>> - reword comments for partial init (Yi)
>>> - misc minor clean up
>>> v4:
>>> - Update the description of the module parameter (Alex)
>>> v3:
>>> - Consolidate into fewer patches
>>> ---
>>> drivers/iommu/iommufd/device.c | 148
>>> ++++++++++++++++++++++++--------- 1 file changed, 109
>>> insertions(+), 39 deletions(-)
>>>
>>> diff --git a/drivers/iommu/iommufd/device.c
>>> b/drivers/iommu/iommufd/device.c index d03076fcf3c2..4d75720432cc
>>> 100644 --- a/drivers/iommu/iommufd/device.c
>>> +++ b/drivers/iommu/iommufd/device.c
>>> @@ -23,6 +23,16 @@ struct iommufd_attach {
>>> struct xarray device_array;
>>> };
>>>
>>> +/*
>>> + * A noiommu device has no IOMMU driver attached regardless of
>>> whether it
>>> + * enters via the cdev path (no iommu_group) or the group path
>>> (fake
>>> + * noiommu iommu_group). In both cases dev->iommu is NULL.
>>
>> Are you trying to identify the case where both group and cdev
>> interfaces coexist? In such a scenario, the group path creates a fake
>> iommu group while the cdev path creates a dummy igroup. Both
>> operations need to be performed, but checking iommu_group might
>> interfere with the cdev noiommu path logic.
>>
>> Is that why you're checking idev->dev->iommu here instead? If so,
>> could you please make this rationale more explicit in the comment?
>>
>> At first glance, the comment is quite confusing. It's unclear why a
>> cdev-path-only helper function needs to reference the group path at
>> all. The last sentence in particular seems to suggest this helper
>> covers both paths, which adds to the confusion.
>>
> Yes, Baolu also commented on this asking why not use
> device_iommu_mapped. I will update the comment as follows:
> /*
> - * A noiommu device has no IOMMU driver attached regardless of whether
> it
> - * enters via the cdev path (no iommu_group) or the group path (fake
> - * noiommu iommu_group). In both cases dev->iommu is NULL.
> + * Detect a noiommu device for the cdev path. We check dev->iommu
> rather than
> + * using device_iommu_mapped() (which checks dev->iommu_group) because
> when
> + * both group and cdev interfaces coexist, the group path assigns a
> fake
> + * noiommu iommu_group to the device. That would cause
> device_iommu_mapped()
> + * to return true and hide the noiommu case from the cdev path.
> dev->iommu is
> + * reliably NULL when no IOMMU driver is managing the device.
> */
> static bool iommufd_device_is_noiommu(struct iommufd_device *idev)
> {
>
this is clear to me now. I was just confused by the comment. And then
realized what you really mean.
next prev parent reply other threads:[~2026-05-21 3:19 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 18:41 [PATCH v5 0/9] iommufd: Enable noiommu mode for cdev Jacob Pan
2026-05-11 18:41 ` [PATCH v5 1/9] vfio: Rename VFIO_NOIOMMU to VFIO_GROUP_NOIOMMU Jacob Pan
2026-05-19 23:34 ` Jason Gunthorpe
2026-05-11 18:41 ` [PATCH v5 2/9] iommufd: Support a HWPT without an iommu driver for noiommu Jacob Pan
2026-05-13 6:58 ` Baolu Lu
2026-05-13 21:30 ` Jacob Pan
2026-05-13 19:18 ` Samiullah Khawaja
2026-05-20 7:19 ` Yi Liu
2026-05-20 16:15 ` Jacob Pan
2026-05-11 18:41 ` [PATCH v5 3/9] iommufd: Move igroup allocation to a function Jacob Pan
2026-05-13 7:18 ` Baolu Lu
2026-05-11 18:41 ` [PATCH v5 4/9] iommufd: Allow binding to a noiommu device Jacob Pan
2026-05-13 7:37 ` Baolu Lu
2026-05-13 22:08 ` Jacob Pan
2026-05-14 6:51 ` Baolu Lu
2026-05-19 21:25 ` Jacob Pan
2026-05-20 7:20 ` Yi Liu
2026-05-20 15:54 ` Jacob Pan
2026-05-21 3:27 ` Yi Liu [this message]
2026-05-11 18:41 ` [PATCH v5 5/9] iommufd: Add an ioctl to query PA from IOVA for noiommu mode Jacob Pan
2026-05-11 18:58 ` Jacob Pan
2026-05-13 7:53 ` Baolu Lu
2026-05-13 12:22 ` Jason Gunthorpe
2026-05-13 22:20 ` Jacob Pan
2026-05-13 23:26 ` Jason Gunthorpe
2026-05-20 7:20 ` Yi Liu
2026-05-20 7:31 ` Yi Liu
2026-05-20 14:22 ` Jason Gunthorpe
2026-05-20 14:39 ` Yi Liu
2026-05-20 17:02 ` Jacob Pan
2026-05-11 18:41 ` [PATCH v5 6/9] vfio/group: Add VFIO_CDEV_NOIOMMU Kconfig and tolerate NULL group Jacob Pan
2026-05-20 3:45 ` Alex Williamson
2026-05-20 17:08 ` Jacob Pan
2026-05-11 18:41 ` [PATCH v5 7/9] vfio: Enable cdev noiommu mode under iommufd Jacob Pan
2026-05-19 23:40 ` Jason Gunthorpe
2026-05-20 2:56 ` Jacob Pan
2026-05-20 3:46 ` Alex Williamson
2026-05-20 7:20 ` Yi Liu
2026-05-20 18:15 ` Jacob Pan
2026-05-21 3:25 ` Yi Liu
2026-05-21 16:49 ` Jacob Pan
2026-05-11 18:41 ` [PATCH v5 8/9] selftests/vfio: Add iommufd noiommu mode selftest for cdev Jacob Pan
2026-05-11 18:41 ` [PATCH v5 9/9] Documentation: Update VFIO NOIOMMU mode Jacob Pan
2026-05-20 7:20 ` Yi Liu
2026-05-20 16:26 ` Jacob Pan
2026-05-21 3:24 ` Yi Liu
2026-05-19 18:01 ` [PATCH v5 0/9] iommufd: Enable noiommu mode for cdev Jason Gunthorpe
2026-05-19 21:03 ` Jacob Pan
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=7d276cc9-8fd7-4d47-af90-82cef79a89c9@intel.com \
--to=yi.l.liu@intel.com \
--cc=alex@shazbot.org \
--cc=baolu.lu@linux.intel.com \
--cc=dmatlack@google.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.pan@linux.microsoft.com \
--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=ssengar@linux.microsoft.com \
--cc=will@kernel.org \
/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
Powered by JetHome