iommufd cannot predict if user will use pasid or not, but if user is going to use it, the domains used by PASID-capable device should be allocated with IOMMU_HWPT_ALLOC_PASID flag. For domain allocated per userspace request, user should provide this flag. While for the auto_domain, iommufd needs to make it. Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx> --- drivers/iommu/iommufd/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c index 4e7a473d0dd0..a52937fba366 100644 --- a/drivers/iommu/iommufd/device.c +++ b/drivers/iommu/iommufd/device.c @@ -650,7 +650,9 @@ iommufd_device_auto_get_domain(struct iommufd_device *idev, ioasid_t pasid, goto out_unlock; } - hwpt_paging = iommufd_hwpt_paging_alloc(idev->ictx, ioas, idev, 0, + hwpt_paging = iommufd_hwpt_paging_alloc(idev->ictx, ioas, idev, + idev->dev->iommu->max_pasids ? + IOMMU_HWPT_ALLOC_PASID : 0, immediate_attach, NULL); if (IS_ERR(hwpt_paging)) { destroy_hwpt = ERR_CAST(hwpt_paging); -- 2.34.1