Hi Joerg, On 11/11/2016 17:22, Joerg Roedel wrote: > Hi Eric, > > On Fri, Nov 11, 2016 at 04:47:01PM +0100, Auger Eric wrote: >> Effectively in passthrough use case, the userspace defines the address >> space layout and maps guest RAM PA=IOVA to PAs (using >> VFIO_IOMMU_MAP_DMA). But this address space does not comprise the MSI >> IOVAs. Userspace does not care about MSI IOMMU mapping. So the MSI IOVA >> region must be allocated by either the VFIO driver or the IOMMU driver I >> think. Who else could initialize the IOVA allocator domain? > > So I think we need a way to tell userspace about the reserved regions > (per iommu-group) so that userspace knows where it can not map anything, Current plan is to expose that info through an iommu-group sysfs attribute, as you and Robin advised. > and VFIO can enforce that. But the right struct here is not an > iova-allocator rb-tree, a ordered linked list should be sufficient. I plan a linked list to store the reserved regions (P2P regions, MSI region, ...). get_dma_regions is called with a list local to a function for that. Might be needed to move that list head in the iommu_group to avoid calling the get_dm_regions again in the attribute show function? But to allocate the IOVAs within the MSI reserved region, I understand you don't want us to use the iova.c allocator, is that correct? We need an allocator though, even a very basic one based on bitmap or whatever. There potentially have several different physical MSI frame pages to map. Best Regards Eric > > > Joerg > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html