Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-09 Thread Jason Gunthorpe via iommu
On Mon, May 09, 2022 at 11:06:35PM +0100, Robin Murphy wrote: > The main thing drivers need to do for flush queue support is to actually > implement the optimisations which make it worthwhile. It's up to individual > drivers how much use they want to make of the iommu_iotlb_gather mechanism, > and

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-09 Thread Robin Murphy
On 2022-05-09 18:26, Jason Gunthorpe wrote: On Mon, May 09, 2022 at 10:59:11AM +0100, Robin Murphy wrote: IOMMU_DOMAIN_DMA_FQ now effectively takes over the original semantics of IOMMU_DOMAIN_DMA as the one that depends on driver-specific functionality. If I grasp the FQ stuff right, it

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-09 Thread Jason Gunthorpe via iommu
On Mon, May 09, 2022 at 10:59:11AM +0100, Robin Murphy wrote: > IOMMU_DOMAIN_DMA_FQ now effectively takes over the original > semantics of IOMMU_DOMAIN_DMA as the one that depends on > driver-specific functionality. If I grasp the FQ stuff right, it seems that this only requires the driver to

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-09 Thread Robin Murphy
On 2022-05-06 14:54, Jason Gunthorpe wrote: On Fri, May 06, 2022 at 02:35:50PM +0100, Robin Murphy wrote: 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

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-06 Thread Jason Gunthorpe via iommu
On Fri, May 06, 2022 at 02:35:50PM +0100, Robin Murphy wrote: > > 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

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-06 Thread Robin Murphy
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 -

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-06 Thread Jason Gunthorpe via iommu
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

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-06 Thread Baolu Lu
On 2022/5/6 03:27, Jason Gunthorpe wrote: On Thu, May 05, 2022 at 07:56:59PM +0100, Robin Murphy wrote: Ack to that, there are certainly further improvements to consider once we've got known-working code into a released kernel, but let's not get ahead of ourselves just now. Yes please

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-06 Thread Robin Murphy
On 2022-05-06 00:28, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, May 5, 2022 11:33 PM /* -* If the group has been claimed already, do not re-attach the default -* domain. +* New drivers should support default domains and so the detach_dev() op +

RE: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, May 5, 2022 11:33 PM > > > /* > > > - * If the group has been claimed already, do not re-attach the default > > > - * domain. > > > + * New drivers should support default domains and so the > > > detach_dev() op > > > + * will never be called.

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Robin Murphy
On 2022-05-05 20:27, Jason Gunthorpe wrote: On Thu, May 05, 2022 at 07:56:59PM +0100, Robin Murphy wrote: Ack to that, there are certainly further improvements to consider once we've got known-working code into a released kernel, but let's not get ahead of ourselves just now. Yes please

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Jason Gunthorpe via iommu
On Thu, May 05, 2022 at 07:56:59PM +0100, Robin Murphy wrote: > Ack to that, there are certainly further improvements to consider once we've > got known-working code into a released kernel, but let's not get ahead of > ourselves just now. Yes please > (I'm pretty sure we could get away with a

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Robin Murphy
On 2022-05-05 16:33, Jason Gunthorpe wrote: On Thu, May 05, 2022 at 10:56:28AM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, May 5, 2022 3:09 AM Once the group enters 'owned' mode it can never be assigned back to the default_domain or to a NULL domain. It must always be

Re: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Jason Gunthorpe via iommu
On Thu, May 05, 2022 at 10:56:28AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, May 5, 2022 3:09 AM > > > > Once the group enters 'owned' mode it can never be assigned back to the > > default_domain or to a NULL domain. It must always be actively assigned to > > worth

RE: [PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-05 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, May 5, 2022 3:09 AM > > Once the group enters 'owned' mode it can never be assigned back to the > default_domain or to a NULL domain. It must always be actively assigned to worth pointing out that a NULL domain is not always translated to DMA blocked on

[PATCH v2] iommu: iommu_group_claim_dma_owner() must always assign a domain

2022-05-04 Thread Jason Gunthorpe via iommu
Once the group enters 'owned' mode it can never be assigned back to the default_domain or to a NULL domain. It must always be actively assigned to a current domain. If the caller hasn't provided a domain then the core must provide an explicit DMA blocking domain that has no DMA map. Lazily create