Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-03-01 Thread Keqian Zhu
Hi Robin, I am going to send v2 at next week, to addresses these issues reported by you. Many thanks! And do you have any further comments on patch #4 #5 and #6? Thanks, Keqian On 2021/2/5 3:50, Robin Murphy wrote: > On 2021-01-28 15:17, Keqian Zhu wrote: >> From: jiangkunkun >> >> The SMMU

Re: [PATCH v6 08/12] fork: Clear PASID for new mm

2021-03-01 Thread Jacob Pan
Hi Fenghua, On Thu, 25 Feb 2021 22:17:11 +, Fenghua Yu wrote: > Hi, Jean, > > On Wed, Feb 24, 2021 at 11:19:27AM +0100, Jean-Philippe Brucker wrote: > > Hi Fenghua, > > > > [Trimmed the Cc list] > > > > On Mon, Jul 13, 2020 at 04:48:03PM -0700, Fenghua Yu wrote: > > > When a new mm is

Re: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails"

2021-03-01 Thread John Garry
On 01/03/2021 13:20, Robin Murphy wrote: FWIW, I'm 99% sure that what you really want is [1], but then you get to battle against an unknown quantity of dodgy firmware instead. Something which has not been said before is that this only happens for strict mode. I think that makes sense - once

Re: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails"

2021-03-01 Thread Robin Murphy
On 2021-02-25 13:54, John Garry wrote: On 29/01/2021 12:03, Robin Murphy wrote: On 2021-01-29 09:48, Leizhen (ThunderTown) wrote: Currently, we are thinking about the solution to the problem. However, because the end time of v5.11 is approaching, this patch is sent first. However, that

[PATCH 0/3] iommu/iova: Add CPU hotplug handler to flush rcaches to core code

2021-03-01 Thread John Garry
The Intel IOMMU driver supports flushing the per-CPU rcaches when a CPU is offlined. Let's move it to core code, so everyone can take advantage. Also correct a code comment. Based on v5.12-rc1. Tested on arm64 only. John Garry (3): iova: Add CPU hotplug handler to flush rcaches iommu/vt-d:

[PATCH 2/3] iommu/vt-d: Remove IOVA domain rcache flushing for CPU offlining

2021-03-01 Thread John Garry
Now that the core code handles flushing per-IOVA domain CPU rcaches, remove the handling here. Signed-off-by: John Garry --- drivers/iommu/intel/iommu.c | 31 --- include/linux/cpuhotplug.h | 1 - 2 files changed, 32 deletions(-) diff --git

[PATCH 1/3] iova: Add CPU hotplug handler to flush rcaches

2021-03-01 Thread John Garry
Like the intel IOMMU driver already does, flush the per-IOVA domain CPU rcache when a CPU goes offline - there's no point in keeping it. Signed-off-by: John Garry --- drivers/iommu/iova.c | 30 +- include/linux/cpuhotplug.h | 1 + include/linux/iova.h |

[PATCH 3/3] iova: Correct comment for free_cpu_cached_iovas()

2021-03-01 Thread John Garry
Function free_cpu_cached_iovas() is not only called when a CPU is hotplugged, so remove that part of the code comment. Signed-off-by: John Garry --- drivers/iommu/iova.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index

[PATCH 6/6] media: uvcvideo: Use dma_alloc_noncontiguos API

2021-03-01 Thread Christoph Hellwig
From: Ricardo Ribalda On architectures where the is no coherent caching such as ARM use the dma_alloc_noncontiguos API and handle manually the cache flushing using dma_sync_sgtable(). With this patch on the affected architectures we can measure up to 20x performance improvement in

[PATCH 5/6] dma-iommu: implement ->alloc_noncontiguous

2021-03-01 Thread Christoph Hellwig
Implement support for allocating a non-contiguous DMA region. Signed-off-by: Christoph Hellwig Reviewed-by: Tomasz Figa Tested-by: Ricardo Ribalda --- drivers/iommu/dma-iommu.c | 36 1 file changed, 36 insertions(+) diff --git a/drivers/iommu/dma-iommu.c

[PATCH 4/6] dma-iommu: refactor iommu_dma_alloc_remap

2021-03-01 Thread Christoph Hellwig
Split out a new helper that only allocates a sg_table worth of memory without mapping it into contiguous kernel address space. Signed-off-by: Christoph Hellwig Reviewed-by: Tomasz Figa Tested-by: Ricardo Ribalda --- drivers/iommu/dma-iommu.c | 67 --- 1

[PATCH 3/6] dma-mapping: add a dma_alloc_noncontiguous API

2021-03-01 Thread Christoph Hellwig
Add a new API that returns a potentiall virtually non-contigous sg_table and a DMA address. This API is only properly implemented for dma-iommu and will simply return a contigious chunk as a fallback. The intent is that drivers can use this API if either: - no kernel mapping or only temporary

[PATCH 2/6] dma-mapping: refactor dma_{alloc,free}_pages

2021-03-01 Thread Christoph Hellwig
Factour out internal versions without the dma_debug calls in preparation for callers that will need different dma_debug calls. Note that this changes the dma_debug calls to get the not page aligned size values, but as long as alloc and free agree on one variant we are fine. Signed-off-by:

[PATCH 1/6] dma-mapping: add a dma_mmap_pages helper

2021-03-01 Thread Christoph Hellwig
Add a helper to map memory allocated using dma_alloc_pages into a user address space, similar to the dma_alloc_attrs function for coherent allocations. Signed-off-by: Christoph Hellwig Reviewed-by: Tomasz Figa Tested-by: Ricardo Ribalda --- Documentation/core-api/dma-api.rst | 10 ++

add a new dma_alloc_noncontiguous API v3

2021-03-01 Thread Christoph Hellwig
Hi all, this series adds the new noncontiguous DMA allocation API requested by various media driver maintainers. Changes since v2: - rebased to Linux 5.12-rc1 - dropped one already merged patch - pass an attrs argument to dma_alloc_noncontigous - clarify the dma_vmap_noncontiguous

[PATCH 17/17] iommu: remove iommu_domain_set_attr

2021-03-01 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/iommu/iommu.c | 17 - include/linux/iommu.h | 27 --- 2 files changed, 44 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 8490aefd4b41f8..b04e6cefe8520d 100644 ---

[PATCH 16/17] iommu: remove DOMAIN_ATTR_IO_PGTABLE_CFG

2021-03-01 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 40 +++-- drivers/iommu/iommu.c | 9 ++ include/linux/iommu.h | 9 +- 4 files changed, 29

[PATCH 15/17] iommu: remove DOMAIN_ATTR_NESTING

2021-03-01 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 40 ++--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 30 ++-- drivers/iommu/intel/iommu.c | 28 +-- drivers/iommu/iommu.c | 8 +

[PATCH 14/17] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE

2021-03-01 Thread Christoph Hellwig
Use explicit methods for setting and querying the information instead. Also remove the now unused iommu_domain_get_attr functionality. Signed-off-by: Christoph Hellwig --- drivers/iommu/amd/iommu.c | 23 ++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 47

[PATCH 13/17] iommu: remove DOMAIN_ATTR_GEOMETRY

2021-03-01 Thread Christoph Hellwig
The geometry information can be trivially queried from the iommu_domain struture. Signed-off-by: Christoph Hellwig --- drivers/iommu/iommu.c | 20 +++- drivers/soc/fsl/qbman/qman_portal.c | 1 + drivers/vfio/vfio_iommu_type1.c | 26 --

[PATCH 12/17] iommu: remove DOMAIN_ATTR_PAGING

2021-03-01 Thread Christoph Hellwig
DOMAIN_ATTR_PAGING is never used. Signed-off-by: Christoph Hellwig --- drivers/iommu/iommu.c | 5 - include/linux/iommu.h | 1 - 2 files changed, 6 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b212bf0261820b..9a4cda390993e6 100644 ---

[PATCH 11/17] iommu/fsl_pamu: remove the snoop_id field

2021-03-01 Thread Christoph Hellwig
The snoop_id is always set to ~(u32)0. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 5 ++--- drivers/iommu/fsl_pamu_domain.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index

[PATCH 10/17] iommu/fsl_pamu: enable the liodn when attaching a device

2021-03-01 Thread Christoph Hellwig
Instead of a separate call to enable all devices from the list, just enablde the liodn one the device is attached to the iommu domain. This also remove the DOMAIN_ATTR_FSL_PAMU_ENABLE iommu_attr. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 47

[PATCH 09/17] iommu/fsl_pamu: merge handle_attach_device into fsl_pamu_attach_device

2021-03-01 Thread Christoph Hellwig
No good reason to split this functionality over two functions. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 59 +++-- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/drivers/iommu/fsl_pamu_domain.c

[PATCH 08/17] iommu/fsl_pamu: merge pamu_set_liodn and map_liodn

2021-03-01 Thread Christoph Hellwig
Merge the two fuctions that configure the ppaace into a single coherent function. I somehow doubt we need the two pamu_config_ppaace calls, but keep the existing behavior just to be on the safe side. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 65

[PATCH 07/17] iommu/fsl_pamu: replace DOMAIN_ATTR_FSL_PAMU_STASH with a direct call

2021-03-01 Thread Christoph Hellwig
Add a fsl_pamu_configure_l1_stash API that qman_portal can call directly instead of indirecting through the iommu attr API. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/fsl_pamu_stash.h | 12 +++- drivers/iommu/fsl_pamu_domain.c | 16 +++-

[PATCH 06/17] iommu/fsl_pamu: remove ->domain_window_enable

2021-03-01 Thread Christoph Hellwig
The only thing that fsl_pamu_window_enable does for the current caller is to fill in the prot value in the only dma_window structure, and to propagate a few values from the iommu_domain_geometry struture into the dma_window. Remove the dma_window entirely, hardcode the prot value and otherwise

[PATCH 05/17] iommu/fsl_pamu: remove support for multiple windows

2021-03-01 Thread Christoph Hellwig
The only domains allocated forces use of a single window. Remove all the code related to multiple window support, as well as the need for qman_portal to force a single window. Remove the now unused DOMAIN_ATTR_WINDOWS iommu_attr. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu.c

[PATCH 04/17] iommu/fsl_pamu: merge iommu_alloc_dma_domain into fsl_pamu_domain_alloc

2021-03-01 Thread Christoph Hellwig
Keep the functionality to allocate the domain together. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 34 ++--- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c

[PATCH 03/17] iommu/fsl_pamu: remove support for setting DOMAIN_ATTR_GEOMETRY

2021-03-01 Thread Christoph Hellwig
The default geometry is the same as the one set by qman_port given that FSL_PAMU depends on having 64-bit physical and thus DMA addresses. Remove the support to update the geometry and remove the now pointless geom_size field. Signed-off-by: Christoph Hellwig ---

[PATCH 02/17] iommu/fsl_pamu: remove fsl_pamu_get_domain_attr

2021-03-01 Thread Christoph Hellwig
None of the values returned by this function are ever queried. Also remove the DOMAIN_ATTR_FSL_PAMUV1 enum value that is not otherwise used. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 30 -- include/linux/iommu.h | 4 2

[PATCH 01/17] iommu: remove the unused domain_window_disable method

2021-03-01 Thread Christoph Hellwig
domain_window_disable is wired up by fsl_pamu, but never actually called. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu_domain.c | 48 - include/linux/iommu.h | 2 -- 2 files changed, 50 deletions(-) diff --git

cleanup unused or almost unused IOMMU APIs and the FSL PAMU driver

2021-03-01 Thread Christoph Hellwig
Hi all, there are a bunch of IOMMU APIs that are entirely unused, or only used as a private communication channel between the FSL PAMU driver and it's only consumer, the qbman portal driver. So this series drops a huge chunk of entirely unused FSL PAMU functionality, then drops all kinds of

Re: [PATCH 6/7] dma-iommu: implement ->alloc_noncontiguous

2021-03-01 Thread Christoph Hellwig
On Mon, Mar 01, 2021 at 05:02:43PM +0900, Sergey Senozhatsky wrote: > > I plan to resend the whole series with the comments very soon. > > Oh, OK. > > I thought the series was in linux-next already so a single patch > would do. It was, with an emphasys on was. I hadn't realized I need an ack

Re: [PATCH 4/7] dma-mapping: add a dma_alloc_noncontiguous API

2021-03-01 Thread Christoph Hellwig
On Tue, Feb 16, 2021 at 06:55:39PM +, Robin Murphy wrote: > On 2021-02-02 09:51, Christoph Hellwig wrote: >> Add a new API that returns a potentiall virtually non-contigous sg_table >> and a DMA address. This API is only properly implemented for dma-iommu >> and will simply return a

Re: [PATCH 6/7] dma-iommu: implement ->alloc_noncontiguous

2021-03-01 Thread Sergey Senozhatsky
On (21/03/01 08:21), Christoph Hellwig wrote: > On Mon, Mar 01, 2021 at 04:17:42PM +0900, Sergey Senozhatsky wrote: > > > > Do you think we could add the attrs parameter to the > > > > dma_alloc_noncontiguous() API? > > > > > > Yes, we could probably do that. > > > > I can cook a patch, unless