On 16/07/2024 10:39, Cédric Le Goater wrote: > On 7/12/24 13:46, Joao Martins wrote: >> There's generally two modes of operation for IOMMUFD: >> >> * The simple user API which intends to perform relatively simple things >> with IOMMUs e.g. DPDK. It generally creates an IOAS and attach to VFIO >> and mainly performs IOAS_MAP and UNMAP. >> >> * The native IOMMUFD API where you have fine grained control of the >> IOMMU domain and model it accordingly. This is where most new feature >> are being steered to. >> >> For dirty tracking 2) > > I suppose 1) and 2) are the bullets above ? > yeah
>> is required, as it needs to ensure that >> the stage-2/parent IOMMU domain will only attach devices >> that support dirty tracking (so far it is all homogeneous in x86, likely >> not the case for smmuv3). Such invariant on dirty tracking provides a >> useful guarantee to VMMs that will refuse incompatible device >> attachments for IOMMU domains. >> >> Dirty tracking insurance is enforced via HWPT_ALLOC, which is >> responsible for creating an IOMMU domain. This is contrast to the >> 'simple API' where the IOMMU domain is created by IOMMUFD automatically >> when it attaches to VFIO (usually referred as autodomains) but it has >> the needed handling for mdevs. >> >> To support dirty tracking with the advanced IOMMUFD API, it needs >> similar logic, where IOMMU domains are created and devices attached to >> compatible domains. Essentially mimmicing kernel > > mimmicing -> mimicking, I think. > Ack >> iommufd_device_auto_get_domain(). With mdevs given there's no IOMMU domain >> it falls back to IOAS attach. >> >> The auto domain logic allows different IOMMU domains to be created when >> DMA dirty tracking is not desired (and VF can provide it), and others where >> it is. Here is not used in this way here given how VFIODevice migration >> state is initialized after the device attachment. But such mixed mode of >> IOMMU dirty tracking + device dirty tracking is an improvement that can >> be added on. Keep the 'all of nothing' of type1 approach that we have >> been using so far between container vs device dirty tracking. >> >> Signed-off-by: Joao Martins <joao.m.mart...@oracle.com> > > Reviewed-by: Cédric Le Goater <c...@redhat.com> > > This needs feedback from IOMMUFD experts also. I take it that by IOMMUFD experts you the ones more familiar with Qemu side (Zhenzhong and/or Yi) Joao