@@ -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,
@@ -3366,7 +3376,9 @@ int iommu_attach_device_pasid(struct iommu_domain *domain,
ops = dev_iommu_ops(dev);
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 (ops != domain->owner || pasid == IOMMU_NO_PASID)