linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use right iommu_ops for mock device
@ 2024-01-26 10:53 Lu Baolu
  2024-01-26 10:53 ` [PATCH v2 1/2] iommu: Use mutex instead of spinlock for iommu_device_list Lu Baolu
  2024-01-26 10:53 ` [PATCH v2 2/2] iommu: Probe right iommu_ops for device Lu Baolu
  0 siblings, 2 replies; 8+ messages in thread
From: Lu Baolu @ 2024-01-26 10:53 UTC (permalink / raw)
  To: Jason Gunthorpe, Kevin Tian, Joerg Roedel, Will Deacon, Robin Murphy
  Cc: iommu, linux-kernel, Lu Baolu

In the iommu probe device path, __iommu_probe_device() gets the iommu_ops
for the device from dev->iommu->fwspec if this field has been initialized
before probing. Otherwise, it will lookup the global iommu device list
and use the iommu_ops of the first iommu device which has no
dev->iommu->fwspec. This causes the wrong iommu_ops to be used for the mock
device on x86 platforms where dev->iommu->fwspec is not used.

Probe the right iommu_ops for device by iterating over all the global
drivers and calling their probe function to find a match.

Change log:
v2:
 - Iterate over all the global iommu drivers and calling their probe
   function to find a match.

v1: https://lore.kernel.org/linux-iommu/20240111073213.180020-1-baolu.lu@linux.intel.com/

Lu Baolu (2):
  iommu: Use mutex instead of spinlock for iommu_device_list
  iommu: Probe right iommu_ops for device

 drivers/iommu/iommu.c | 98 ++++++++++++++++++++++++++-----------------
 1 file changed, 59 insertions(+), 39 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-29 15:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 10:53 [PATCH v2 0/2] Use right iommu_ops for mock device Lu Baolu
2024-01-26 10:53 ` [PATCH v2 1/2] iommu: Use mutex instead of spinlock for iommu_device_list Lu Baolu
2024-01-29  8:04   ` Tian, Kevin
2024-01-29 14:57     ` Jason Gunthorpe
2024-01-26 10:53 ` [PATCH v2 2/2] iommu: Probe right iommu_ops for device Lu Baolu
2024-01-29  8:07   ` Tian, Kevin
2024-01-29 14:58   ` Robin Murphy
2024-01-29 15:37   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).