From: Jacob Pan <jacob.pan@linux.microsoft.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Baolu Lu <baolu.lu@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
Alex Williamson <alex.williamson@redhat.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Nicolin Chen <nicolinc@nvidia.com>,
"Liu, Yi L" <yi.l.liu@intel.com>,
"skhawaja@google.com" <skhawaja@google.com>,
"pasha.tatashin@soleen.com" <pasha.tatashin@soleen.com>,
Zhang Yu <zhangyu1@linux.microsoft.com>,
Jean Philippe-Brucker <jean-philippe@linaro.org>,
David Matlack <dmatlack@google.com>,
"Alex Williamson" <alex@shazbot.org>
Subject: Re: [RFC 2/8] iommu: Add a helper to check if any iommu device is registered
Date: Fri, 12 Dec 2025 11:51:15 -0800 [thread overview]
Message-ID: <20251212115115.00003a38@linux.microsoft.com> (raw)
In-Reply-To: <BN9PR11MB5276DAAEF28EEE1CF3B9DD9B8CAEA@BN9PR11MB5276.namprd11.prod.outlook.com>
Hi Kevin,
On Fri, 12 Dec 2025 04:02:38 +0000
"Tian, Kevin" <kevin.tian@intel.com> wrote:
> > From: Jacob Pan <jacob.pan@linux.microsoft.com>
> > Sent: Friday, December 5, 2025 6:07 AM
> >
> > Hi Robin,
> >
> > On Thu, 4 Dec 2025 10:53:36 +0000
> > Robin Murphy <robin.murphy@arm.com> wrote:
> >
> > > On 2025-12-03 10:36 pm, Jacob Pan wrote:
> > > > Hi Jason,
> > > >
> > > > On Wed, 3 Dec 2025 09:11:29 -0400
> > > > Jason Gunthorpe <jgg@nvidia.com> wrote:
> > > >
> > > >> On Tue, Dec 02, 2025 at 04:06:35PM -0800, Jacob Pan wrote:
> > > >>> However, as you pointed out there seems to be no standard
> > > >>> ordering for iommu device registration across platforms. e.g.
> > > >>> VT-d hooks up with x86_init, smmuv3 does that in platform
> > > >>> driver probe. This patchset puts dummy driver under
> > > >>> early_initcall which is after both but not a guarantee for
> > > >>> all platforms. Any suggestions?
> > > >>
> > > >> I think we need to do something more like the sefltest does and
> > > >> manually bind a driver to a device so this init time ordering
> > > >> shouldn't matter.
> > > > I have moved this dummy iommu driver init under iommufd_init(),
> > > > which aligns well since it runs after all physical IOMMU drivers
> > > > have registered. This dummy driver is intended for iommufd after
> > > > all. But I don't see a need to bind to a platform device as the
> > > > selttest does.
> > >
> > > There is no "after all physical IOMMU drivers have registered",
> > > there is only "after we've given up waiting to see if one might
> > > be loaded as a module", but even that may be indefinite depending
> > > on build/runtime configuration.
> > OK, how about we make loading the dummy driver an explicit user
> > opt-in, the same way as
> > /sys/module/iommufd/parameters/allow_unsafe_interrupt?
>
> enable_unsafe_noiommu_mode plus cdev already implies that need?
yes, i guess you meant hook up with the existing vfio knob
/sys/module/vfio/parameters/enable_unsafe_noiommu_mode
>
> >
> > In addition, make sure once noiommu driver is loaded, no other iommu
> > device can be registered.
> >
>
> this is probably the simplest way, e.g. converting below into a helper
> to add that check:
>
> spin_lock(&iommu_device_lock);
> list_add_tail(&iommu->list, &iommu_device_list);
> spin_unlock(&iommu_device_lock);
>
> called by all iommu_device_register() variants.
>
> btw then you may need a new iommu_device_register_noiommu()
> as iommufd selftest has no such exclusiveness requirement.
>
Yes, looks cleaner this way. iommu_device_register_noiommu() would just
fail if any other iommu devices have registered. There is no need for a
separate helper or check.
> or have a per-bus-type record to ensure each type can be only
> probed by a single driver?
That seems to be a broader change. I think it would work too. Let me
give that a try.
AFAIK, noiommu mode is only tied to PCI (due to vfio). I assume things
will stay this way.
next prev parent reply other threads:[~2025-12-12 19:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 17:30 [RFC 0/8] iommufd: Enable noiommu mode for cdev Jacob Pan
2025-12-01 17:30 ` [RFC 1/8] iommu: Make iommu_device_register_bus available beyond selftest Jacob Pan
2025-12-01 17:30 ` [RFC 2/8] iommu: Add a helper to check if any iommu device is registered Jacob Pan
2025-12-02 2:17 ` Baolu Lu
2025-12-03 0:06 ` Jacob Pan
2025-12-03 3:31 ` Baolu Lu
2025-12-03 22:28 ` Jacob Pan
2025-12-03 13:11 ` Jason Gunthorpe
2025-12-03 22:36 ` Jacob Pan
2025-12-04 10:53 ` Robin Murphy
2025-12-04 22:07 ` Jacob Pan
2025-12-12 4:02 ` Tian, Kevin
2025-12-12 19:51 ` Jacob Pan [this message]
2025-12-01 17:30 ` [RFC 3/8] iommufd: Add a mock page table format for noiommu mode Jacob Pan
2025-12-01 17:30 ` [RFC 4/8] iommu: Add a dummy driver " Jacob Pan
2025-12-01 17:30 ` [RFC 5/8] vfio: IOMMUFD relax requirement " Jacob Pan
2025-12-12 4:05 ` Tian, Kevin
2025-12-12 19:53 ` Jacob Pan
2025-12-01 17:30 ` [RFC 6/8] vfio: Rename and remove compat from noiommu set function Jacob Pan
2025-12-01 17:30 ` [RFC 7/8] iommu: Enable cdev noiommu mode under iommufd Jacob Pan
2025-12-01 17:30 ` [RFC 8/8] iommufd: Add an ioctl IOMMU_IOAS_GET_PA to query PA from IOVA Jacob Pan
2026-01-30 19:35 ` [RFC 0/8] iommufd: Enable noiommu mode for cdev Jason Gunthorpe
2026-02-06 22:50 ` 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=20251212115115.00003a38@linux.microsoft.com \
--to=jacob.pan@linux.microsoft.com \
--cc=alex.williamson@redhat.com \
--cc=alex@shazbot.org \
--cc=baolu.lu@linux.intel.com \
--cc=dmatlack@google.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--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=will@kernel.org \
--cc=yi.l.liu@intel.com \
--cc=zhangyu1@linux.microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.