[PATCH v1 14/16] iommu/arm-smmu-v3: Add vsmmu_alloc impl op
Nicolin Chen
nicolinc at nvidia.com
Mon Apr 21 10:47:00 PDT 2025
On Mon, Apr 21, 2025 at 08:23:50AM +0000, Tian, Kevin wrote:
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > index 66855cae775e..aa8653af50f2 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > @@ -392,10 +392,7 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct
> > device *dev,
> > iommu_get_iommu_dev(dev, struct arm_smmu_device,
> > iommu);
> > struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> > 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);
> > + struct arm_vsmmu *vsmmu = NULL;
> >
> > if (!(smmu->features & ARM_SMMU_FEAT_NESTING))
> > return ERR_PTR(-EOPNOTSUPP);
> > @@ -423,8 +420,16 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct
> > device *dev,
> > !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> > return ERR_PTR(-EOPNOTSUPP);
> >
> > - vsmmu = iommufd_viommu_alloc(ictx, struct arm_vsmmu, core,
> > - &arm_vsmmu_ops);
> > + if (master->smmu->impl_ops && master->smmu->impl_ops-
> > >vsmmu_alloc)
> > + vsmmu = master->smmu->impl_ops->vsmmu_alloc(
> > + master->smmu, s2_parent, ictx, viommu_type,
> > user_data);
> > + if (PTR_ERR(vsmmu) == -EOPNOTSUPP) {
>
> did it work on standard SMMUv3 when there is no @vsmmu_alloc()
> and the variable 'vsmmu' is initialized to NULL?
You are right. We should do:
- struct arm_vsmmu *vsmmu = NULL;
+ struct arm_vsmmu *vsmmu = ERR_PTR(-EOPNOTSUPP);
Thanks!
Nicolin
More information about the linux-arm-kernel
mailing list