Skip to content

Commit c33e208

Browse files
yiliu1765joergroedel
authored andcommitted
iommu/vt-d: Limit intel_iommu_set_dev_pasid() for paging domain
intel_iommu_set_dev_pasid() is only supposed to be used by paging domain, so limit it. Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20241107122234.7424-9-yi.l.liu@intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent c8596d6 commit c33e208

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4154,6 +4154,9 @@ static int intel_iommu_set_dev_pasid(struct iommu_domain *domain,
41544154
struct dev_pasid_info *dev_pasid;
41554155
int ret;
41564156

4157+
if (WARN_ON_ONCE(!(domain->type & __IOMMU_DOMAIN_PAGING)))
4158+
return -EINVAL;
4159+
41574160
if (!pasid_supported(iommu) || dev_is_real_dma_subdevice(dev))
41584161
return -EOPNOTSUPP;
41594162

@@ -4182,8 +4185,7 @@ static int intel_iommu_set_dev_pasid(struct iommu_domain *domain,
41824185

41834186
domain_remove_dev_pasid(old, dev, pasid);
41844187

4185-
if (domain->type & __IOMMU_DOMAIN_PAGING)
4186-
intel_iommu_debugfs_create_dev_pasid(dev_pasid);
4188+
intel_iommu_debugfs_create_dev_pasid(dev_pasid);
41874189

41884190
return 0;
41894191

0 commit comments

Comments
 (0)