[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f88707d4-bd04-4e9b-8d4b-ccb679d70dae@linux.intel.com>
Date: Tue, 2 Dec 2025 10:17:34 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jacob Pan <jacob.pan@...ux.microsoft.com>, linux-kernel@...r.kernel.org,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
Jason Gunthorpe <jgg@...dia.com>,
Alex Williamson <alex.williamson@...hat.com>, Joerg Roedel
<joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>, Nicolin Chen <nicolinc@...dia.com>,
"Tian, Kevin" <kevin.tian@...el.com>, "Liu, Yi L" <yi.l.liu@...el.com>
Cc: skhawaja@...gle.com, pasha.tatashin@...een.com,
Zhang Yu <zhangyu1@...ux.microsoft.com>,
Jean Philippe-Brucker <jean-philippe@...aro.org>,
David Matlack <dmatlack@...gle.com>
Subject: Re: [RFC 2/8] iommu: Add a helper to check if any iommu device is
registered
Hi Jacob,
On 12/2/25 01:30, Jacob Pan wrote:
> The dummy IOMMU driver for No-IOMMU mode should only be active when
> no real IOMMU devices are present in the system. Introduce a helper
> to check this condition, ensuring that the dummy driver does not
> interfere when hardware-backed IOMMU support is available.
>
> Signed-off-by: Jacob Pan<jacob.pan@...ux.microsoft.com>
> ---
> drivers/iommu/iommu.c | 10 ++++++++++
> include/linux/iommu.h | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 0df914a04064..958f612bf176 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2895,6 +2895,16 @@ static const struct iommu_device *iommu_from_fwnode(const struct fwnode_handle *
> return ret;
> }
>
> +bool iommu_is_registered(void)
> +{
> + bool registered;
> +
> + spin_lock(&iommu_device_lock);
> + registered = !list_empty(&iommu_device_list);
> + spin_unlock(&iommu_device_lock);
> + return registered;
> +}
IOMMU devices might be added by calling iommu_device_register() at any
time. Therefore, an empty iommu_device_list does not necessarily mean
that "no real IOMMU devices are present in the system."
Thanks,
baolu
Powered by blists - more mailing lists