summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Liu <yi.l.liu@intel.com>2023-07-18 03:55:35 -0700
committerAlex Williamson <alex.williamson@redhat.com>2023-07-25 10:17:48 -0600
commiteda175dfe2484c1e79afaee0f65eeebfb9f89a53 (patch)
tree0f01680a30f08db970294d291138fd490911fb95
parent6e6c513fe1d8b53417aa84a56fac5bbda8b3a720 (diff)
downloadlinux-stable-eda175dfe2484c1e79afaee0f65eeebfb9f89a53.tar.gz
linux-stable-eda175dfe2484c1e79afaee0f65eeebfb9f89a53.tar.bz2
linux-stable-eda175dfe2484c1e79afaee0f65eeebfb9f89a53.zip
iommufd: Reserve all negative IDs in the iommufd xarray
With this reservation, IOMMUFD users can encode the negative IDs for specific purposes. e.g. VFIO needs two reserved values to tell userspace the ID returned is not valid but has other meaning. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Yanting Jiang <yanting.jiang@intel.com> Tested-by: Terrence Xu <terrence.xu@intel.com> Tested-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20230718105542.4138-4-yi.l.liu@intel.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--drivers/iommu/iommufd/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
index 3fbe636c3d8a..32ce7befc8dd 100644
--- a/drivers/iommu/iommufd/main.c
+++ b/drivers/iommu/iommufd/main.c
@@ -50,7 +50,7 @@ struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx,
* before calling iommufd_object_finalize().
*/
rc = xa_alloc(&ictx->objects, &obj->id, XA_ZERO_ENTRY,
- xa_limit_32b, GFP_KERNEL_ACCOUNT);
+ xa_limit_31b, GFP_KERNEL_ACCOUNT);
if (rc)
goto out_free;
return obj;