summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommufd/iommufd_private.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2023-10-25 21:39:31 -0700
committerJason Gunthorpe <jgg@nvidia.com>2023-10-26 11:15:56 -0300
commit58d84f430dc7f737d21c60906de0f39104c89e9d (patch)
treeb55f62f4161b4afd14a509ada6f7fbd397cc3e02 /drivers/iommu/iommufd/iommufd_private.h
parent9744a7ab62cc7354096aaff788c08b947f86ba60 (diff)
downloadlinux-stable-58d84f430dc7f737d21c60906de0f39104c89e9d.tar.gz
linux-stable-58d84f430dc7f737d21c60906de0f39104c89e9d.tar.bz2
linux-stable-58d84f430dc7f737d21c60906de0f39104c89e9d.zip
iommufd/device: Wrap IOMMUFD_OBJ_HWPT_PAGING-only configurations
Some of the configurations during the attach/replace() should only apply to IOMMUFD_OBJ_HWPT_PAGING. Once IOMMUFD_OBJ_HWPT_NESTED gets introduced in a following patch, keeping them unconditionally in the common routine will not work. Wrap all of those PAGING-only configurations together into helpers. Do a hwpt_is_paging check whenever calling them or their fallback routines. Link: https://lore.kernel.org/r/20231026043938.63898-4-yi.l.liu@intel.com Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/iommufd/iommufd_private.h')
-rw-r--r--drivers/iommu/iommufd/iommufd_private.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h
index 70bebad63a74..776dd41c077f 100644
--- a/drivers/iommu/iommufd/iommufd_private.h
+++ b/drivers/iommu/iommufd/iommufd_private.h
@@ -252,6 +252,11 @@ struct iommufd_hw_pagetable {
struct list_head hwpt_item;
};
+static inline bool hwpt_is_paging(struct iommufd_hw_pagetable *hwpt)
+{
+ return hwpt->obj.type == IOMMUFD_OBJ_HWPT_PAGING;
+}
+
static inline struct iommufd_hw_pagetable *
iommufd_get_hwpt(struct iommufd_ucmd *ucmd, u32 id)
{