提交 25c7da94 编写于 作者: K Keqian Zhu 提交者: Zheng Zengkai

iommu: Stop tracking the dirty log status of iommu_domain

virt inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4WK5B
CVE: NA

------------------------------

The iommu_domain may contain more than one DMA range which can
be dirty log tracked separately, so it's hard to track the dirty
log status of iommu_domain. The upper layer (e.g. vfio) should
make sure it's doing right thing.

Fixes: bbf3b39e (iommu: Introduce dirty log tracking framework)
Signed-off-by: NKeqian Zhu <zhukeqian1@huawei.com>
Tested-by: NKunkun Jiang <jiangkunkun@huawei.com>
Reviewed-by: NKunkun Jiang <jiangkunkun@huawei.com>
Reviewed-by: NZenghui Yu <yuzenghui@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b22a06ea
......@@ -3017,13 +3017,6 @@ int iommu_switch_dirty_log(struct iommu_domain *domain, bool enable,
}
mutex_lock(&domain->switch_log_lock);
if (enable && domain->dirty_log_tracking) {
ret = -EBUSY;
goto out;
} else if (!enable && !domain->dirty_log_tracking) {
ret = -EINVAL;
goto out;
}
pr_debug("switch_dirty_log %s for: iova 0x%lx size 0x%zx\n",
enable ? "enable" : "disable", iova, size);
......@@ -3046,11 +3039,9 @@ int iommu_switch_dirty_log(struct iommu_domain *domain, bool enable,
if (flush)
iommu_flush_iotlb_all(domain);
if (!ret) {
domain->dirty_log_tracking = enable;
if (!ret)
trace_switch_dirty_log(orig_iova, orig_size, enable);
}
out:
mutex_unlock(&domain->switch_log_lock);
return ret;
}
......@@ -3077,10 +3068,6 @@ int iommu_sync_dirty_log(struct iommu_domain *domain, unsigned long iova,
}
mutex_lock(&domain->switch_log_lock);
if (!domain->dirty_log_tracking) {
ret = -EINVAL;
goto out;
}
pr_debug("sync_dirty_log for: iova 0x%lx size 0x%zx\n", iova, size);
......@@ -3101,7 +3088,7 @@ int iommu_sync_dirty_log(struct iommu_domain *domain, unsigned long iova,
if (!ret)
trace_sync_dirty_log(orig_iova, orig_size);
out:
mutex_unlock(&domain->switch_log_lock);
return ret;
}
......@@ -3163,10 +3150,6 @@ int iommu_clear_dirty_log(struct iommu_domain *domain,
}
mutex_lock(&domain->switch_log_lock);
if (!domain->dirty_log_tracking) {
ret = -EINVAL;
goto out;
}
start = (iova - base_iova) >> bitmap_pgshift;
end = start + (size >> bitmap_pgshift);
......@@ -3182,7 +3165,7 @@ int iommu_clear_dirty_log(struct iommu_domain *domain,
if (flush)
iommu_flush_iotlb_all(domain);
out:
mutex_unlock(&domain->switch_log_lock);
return ret;
}
......
......@@ -87,7 +87,6 @@ struct iommu_domain {
void *handler_token;
struct iommu_domain_geometry geometry;
void *iova_cookie;
bool dirty_log_tracking;
struct mutex switch_log_lock;
KABI_RESERVE(1)
KABI_RESERVE(2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册