[PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper
Jason Gunthorpe
jgg at nvidia.com
Fri Jan 10 06:51:49 PST 2025
On Fri, Jan 10, 2025 at 07:12:46AM +0000, Tian, Kevin wrote:
> > + if (!viommu)
> > + return -ENODEV;
> > + if (WARN_ON_ONCE(!viommu->ops || !viommu->ops-
> > >supports_veventq ||
> > + !viommu->ops->supports_veventq(type)))
> > + return -EOPNOTSUPP;
>
> Hmm the driver knows which type is supported by itself before
> calling this helper. Why bother having the helper calling into
> the driver again to verify?
Indeed, it might make sense to protect this with
if (IS_ENABLED(CONFIG_IOMMUFD_TEST))
As a compiled out assertion
Or drop it
We shouldn't have unnecessary argument validation on fast paths,
!viommu should go too.
Jason
More information about the linux-arm-kernel
mailing list