Re: [PATCH v3 4/4] vfio: Require that devices support DMA cache coherence

2022-07-04 Thread chenxiang (M) via iommu
Hi, We encounter a issue with the patch: our platform is ARM64, and we run DPDK with smmu disable on VM (without iommu=smmuv3 etc), so we use noiommu mode with enable_unsafe_noiommu_mode=1 to passthrough the device to VM with following steps (those steps are on VM) : insmod vfio.ko enable_u

Re: [PATCH v2 00/24] iommu: Refactor DMA domain strictness

2021-07-29 Thread chenxiang (M)
在 2021/7/29 18:59, Robin Murphy 写道: On 2021-07-29 03:55, chenxiang (M) wrote: Hi Robin, 在 2021/7/28 23:58, Robin Murphy 写道: Hi all, Here's v2 where things start to look more realistic, hence the expanded CC list. The patches are now based on the current iommu/core branch to take J

Re: [PATCH v2 00/24] iommu: Refactor DMA domain strictness

2021-07-28 Thread chenxiang (M)
Hi Robin, 在 2021/7/28 23:58, Robin Murphy 写道: Hi all, Here's v2 where things start to look more realistic, hence the expanded CC list. The patches are now based on the current iommu/core branch to take John's iommu_set_dma_strict() cleanup into account. The series remiains in two (or possibly

Re: [PATCH v7 00/15] Optimizing iommu_[map/unmap] performance

2021-07-14 Thread chenxiang (M)
在 2021/7/15 9:23, Lu Baolu 写道: On 7/14/21 10:24 PM, Georgi Djakov wrote: On 16.06.21 16:38, Georgi Djakov wrote: When unmapping a buffer from an IOMMU domain, the IOMMU framework unmaps the buffer at a granule of the largest page size that is supported by the IOMMU hardware and fits within t

Re: [Linuxarm] Re: [PATCH 0/4] Free cached iovas when rmmod the driver of the last device in group

2021-06-08 Thread chenxiang (M)
Hi Robin, 在 2021/6/7 19:23, Robin Murphy 写道: On 2021-06-07 03:42, chenxiang wrote: From: Xiang Chen When rmmod the driver of the last device in the group, cached iovas are not used, and it is better to free them to save memories. And also export function free_rcache_cached_iovas() and iomm

Re: [PATCH] dma-iommu: Add a check to avoid dereference null pointer in function iommu_dma_map_sg()

2021-05-21 Thread chenxiang (M)
在 2021/5/21 18:36, Robin Murphy 写道: On 2021-05-21 04:05, chenxiang wrote: From: Xiang Chen The issue is reported by tool TscanCode, and it is possible to deference null pointer when prev is NULL which is the initial value. No it isn't. This is literally explained in the comment visible in

Re: [PATCH v3] iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock

2021-05-18 Thread chenxiang (M)
Hi Joerg, 在 2021/5/18 17:08, Joerg Roedel 写道: On Mon, Apr 19, 2021 at 03:13:35PM +0800, chenxiang wrote: From: Xiang Chen It is not necessary to put free_iova_mem() inside of spinlock/unlock iova_rbtree_lock which only leads to more completion for the spinlock. It has a small promote on the p

Re: [RFC PATCH v5 11/15] iommu/io-pgtable-arm: Implement arm_lpae_map_pages()

2021-04-19 Thread chenxiang (M)
Hi Isaac, 在 2021/4/9 1:13, Isaac J. Manjarres 写道: Implement the map_pages() callback for the ARM LPAE io-pgtable format. Signed-off-by: Isaac J. Manjarres --- drivers/iommu/io-pgtable-arm.c | 42 ++ 1 file changed, 32 insertions(+), 10 deletions(-) diff --g

Re: [PATCH v2] iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock

2021-04-16 Thread chenxiang (M)
在 2021/4/16 16:53, John Garry 写道: On 16/04/2021 04:30, chenxiang (M) wrote: you need to make this: if (iova) free_iova_mem(iova); as free_iova_mem(iova) dereferences iova: if (iova->pfn_lo != IOVA_ANCHOR) kmem_cache_free(iova_cache, iova) So if iova were NULL, we cr

Re: [PATCH v2] iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock

2021-04-15 Thread chenxiang (M)
在 2021/4/15 17:49, John Garry 写道: On 15/04/2021 04:52, chenxiang wrote: From: Xiang Chen It is not necessary to put free_iova_mem() inside of spinlock/unlock iova_rbtree_lock which only leads to more completion for the spinlock. It has a small promote on the performance after the change. And

Re: [PATCH] iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock

2021-04-14 Thread chenxiang (M)
Hi Robin, 在 2021/4/14 21:17, Robin Murphy 写道: On 2021-04-14 07:38, chenxiang wrote: From: Xiang Chen It is not necessary to put free_iova_mem() inside of spinlock/unlock iova_rbtree_lock which only leads to more completion for the spinlock. It has a small promote on the performance after the

Re: [PATCH] iommu: Add device name to iommu map/unmap trace events

2021-04-05 Thread chenxiang (M)
Hi, 在 2021/2/12 18:50, Joerg Roedel 写道: On Tue, Feb 09, 2021 at 06:06:20PM +0530, Sai Prakash Ranjan wrote: diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 5e7fe519430a..6064187d9bb6 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -87,6 +87,7 @@ struct iommu_

Re: [RFC PATCH 0/5] Optimization for unmapping iommu mapped buffers

2021-03-31 Thread chenxiang (M)
Hi Isaac, 在 2021/3/31 11:00, Isaac J. Manjarres 写道: When unmapping a buffer from an IOMMU domain, the IOMMU framework unmaps the buffer at a granule of the largest page size that is supported by the IOMMU hardware and fits within the buffer. For every block that is unmapped, the IOMMU framework

Re: [PATCH] iommu: Add a check to avoid invalid iotlb sync

2021-03-30 Thread chenxiang (M)
在 2021/3/30 17:25, Will Deacon 写道: On Tue, Mar 30, 2021 at 10:04:53AM +0100, Robin Murphy wrote: On 2021-03-30 02:22, chenxiang (M) wrote: Hi Will, 在 2021/3/29 22:45, Will Deacon 写道: On Sat, Mar 27, 2021 at 02:23:10PM +0800, chenxiang wrote: From: Xiang Chen Currently it will send a

Re: [PATCH] iommu: Add a check to avoid invalid iotlb sync

2021-03-29 Thread chenxiang (M)
Hi Will, 在 2021/3/29 22:45, Will Deacon 写道: On Sat, Mar 27, 2021 at 02:23:10PM +0800, chenxiang wrote: From: Xiang Chen Currently it will send a iotlb sync at end of iommu unmap even if iotlb_gather is not valid (iotlb_gather->pgsize = 0). Actually it is not necessary, so add a check to avoi

Re: [Linuxarm] Re: [PATCH v14 07/13] iommu/smmuv3: Implement cache_invalidate

2021-03-22 Thread chenxiang (M)
Hi Eric, 在 2021/3/22 17:05, Auger Eric 写道: Hi Chenxiang, On 3/22/21 7:40 AM, chenxiang (M) wrote: Hi Eric, 在 2021/3/20 1:36, Auger Eric 写道: Hi Chenxiang, On 3/4/21 8:55 AM, chenxiang (M) wrote: Hi Eric, 在 2021/2/24 4:56, Eric Auger 写道: Implement domain-selective, pasid selective and

Re: [Linuxarm] Re: [PATCH v14 07/13] iommu/smmuv3: Implement cache_invalidate

2021-03-21 Thread chenxiang (M)
Hi Eric, 在 2021/3/20 1:36, Auger Eric 写道: Hi Chenxiang, On 3/4/21 8:55 AM, chenxiang (M) wrote: Hi Eric, 在 2021/2/24 4:56, Eric Auger 写道: Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v13 -> v14: - Add dom

Re: [PATCH] iommu/dma: Fix a typo in a comment

2021-03-21 Thread chenxiang (M)
在 2021/3/19 19:02, Robin Murphy 写道: On 2021-03-19 01:02, chenxiang (M) wrote: Hi, 在 2021/3/18 19:01, Robin Murphy 写道: On 2021-03-18 09:55, chenxiang (M) wrote: Hi will, 在 2021/3/18 17:34, Will Deacon 写道: On Thu, Mar 18, 2021 at 11:21:24AM +0800, chenxiang wrote: From: Xiang Chen Fix

Re: [PATCH] iommu/dma: Fix a typo in a comment

2021-03-18 Thread chenxiang (M)
Hi, 在 2021/3/18 19:01, Robin Murphy 写道: On 2021-03-18 09:55, chenxiang (M) wrote: Hi will, 在 2021/3/18 17:34, Will Deacon 写道: On Thu, Mar 18, 2021 at 11:21:24AM +0800, chenxiang wrote: From: Xiang Chen Fix a type "SAC" to "DAC" in the comment of function iommu_dma_a

Re: [PATCH] iommu/dma: Fix a typo in a comment

2021-03-18 Thread chenxiang (M)
Hi will, 在 2021/3/18 17:34, Will Deacon 写道: On Thu, Mar 18, 2021 at 11:21:24AM +0800, chenxiang wrote: From: Xiang Chen Fix a type "SAC" to "DAC" in the comment of function iommu_dma_alloc_iova(). Signed-off-by: Xiang Chen --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertio

Re: [PATCH v14 07/13] iommu/smmuv3: Implement cache_invalidate

2021-03-03 Thread chenxiang (M)
Hi Eric, 在 2021/2/24 4:56, Eric Auger 写道: Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v13 -> v14: - Add domain invalidation - do global inval when asid is not provided with addr granularity v7 -> v8: - ASID based inva

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

2021-01-29 Thread chenxiang (M)
Hi Robin, 在 2021/1/29 20:03, Robin Murphy 写道: 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 commit was made for a reason - how d

Re: [PATCH v13 08/15] iommu/smmuv3: Implement cache_invalidate

2021-01-15 Thread chenxiang (M)
Hi Eric, 在 2020/11/18 19:21, Eric Auger 写道: Implement domain-selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v7 -> v8: - ASID based invalidation using iommu_inv_pasid_info - check ARCHID/PASID flags in addr based invalidation - use __arm_smmu_tlb_inv_context a

Re: Consult on ARM SMMU debugfs

2021-01-15 Thread chenxiang (M)
在 2021/1/12 4:01, Robin Murphy 写道: On 2021-01-07 02:45, chenxiang (M) wrote: Hi Will, Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs for ARM SMMU driver (such as the value of STE/CD which we need to check sometimes

Consult on ARM SMMU debugfs

2021-01-06 Thread chenxiang (M)
Hi Will, Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs for ARM SMMU driver (such as the value of STE/CD which we need to check sometimes). Currently it creates top-level iommu directory in debugfs, but there is no debugfs