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

Tian, Kevin kevin.tian at intel.com
Fri Jun 13 00:33:24 PDT 2025


> From: Nicolin Chen <nicolinc at nvidia.com>
> Sent: Friday, June 13, 2025 1:07 AM
> 
> On Thu, Jun 12, 2025 at 08:12:29AM +0000, Tian, Kevin wrote:
> > > From: Nicolin Chen <nicolinc at nvidia.com>
> > > Sent: Tuesday, June 10, 2025 1:13 AM
> > > + * @get_viommu_size: Get the size of a driver-level vIOMMU structure
> for a
> > > given
> > > + *                   @dev corresponding to @viommu_type. Driver should
> return
> > > an
> > > + *                   errno if vIOMMU isn't supported accordingly. It is required
> > > + *                   for driver to use the VIOMMU_STRUCT_SIZE macro to
> sanitize
> > > + *                   a driver-level vIOMMU structure related to the core one
> >
> > What about returning size with '0' indicating NOSUPPORT?
> 
> I tend to support other errnos here. Basically this moves all the
> driver-level sanity checks from viommu_alloc to get_viommu_size,
> to reject an incompatible case immediately before allocating any
> structure. And there can be another errno than EOPNOTSUPP.
> 

Okay. Make sense.



More information about the linux-arm-kernel mailing list