@@ -3302,8 +3302,18 @@ static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,
struct iommu_domain *domain)
{
const struct iommu_ops *ops = dev_iommu_ops(dev);
+ struct iommu_domain *blocked_domain = ops->blocked_domain;
+ int ret = 1;
- ops->remove_dev_pasid(dev, pasid, domain);
+ if (blocked_domain && blocked_domain->ops->set_dev_pasid) {
+ ret = blocked_domain->ops->set_dev_pasid(blocked_domain,
+ dev, pasid, domain);
+ } else {
+ ops->remove_dev_pasid(dev, pasid, domain);
+ ret = 0;
+ }
+
+ WARN_ON(ret);
}
static int __iommu_set_group_pasid(struct iommu_domain *domain,
@@ -3361,7 +3371,9 @@ int iommu_attach_device_pasid(struct iommu_domain *domain,
int ret;
if (!domain->ops->set_dev_pasid ||
- !ops->remove_dev_pasid)
+ (!ops->remove_dev_pasid &&
+ (!ops->blocked_domain ||
+ !ops->blocked_domain->ops->set_dev_pasid)))
return -EOPNOTSUPP;
if (!group)