The new type of vIOMMU for tegra241-cmdqv allows user space VM to use one
of its virtual command queue HW resources exclusively. This requires user
space to mmap the corresponding MMIO page from kernel space for direct HW
control.
To forward the mmap info (offset and length), iommufd should add a driver
specific data structure to the IOMMUFD_CMD_VIOMMU_ALLOC ioctl, for driver
to output the info during the vIOMMU initialization back to user space.
Similar to the existing ioctls and their IOMMU handlers, add a user_data
to viommu_init op to bridge between iommufd and drivers.
Link: https://patch.msgid.link/r/90bd5637dab7f5507c7a64d2c4826e70431e45a4.1752126748.git.nicolinc@nvidia.com
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
}
int arm_vsmmu_init(struct iommufd_viommu *viommu,
- struct iommu_domain *parent_domain)
+ struct iommu_domain *parent_domain,
+ const struct iommu_user_data *user_data)
{
struct arm_vsmmu *vsmmu = container_of(viommu, struct arm_vsmmu, core);
struct arm_smmu_device *smmu =
size_t arm_smmu_get_viommu_size(struct device *dev,
enum iommu_viommu_type viommu_type);
int arm_vsmmu_init(struct iommufd_viommu *viommu,
- struct iommu_domain *parent_domain);
+ struct iommu_domain *parent_domain,
+ const struct iommu_user_data *user_data);
int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
struct arm_smmu_nested_domain *nested_domain);
void arm_smmu_attach_commit_vmaster(struct arm_smmu_attach_state *state);
}
static int mock_viommu_init(struct iommufd_viommu *viommu,
- struct iommu_domain *parent_domain)
+ struct iommu_domain *parent_domain,
+ const struct iommu_user_data *user_data)
{
struct mock_iommu_device *mock_iommu = container_of(
viommu->iommu_dev, struct mock_iommu_device, iommu_dev);
*/
viommu->iommu_dev = __iommu_get_iommu_dev(idev->dev);
- rc = ops->viommu_init(viommu, hwpt_paging->common.domain);
+ rc = ops->viommu_init(viommu, hwpt_paging->common.domain, NULL);
if (rc)
goto out_put_hwpt;
size_t (*get_viommu_size)(struct device *dev,
enum iommu_viommu_type viommu_type);
int (*viommu_init)(struct iommufd_viommu *viommu,
- struct iommu_domain *parent_domain);
+ struct iommu_domain *parent_domain,
+ const struct iommu_user_data *user_data);
const struct iommu_domain_ops *default_domain_ops;
unsigned long pgsize_bitmap;