Hi Joerg,
On 11/23/18 7:21 PM, j...@8bytes.org wrote:
On Wed, Nov 21, 2018 at 12:40:44PM +0800, Lu Baolu wrote:
Can you please elaborate a bit more about the concept of subdomains?
From my point of view, an aux-domain is a normal un-managed domain which
has a PASID and could be attached to any ADIs through the aux-domain
specific attach/detach APIs. It could also be attached to a device with
the existing domain_attach/detach_device() APIs at the same time, hence
mdev and pci devices in a vfio container could share a domain.
Okay, let's think a bit about having aux-specific attach/detach
functions, in the end I don't insist on my proposal as long as the
IOMMU-API extensions are clean, consistent, and have well defined
semantics.
If we have aux-domain specific attach/detach functions like
iommu_aux_domain_attach/detach(), what happens when the primary domain
of the device is changed with iommu_attach/detach()?
1) Will the aux-domains stay in place? If yes, how does this
work in setups where the pasid-bound page-tables are
guest-owned and translated through the primary domain
page-tables?
Are you thinking about guest SVA? In this case, guest SVA will be
translated through the aux domain page-tables. So, we can safely change
the primary domain with aux-domains staying there.
Conceptually, the primary domain means the existing domain which is for
all Request ID based (a.k.a. transfers without PASID) translations. Any
transfer with PASID will not go through the primary domain.
2) Will the aux-domains be unbound too? In that case, if the
primary domain is re-used, will the aux-domains be implicitly
bound too when iommu_device_attach() is called?
3) Do we just disallow changing the primary domain through that
interface as long as there are aux-domains or mm_structs
bound to the device?
Using option 2) or 3) would mean that the aux-domains are still bound to
the primary domain, but that is not reflected in the API. Further, if an
aux-domain is just a normal domain (struct iommu_domain), what happens
when a domain that was used as a primary domain and has bound
aux-domains to it, is bound with iommu_aux_domain_attach() to another
domain?
As you can see, this design decission raises a lot of questions, but
maybe we can work it out and find a solution we all agree on.
Regards,
Joerg
Best regards,
Lu Baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu