Re: [PATCH v6 20/25] iommu/arm-smmu-v3-iommufd: Add hw_info to impl_ops

From: Pranjal Shrivastava
Date: Mon Jun 23 2025 - 11:18:05 EST


On Fri, Jun 20, 2025 at 10:36:56PM -0700, Nicolin Chen wrote:
> On Fri, Jun 20, 2025 at 03:32:19AM +0000, Pranjal Shrivastava wrote:
> > My point is that in-case someone passed INTEL_VTD type, we would end up
> > calling impl_ops->hw_info and then the impl_ops->hw_info shall check for
> > the type to return -EOPNOTSUPP. Either we should clearly mention that
> > each impl_op implementing hw_info *must* add another type and check for
> > it
>
> Let's add this:
>
> @@ -721,6 +721,11 @@ struct arm_smmu_impl_ops {
> int (*init_structures)(struct arm_smmu_device *smmu);
> struct arm_smmu_cmdq *(*get_secondary_cmdq)(
> struct arm_smmu_device *smmu, struct arm_smmu_cmdq_ent *ent);
> + /*
> + * An implementation should define its own type other than the default
> + * IOMMU_HW_INFO_TYPE_ARM_SMMUV3. And it must validate the input @type
> + * to return its own structure.
> + */
> void *(*hw_info)(struct arm_smmu_device *smmu, u32 *length, u32 *type);
> const size_t vsmmu_size;
> const enum iommu_viommu_type vsmmu_type;
>
> And I found that we could have another patch changing "u32 *type"
> to "enum iommufd_hw_info_flags *type" to avoid some duplications
> in the kdocs.
>

Yea, that sounds good. Thanks!

> Thanks
> Nicolin