Skip to content

Commit 647b7aa

Browse files
yiliu1765joergroedel
authored andcommitted
iommu: Remove the remove_dev_pasid op
The iommu drivers that supports PASID have supported attaching pasid to the blocked_domain, hence remove the remove_dev_pasid op from the iommu_ops. Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Reviewed-by: Lu Baolu <[email protected]> Signed-off-by: Yi Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 5f53638 commit 647b7aa

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

drivers/iommu/iommu.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3317,17 +3317,9 @@ static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,
33173317
{
33183318
const struct iommu_ops *ops = dev_iommu_ops(dev);
33193319
struct iommu_domain *blocked_domain = ops->blocked_domain;
3320-
int ret = 1;
33213320

3322-
if (blocked_domain && blocked_domain->ops->set_dev_pasid) {
3323-
ret = blocked_domain->ops->set_dev_pasid(blocked_domain,
3324-
dev, pasid, domain);
3325-
} else {
3326-
ops->remove_dev_pasid(dev, pasid, domain);
3327-
ret = 0;
3328-
}
3329-
3330-
WARN_ON(ret);
3321+
WARN_ON(blocked_domain->ops->set_dev_pasid(blocked_domain,
3322+
dev, pasid, domain));
33313323
}
33323324

33333325
static int __iommu_set_group_pasid(struct iommu_domain *domain,
@@ -3390,9 +3382,8 @@ int iommu_attach_device_pasid(struct iommu_domain *domain,
33903382
ops = dev_iommu_ops(dev);
33913383

33923384
if (!domain->ops->set_dev_pasid ||
3393-
(!ops->remove_dev_pasid &&
3394-
(!ops->blocked_domain ||
3395-
!ops->blocked_domain->ops->set_dev_pasid)))
3385+
!ops->blocked_domain ||
3386+
!ops->blocked_domain->ops->set_dev_pasid)
33963387
return -EOPNOTSUPP;
33973388

33983389
if (ops != domain->owner || pasid == IOMMU_NO_PASID)

include/linux/iommu.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,6 @@ iommu_copy_struct_from_full_user_array(void *kdst, size_t kdst_entry_size,
587587
* - IOMMU_DOMAIN_DMA: must use a dma domain
588588
* - 0: use the default setting
589589
* @default_domain_ops: the default ops for domains
590-
* @remove_dev_pasid: Remove any translation configurations of a specific
591-
* pasid, so that any DMA transactions with this pasid
592-
* will be blocked by the hardware.
593590
* @viommu_alloc: Allocate an iommufd_viommu on a physical IOMMU instance behind
594591
* the @dev, as the set of virtualization resources shared/passed
595592
* to user space IOMMU instance. And associate it with a nesting
@@ -647,8 +644,6 @@ struct iommu_ops {
647644
struct iommu_page_response *msg);
648645

649646
int (*def_domain_type)(struct device *dev);
650-
void (*remove_dev_pasid)(struct device *dev, ioasid_t pasid,
651-
struct iommu_domain *domain);
652647

653648
struct iommufd_viommu *(*viommu_alloc)(
654649
struct device *dev, struct iommu_domain *parent_domain,

0 commit comments

Comments
 (0)