Re: [PATCH v1 05/12] iommu: Introduce get_viommu_size and viommu_init ops

From: Nicolin Chen
Date: Fri Jun 13 2025 - 16:45:44 EST


On Fri, Jun 13, 2025 at 10:41:17AM -0300, Jason Gunthorpe wrote:
> On Mon, Jun 09, 2025 at 10:13:28AM -0700, Nicolin Chen wrote:
> > @@ -654,6 +665,10 @@ struct iommu_ops {
> >
> > int (*def_domain_type)(struct device *dev);
> >
> > + int (*get_viommu_size)(enum iommu_viommu_type viommu_type,
> > + struct device *dev, size_t *viommu_size);
>
> I'd return the size in a size_t instead of using an output
> pointer. Make 0 mean not supported..

Yes. Kevin pointed out the same.

I found that the final version only has EOPNOTSUPP errno (had one
of WIP versions reporting EINVAL). So, yea, doing a ssize_t would
be cleaner and EOPNOTSUPP is probably enough. Will change in v2.

Thanks
Nicolin