[PATCH v2 4/7] iommu: Mark dev_iommu_get() with lockdep

Jason Gunthorpe jgg at nvidia.com
Thu Dec 7 10:03:11 PST 2023


Allocation of dev->iommu must be done under the
iommu_probe_device_lock. Mark this with lockdep to discourage future
mistakes.

Reviewed-by: Jerry Snitselaar <jsnitsel at redhat.com>
Tested-by: Hector Martin <marcan at marcan.st>
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
Reviewed-by: Moritz Fischer <moritzf at google.com>
Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
---
 drivers/iommu/iommu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 0d25468d53a68a..4323b6276e977f 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -334,6 +334,8 @@ static struct dev_iommu *dev_iommu_get(struct device *dev)
 {
 	struct dev_iommu *param = dev->iommu;
 
+	lockdep_assert_held(&iommu_probe_device_lock);
+
 	if (param)
 		return param;
 
-- 
2.43.0




More information about the linux-snps-arc mailing list