[PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-04-30 Thread Jean-Philippe Brucker
The sva_bind() function allows devices to access process address spaces using a PASID (aka SSID). (1) bind() allocates or gets an existing MMU notifier tied to the (domain, mm) pair. Each mm gets one PASID. (2) Any change to the address space calls invalidate_range() which sends ATC inval

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-04-30 Thread Jacob Pan
Hi Jean, A couple question on how SMMU handles CD.v and translation disable. On Thu, 30 Apr 2020 16:34:16 +0200 Jean-Philippe Brucker wrote: > The sva_bind() function allows devices to access process address > spaces using a PASID (aka SSID). > > (1) bind() allocates or gets an existing MMU no

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-01 Thread Christoph Hellwig
> @@ -432,6 +432,7 @@ config ARM_SMMU_V3 > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > depends on ARM64 > select IOMMU_API > + select IOMMU_SVA > select IOMMU_IO_PGTABLE_LPAE > select GENERIC_MSI_IRQ_DOMAIN Doesn't this need to select MMU_NOTIFIER

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-01 Thread Jason Gunthorpe
On Fri, May 01, 2020 at 05:15:52AM -0700, Christoph Hellwig wrote: > > @@ -432,6 +432,7 @@ config ARM_SMMU_V3 > > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > depends on ARM64 > > select IOMMU_API > > + select IOMMU_SVA > > select IOMMU_IO_PGTABLE_LPAE > > sel

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-04 Thread Jean-Philippe Brucker
On Fri, May 01, 2020 at 05:15:52AM -0700, Christoph Hellwig wrote: > > @@ -432,6 +432,7 @@ config ARM_SMMU_V3 > > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > depends on ARM64 > > select IOMMU_API > > + select IOMMU_SVA > > select IOMMU_IO_PGTABLE_LPAE > > sel

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-04 Thread Jean-Philippe Brucker
On Fri, May 01, 2020 at 09:55:13AM -0300, Jason Gunthorpe wrote: > On Fri, May 01, 2020 at 05:15:52AM -0700, Christoph Hellwig wrote: > > > @@ -432,6 +432,7 @@ config ARM_SMMU_V3 > > > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > > depends on ARM64 > > > select IOMMU_API > >

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-04 Thread Jean-Philippe Brucker
On Thu, Apr 30, 2020 at 02:16:17PM -0700, Jacob Pan wrote: > > +static void arm_smmu_mm_invalidate_range(struct mmu_notifier *mn, > > +struct mm_struct *mm, > > +unsigned long start, > > unsigned long end) +{ > > + /* TODO: i

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-04 Thread Jacob Pan
On Mon, 4 May 2020 18:43:51 +0200 Jean-Philippe Brucker wrote: > On Thu, Apr 30, 2020 at 02:16:17PM -0700, Jacob Pan wrote: > > > +static void arm_smmu_mm_invalidate_range(struct mmu_notifier *mn, > > > + struct mm_struct *mm, > > > +

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-05 Thread Jean-Philippe Brucker
On Mon, May 04, 2020 at 01:47:23PM -0700, Jacob Pan wrote: > > > > + arm_smmu_write_ctx_desc(smmu_domain, mm->pasid, > > > > &invalid_cd); + > > > > + arm_smmu_tlb_inv_asid(smmu_domain->smmu, > > > > smmu_mn->cd->asid); > > > > + /* TODO: invalidate ATS */ > > > > + > > > If mm

Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-05-07 Thread Jacob Pan
On Tue, 5 May 2020 11:15:31 +0200 Jean-Philippe Brucker wrote: > On Mon, May 04, 2020 at 01:47:23PM -0700, Jacob Pan wrote: > > > > > + arm_smmu_write_ctx_desc(smmu_domain, mm->pasid, > > > > > &invalid_cd); + > > > > > + arm_smmu_tlb_inv_asid(smmu_domain->smmu, > > > > > smmu_mn->cd->asi