iommu/vt-d: Update iotlb in nested domain attach
authorYi Liu <yi.l.liu@intel.com>
Mon, 19 Feb 2024 11:15:55 +0000 (19:15 +0800)
committerJoerg Roedel <jroedel@suse.de>
Wed, 21 Feb 2024 09:28:44 +0000 (10:28 +0100)
Should call domain_update_iotlb() to update the has_iotlb_device flag
of the domain after attaching device to nested domain. Without it, this
flag is not set properly and would result in missing device TLB flush.

Fixes: 9838f2bb6b6b ("iommu/vt-d: Set the nested domain to a device")
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240208082307.15759-5-yi.l.liu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c
drivers/iommu/intel/iommu.h
drivers/iommu/intel/nested.c

index e3dbcae959754416760bb1b11e110e5956346a4d..711c3e3fe09541ee5a7632affc9761cd55f715fc 100644 (file)
@@ -396,8 +396,6 @@ static int domain_update_device_node(struct dmar_domain *domain)
        return nid;
 }
 
-static void domain_update_iotlb(struct dmar_domain *domain);
-
 /* Return the super pagesize bitmap if supported. */
 static unsigned long domain_super_pgsize_bitmap(struct dmar_domain *domain)
 {
@@ -1218,7 +1216,7 @@ domain_lookup_dev_info(struct dmar_domain *domain,
        return NULL;
 }
 
-static void domain_update_iotlb(struct dmar_domain *domain)
+void domain_update_iotlb(struct dmar_domain *domain)
 {
        struct dev_pasid_info *dev_pasid;
        struct device_domain_info *info;
index 9b27edb73aa9c175ee86fae95d5beeeb89bd3d13..4145c04cb1c6818fea0ce420d31c41acec8836a3 100644 (file)
@@ -1066,6 +1066,7 @@ int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
  */
 #define QI_OPT_WAIT_DRAIN              BIT(0)
 
+void domain_update_iotlb(struct dmar_domain *domain);
 int domain_attach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu);
 void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu);
 void device_block_translation(struct device *dev);
index 6a75f6eb18f1cac37a81cd0a45e2cf30ddb8a622..d5af5925a31c6e8655b28d46448177748d3a2169 100644 (file)
@@ -65,6 +65,8 @@ static int intel_nested_attach_dev(struct iommu_domain *domain,
        list_add(&info->link, &dmar_domain->devices);
        spin_unlock_irqrestore(&dmar_domain->lock, flags);
 
+       domain_update_iotlb(dmar_domain);
+
        return 0;
 }