On Fri, May 19, 2023 at 12:56:19PM +0100, Joao Martins wrote: > > > On 19/05/2023 12:51, Jason Gunthorpe wrote: > > On Fri, May 19, 2023 at 12:47:24PM +0100, Joao Martins wrote: > > > >> In practice it is done as soon after the domain is created but I understand what > >> you mean that both should be together; I have this implemented like that as my > >> first take as a domain_alloc passed flags, but I was a little undecided because > >> we are adding another domain_alloc() op for the user-managed pagetable and after > >> having another one we would end up with 3 ways of creating iommu domain -- but > >> maybe that's not an issue > > > > It should ride on the same user domain alloc op as some generic flags, > > OK, I suppose that makes sense specially with this being tied in HWPT_ALLOC > where all this new user domain alloc does. Yes, it should be easy. Then do what Robin said and make the domain ops NULL if the user didn't ask for dirty tracking and then attach can fail if there are domain incompatibility's. Since alloc_user (or whatever it settles into) will have the struct device * argument this should be easy enough with out getting mixed with the struct bus cleanup. Jason