On 2022-05-06 14:10, Jason Gunthorpe wrote:
On Fri, May 06, 2022 at 10:32:50AM +0100, Robin Murphy wrote:

It is as discussed with Robin, NULL means to return the group back to
some platform defined translation, and in some cases this means
returning back to work with the platform's DMA ops - presumably if it
isn't using the dma api.

This is clearer than the original text.

Perhaps we could just leave that sentence as "Otherwise the NULL domain
represents platform-specific behaviour."

Sure, there are only three drivers that use this call path and who
knows what they do I guess..

Soemtimes. This is a statement about the required
atomicity. New/old/block are all valid translations during the
operation. Identity is not.

but new/old/block are not the same type of classifications. A group
has an old domain and a new domain at this transition point, and
both old/new domains have a domain type (dma, unmanged, block,
identity, etc.). Mixing them together only increases confusion here.

Block refers to the global concept of blocking - not to a type.

Good point - in particular I think the "DMA is always translated" part would
be more accurately said as "DMA is always managed".

So you want to say "DMA is always managed" when attaching a domain of
type IOMMU_DOMAIN_UNMANAGED? :)

Touché ;) Just goes to confirm the point above that confusion between general concepts and specific API terms is all too easy. An "unmanaged" domain from the PoV of the API just means it's managed by the external caller, but you're right that that's not necessarily so obvious either.

Lets just clarify a bit that blocking isn't talking about a domain
type:

        /*
         * Changing the domain is done by calling attach_dev() on the new
         * domain. This switch does not have to be atomic and DMA can be
         * discarded during the transition. DMA must always be translated by

s/always be translated by/only be able to access/ and we have a deal :)

Cheers,
Robin.

         * either new_domain or group->domain, never something else.
         *
         * Note that this is called in error unwind paths, attaching to a
         * domain that has already been attached cannot fail.
         */

(aside, I expect down the road we will have some domain capability
'attach is atomic' meaning if new and old have the same translation
then there is no disruption to DMA)

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

Reply via email to