Message ID | 20241104132033.14027-2-yi.l.liu@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Support attaching PASID to the blocked_domain | expand |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ea6b4a96186d..866559bbc4e4 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -3454,11 +3454,13 @@ int iommu_attach_device_pasid(struct iommu_domain *domain, struct iommu_attach_handle *handle) { /* Caller must be a probed driver on dev */ + const struct iommu_ops *ops = dev_iommu_ops(dev); struct iommu_group *group = dev->iommu_group; struct group_device *device; int ret; - if (!domain->ops->set_dev_pasid) + if (!domain->ops->set_dev_pasid || + !ops->remove_dev_pasid) return -EOPNOTSUPP; if (!group)
driver should implement both set_dev_pasid and remove_dev_pasid op, otherwise it is a problem how to detach pasid. In reality, it is impossible that an iommu driver implements set_dev_pasid() but no remove_dev_pasid() op. However, it is better to check it. Signed-off-by: Yi Liu <yi.l.liu@intel.com> --- drivers/iommu/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)