Skip to content

Commit cc5bd89

Browse files
duanzhenzhongjoergroedel
authored andcommitted
iommu/vt-d: Block PASID attachment to nested domain with dirty tracking
Kernel lacks dirty tracking support on nested domain attached to PASID, fails the attachment early if nesting parent domain is dirty tracking configured, otherwise dirty pages would be lost. Cc: stable@vger.kernel.org Fixes: 67f6f56 ("iommu/vt-d: Add set_dev_pasid callback for nested domain") Suggested-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20260330101108.12594-2-zhenzhong.duan@intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Fixes: 67f6f56 ("iommu/vt-d: Add set_dev_pasid callback for nested domain") Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent f338e77 commit cc5bd89

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/iommu/intel/nested.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,21 @@ static int intel_nested_set_dev_pasid(struct iommu_domain *domain,
148148
{
149149
struct device_domain_info *info = dev_iommu_priv_get(dev);
150150
struct dmar_domain *dmar_domain = to_dmar_domain(domain);
151+
struct iommu_domain *s2_domain = &dmar_domain->s2_domain->domain;
151152
struct intel_iommu *iommu = info->iommu;
152153
struct dev_pasid_info *dev_pasid;
153154
int ret;
154155

155156
if (!pasid_supported(iommu) || dev_is_real_dma_subdevice(dev))
156157
return -EOPNOTSUPP;
157158

159+
if (s2_domain->dirty_ops)
160+
return -EINVAL;
161+
158162
if (context_copied(iommu, info->bus, info->devfn))
159163
return -EBUSY;
160164

161-
ret = paging_domain_compatible(&dmar_domain->s2_domain->domain, dev);
165+
ret = paging_domain_compatible(s2_domain, dev);
162166
if (ret)
163167
return ret;
164168

0 commit comments

Comments
 (0)