On Mon, Oct 22, 2018 at 12:50:56PM +0100, Robin Murphy wrote:
> To me, that sounds like a very good argument for having separate "attach as
> primary domain" and "attach as aux domain" APIs.

I agree with that, overloading iommu_attach_device() to support
aux-domains is not going to be a maintainable solution. I'd like this
to be a two-level approach, where the aux-domains are sub-domains of a
primary domain (naming is still to-be-improved):


        struct iommu_domain *domain;

        domain = iommu_alloc_aux_domain();

        iommu_attach_device(pdev, domain); /* Fails if device has not
                                              support for this
                                              domain-type */

        /* Bind a process address space to the aux-domain */
        sva_handle = iommu_sva_bind_mm(domain, current, ...);
        pasid = iommu_sva_get_pasid(sva_handle);

        mdev_handle = iommu_mdev_alloc_domain(domain);
        iommu_mdev_map(mdev_handle, ...);
        iommu_mdev_unmap(mdev_handle, ...);

        /* Do more work */

        iommu_sva_unbind_mm(sva_handle);

        iommu_mdev_free_domain(mdev_handle);

        iommu_detach_device(domain, pdev);


Regards,

        Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to