Re: [PATCH v3 11/11] iommu/arm-smmu-v3: Add IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support
From: Jason Gunthorpe
Date: Thu Oct 17 2024 - 14:40:35 EST
On Wed, Oct 09, 2024 at 09:38:11AM -0700, Nicolin Chen wrote:
> Add a new driver-type for ARM SMMUv3 to enum iommu_viommu_type. Implement
> +static inline struct iommufd_viommu *
> +arm_vsmmu_alloc(struct iommu_device *iommu_dev, struct iommu_domain *parent,
> + struct iommufd_ctx *ictx, unsigned int viommu_type)
> +{
> + return ERR_PTR(-EOPNOTSUPP);
> +}
Let's do #define NULL here instead so we don't get an op at all.
> +struct iommufd_viommu *
> +arm_vsmmu_alloc(struct iommu_device *iommu_dev, struct iommu_domain *parent,
> + struct iommufd_ctx *ictx, unsigned int viommu_type)
> +{
> + struct arm_smmu_device *smmu =
> + container_of(iommu_dev, struct arm_smmu_device, iommu);
> + struct arm_smmu_domain *s2_parent = to_smmu_domain(parent);
> + struct arm_vsmmu *vsmmu;
> +
> + if (viommu_type != IOMMU_VIOMMU_TYPE_ARM_SMMUV3)
> + return ERR_PTR(-EOPNOTSUPP);
So what happens if the user tries to create a default domain?
It skips this and just creates an normal viommu object
But then what? The driver needs to make sure it never casts that to a
arm_vsmmu ? How?
Jason