Skip to content

Commit 922e259

Browse files
duanzhenzhongjoergroedel
authored andcommitted
iommu/vt-d: Rename device_set_dirty_tracking() and pass dmar_domain pointer
device_set_dirty_tracking() sets dirty tracking on all devices attached to a domain, also on all PASIDs attached to same domain in subsequent patch. So rename it as domain_set_dirty_tracking() and pass dmar_domain pointer to better align to what it does. No functional changes intended. Suggested-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20260330101108.12594-3-zhenzhong.duan@intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent cc5bd89 commit 922e259

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

drivers/iommu/intel/iommu.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,16 +3684,15 @@ static void *intel_iommu_hw_info(struct device *dev, u32 *length,
36843684
return vtd;
36853685
}
36863686

3687-
/*
3688-
* Set dirty tracking for the device list of a domain. The caller must
3689-
* hold the domain->lock when calling it.
3690-
*/
3691-
static int device_set_dirty_tracking(struct list_head *devices, bool enable)
3687+
/* Set dirty tracking for the devices that the domain has been attached. */
3688+
static int domain_set_dirty_tracking(struct dmar_domain *domain, bool enable)
36923689
{
36933690
struct device_domain_info *info;
36943691
int ret = 0;
36953692

3696-
list_for_each_entry(info, devices, link) {
3693+
lockdep_assert_held(&domain->lock);
3694+
3695+
list_for_each_entry(info, &domain->devices, link) {
36973696
ret = intel_pasid_setup_dirty_tracking(info->iommu, info->dev,
36983697
IOMMU_NO_PASID, enable);
36993698
if (ret)
@@ -3713,7 +3712,7 @@ static int parent_domain_set_dirty_tracking(struct dmar_domain *domain,
37133712
spin_lock(&domain->s1_lock);
37143713
list_for_each_entry(s1_domain, &domain->s1_domains, s2_link) {
37153714
spin_lock_irqsave(&s1_domain->lock, flags);
3716-
ret = device_set_dirty_tracking(&s1_domain->devices, enable);
3715+
ret = domain_set_dirty_tracking(s1_domain, enable);
37173716
spin_unlock_irqrestore(&s1_domain->lock, flags);
37183717
if (ret)
37193718
goto err_unwind;
@@ -3724,8 +3723,7 @@ static int parent_domain_set_dirty_tracking(struct dmar_domain *domain,
37243723
err_unwind:
37253724
list_for_each_entry(s1_domain, &domain->s1_domains, s2_link) {
37263725
spin_lock_irqsave(&s1_domain->lock, flags);
3727-
device_set_dirty_tracking(&s1_domain->devices,
3728-
domain->dirty_tracking);
3726+
domain_set_dirty_tracking(s1_domain, domain->dirty_tracking);
37293727
spin_unlock_irqrestore(&s1_domain->lock, flags);
37303728
}
37313729
spin_unlock(&domain->s1_lock);
@@ -3742,7 +3740,7 @@ static int intel_iommu_set_dirty_tracking(struct iommu_domain *domain,
37423740
if (dmar_domain->dirty_tracking == enable)
37433741
goto out_unlock;
37443742

3745-
ret = device_set_dirty_tracking(&dmar_domain->devices, enable);
3743+
ret = domain_set_dirty_tracking(dmar_domain, enable);
37463744
if (ret)
37473745
goto err_unwind;
37483746

@@ -3759,8 +3757,7 @@ static int intel_iommu_set_dirty_tracking(struct iommu_domain *domain,
37593757
return 0;
37603758

37613759
err_unwind:
3762-
device_set_dirty_tracking(&dmar_domain->devices,
3763-
dmar_domain->dirty_tracking);
3760+
domain_set_dirty_tracking(dmar_domain, dmar_domain->dirty_tracking);
37643761
spin_unlock(&dmar_domain->lock);
37653762
return ret;
37663763
}

0 commit comments

Comments
 (0)