iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
authorNicolin Chen <nicolinc@nvidia.com>
Sat, 14 Jun 2025 06:35:21 +0000 (23:35 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 19 Jun 2025 18:43:29 +0000 (15:43 -0300)
commit683cff7c3bf4495c2378ede5a3601271958c08fe
tree5943d184b97600134f6f2a16d3c1710527e75b53
parent5983d1e7d7586c32605fdffc68e5ff61bf917022
iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init

To ease the for-driver iommufd APIs, get_viommu_size and viommu_init ops
are introduced.

Sanitize the inputs and report the size of struct mock_viommu on success,
in mock_get_viommu_size().

The core will ensure the viommu_type is set to the core vIOMMU object, so
simply init the driver part in mock_viommu_init().

Remove the mock_viommu_alloc, completing the replacement.

Link: https://patch.msgid.link/r/993beabbb0bc9705d979a92801ea5ed5996a34eb.1749882255.git.nicolinc@nvidia.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/selftest.c