Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommufd: Allow allocating PASID-compatible domain

The underlying infrastructure has supported the PASID attach and related
enforcement per the requirement of the IOMMU_HWPT_ALLOC_PASID flag. This
extends iommufd to support PASID compatible domain requested by userspace.

Link: https://patch.msgid.link/r/20250321171940.7213-15-yi.l.liu@intel.com
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Yi Liu and committed by
Jason Gunthorpe
dbc5f37b ce15c13e

+7 -3
+4 -3
drivers/iommu/iommufd/hw_pagetable.c
··· 112 112 { 113 113 const u32 valid_flags = IOMMU_HWPT_ALLOC_NEST_PARENT | 114 114 IOMMU_HWPT_ALLOC_DIRTY_TRACKING | 115 - IOMMU_HWPT_FAULT_ID_VALID; 115 + IOMMU_HWPT_FAULT_ID_VALID | 116 + IOMMU_HWPT_ALLOC_PASID; 116 117 const struct iommu_ops *ops = dev_iommu_ops(idev->dev); 117 118 struct iommufd_hwpt_paging *hwpt_paging; 118 119 struct iommufd_hw_pagetable *hwpt; ··· 234 233 struct iommufd_hw_pagetable *hwpt; 235 234 int rc; 236 235 237 - if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) || 236 + if ((flags & ~(IOMMU_HWPT_FAULT_ID_VALID | IOMMU_HWPT_ALLOC_PASID)) || 238 237 !user_data->len || !ops->domain_alloc_nested) 239 238 return ERR_PTR(-EOPNOTSUPP); 240 239 if (parent->auto_domain || !parent->nest_parent || ··· 291 290 struct iommufd_hw_pagetable *hwpt; 292 291 int rc; 293 292 294 - if (flags & ~IOMMU_HWPT_FAULT_ID_VALID) 293 + if (flags & ~(IOMMU_HWPT_FAULT_ID_VALID | IOMMU_HWPT_ALLOC_PASID)) 295 294 return ERR_PTR(-EOPNOTSUPP); 296 295 if (!user_data->len) 297 296 return ERR_PTR(-EOPNOTSUPP);
+3
include/uapi/linux/iommufd.h
··· 393 393 * Any domain attached to the non-PASID part of the 394 394 * device must also be flagged, otherwise attaching a 395 395 * PASID will blocked. 396 + * For the user that wants to attach PASID, ioas is 397 + * not recommended for both the non-PASID part 398 + * and PASID part of the device. 396 399 * If IOMMU does not support PASID it will return 397 400 * error (-EOPNOTSUPP). 398 401 */