iommu/vt-d: Remove unnecessary check in intel_iommu_add()
authorLu Baolu <baolu.lu@linux.intel.com>
Tue, 12 Jul 2022 00:09:06 +0000 (08:09 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 15 Jul 2022 08:21:42 +0000 (10:21 +0200)
The Intel IOMMU hot-add process starts from dmar_device_hotplug(). It
uses the global dmar_global_lock to synchronize all the hot-add and
hot-remove paths. In the hot-add path, the new IOMMU data structures
are allocated firstly by dmar_parse_one_drhd() and then initialized by
dmar_hp_add_drhd(). All the IOMMU units are allocated and initialized
in the same synchronized path. There is no case where any IOMMU unit
is created and then initialized for multiple times.

This removes the unnecessary check in intel_iommu_add() which is the
last reference place of the global IOMMU array.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Link: https://lore.kernel.org/r/20220702015610.2849494-5-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c

index 36b3649..2f64ff6 100644 (file)
@@ -3460,9 +3460,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
        int sp, ret;
        struct intel_iommu *iommu = dmaru->iommu;
 
-       if (g_iommus[iommu->seq_id])
-               return 0;
-
        ret = intel_cap_audit(CAP_AUDIT_HOTPLUG_DMAR, iommu);
        if (ret)
                goto out;