Re: [PATCH v4 18/23] iommu/arm-smmu-v3-iommufd: Support implementation-defined hw_info

Jason Gunthorpe
2025-05-15T18:56:33Z

On Thu, May 15, 2025 at 11:52:05AM -0700, Nicolin Chen wrote:
> On Thu, May 15, 2025 at 02:17:06PM -0300, Jason Gunthorpe wrote:
> > On Thu, May 08, 2025 at 08:02:39PM -0700, Nicolin Chen wrote:
> > > Repurpose the @__reserved field in the struct iommu_hw_info_arm_smmuv3,
> > > to an HW implementation-defined field @impl.
> >
> > It would be nicer to have a tegra/cmdq specific struct and a way for
> > iommu_hw_info to select it. 'impl' isn't going to scale very well if
> > something else wants to use this.
> >
> > We have out_data_type but we could have an input sub_data_type too. 0
> > means what we have today, then a simple enum to select another info
> > struct.
>
> So, there will be two hw_info calls back to back right?

yes

> Should the first call return out_data_type=CMDQV while returning
> the arm_smmu_v3 hw_info data? Otherwise, VMM wouldn't know what
> to set in the input sub_data_type of the 2nd ioctl?

No, either set a flag in the smmu_v3 hw_info, as you were doing here,
or just have the vmm probe it. Given the VMM is likely to be told to
run in vCMDQ mode on the command line try-and-fail doesn't sound so
bad.

And I guess we don't need a "sub type" just a "requested type" where 0
means return the best one and non-zero means return a specific one or
fail with EOPNOTSUPP.

Jason