On 05/21/2018 07:03 AM, Peter Maydell wrote: > + /* Return the IOMMU index to use for a given set of transaction > attributes. > + * > + * Optional method: if an IOMMU only supports a single IOMMU index then > + * the default implementation of memory_region_iommu_attrs_to_index() > + * will return 0. > + * > + * The indexes supported by an IOMMU must be contiguous, starting at 0. > + * > + * @iommu: the IOMMUMemoryRegion > + * @attrs: memory transaction attributes > + */ > + int (*attrs_to_index)(IOMMUMemoryRegion *iommu, MemTxAttrs attrs); > + > + /* Return the number of IOMMU indexes this IOMMU supports. > + * > + * Optional method: if this method is not provided, then > + * memory_region_iommu_num_indexes() will return 1, indicating that > + * only a single IOMMU index is supported. > + */
The mispatched callback has been discussed, but would it be equally useful to simply have a variable here instead of a callback? Perhaps max_index instead of num_indexes so that zero-initialization of the structure does the right thing for existing iommu's. r~