On 17 May 2018 at 13:46, Paolo Bonzini <pbonz...@redhat.com> wrote: > Yes, this also sounds good. It does have the same issue for VFIO that > get_num_indexes() would be called too late to fail (and again, in a > place where it's hard to fail). > > Maybe the index count and the index-from/to-attrs translation should be > static (index-to-attrs could use the same pair of MemTxAttrs for "which > bits matter" and "what value should they have"), so that VFIO can > inspect it and decide if it's okay to proceed with e.g. the first iommu_idx?
Well, they need to be static in the sense that the IOMMU can't change its opinion later about what it has. So as long as you have a pointer to the IOMMU you can ask it how many indexes it has. thanks -- PMM