iommufd/device: Wrap IOMMUFD_OBJ_HWPT_PAGING-only configurations
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 26 Oct 2023 04:39:31 +0000 (21:39 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 26 Oct 2023 14:15:56 +0000 (11:15 -0300)
commit58d84f430dc7f737d21c60906de0f39104c89e9d
treeb55f62f4161b4afd14a509ada6f7fbd397cc3e02
parent9744a7ab62cc7354096aaff788c08b947f86ba60
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>
drivers/iommu/iommufd/device.c
drivers/iommu/iommufd/iommufd_private.h