All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3
@ 2021-07-31  2:17 chenxiang
  2021-07-31  2:17 ` [PATCH 1/2] iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback chenxiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: chenxiang @ 2021-07-31  2:17 UTC (permalink / raw)
  To: robin.murphy, will, joro; +Cc: iommu, linuxarm

From: Xiang Chen <chenxiang66@hisilicon.com>

The series ("Optimizing iommu_[map/unmap] performance") improve the
iommu_[map/unmap] performance. Based on the series, implement [map/unmap]_pages
callbacks for ARM SMMUV3.
Use tool dma_map_benchmark to test the latency of map/unmap, and it promotes
much on it. The test result is as follows:
t = 1(thread = 1):
                   before opt(us)   after opt(us)
g=1(4K size)        0.1/1.3          0.1/0.8
g=2(8K size)        0.2/1.5          0.2/0.9
g=4(16K size)       0.3/1.9          0.1/1.1
g=8(32K size)       0.5/2.7          0.2/1.4
g=16(64K size)      1.0/4.5          0.2/2.0
g=32(128K size)     1.8/7.9          0.2/3.3
g=64(256K size)     3.7/14.8         0.4/6.1
g=128(512K size)    7.1/14.7         0.5/10.4
g=256(1M size)      14.0/53.9        0.8/19.3
g=512(2M size)      0.2/0.9          0.2/0.9
g=1024(4M size)     0.5/1.5          0.4/1.0

t = 10(thread = 10):
                   before opt(us)   after opt(us)
g=1(4K size)        0.3/7.0          0.1/5.8
g=2(8K size)        0.4/6.7          0.3/6.0
g=4(16K size)       0.5/6.3          0.3/5.6
g=8(32K size)       0.5/8.3          0.2/6.3
g=16(64K size)      1.0/17.3         0.3/12.4
g=32(128K size)     1.8/36.0         0.2/24.2
g=64(256K size)     4.3/67.2         1.2/46.4
g=128(512K size)    7.8/93.7         1.3/94.2
g=256(1M size)      14.7/280.8       1.8/191.5
g=512(2M size)      3.6/3.2          1.5/2.5
g=1024(4M size)     2.0/3.1          1.8/2.6 

Xiang Chen (2):
  iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback
  iommu/arm-smmu-v3: Implement the map_pages() IOMMU driver callback

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

-- 
2.8.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback
  2021-07-31  2:17 [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 chenxiang
@ 2021-07-31  2:17 ` chenxiang
  2021-07-31  2:17 ` [PATCH 2/2] iommu/arm-smmu-v3: Implement the map_pages() " chenxiang
  2021-08-02 14:43 ` [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: chenxiang @ 2021-07-31  2:17 UTC (permalink / raw)
  To: robin.murphy, will, joro; +Cc: iommu, linuxarm

From: Xiang Chen <chenxiang66@hisilicon.com>

Implement the unmap_pages() callback for ARM SMMUV3 driver to allow calls
from iommu_unmap to unmap multiple pages of the same size in one call.
Also remove the unmap() callback for the ARM SMMUV3 driver as it will
no longer be used.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 6346f21..2060e6d 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2450,8 +2450,9 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
 	return ops->map(ops, iova, paddr, size, prot, gfp);
 }
 
-static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
-			     size_t size, struct iommu_iotlb_gather *gather)
+static size_t arm_smmu_unmap_pages(struct iommu_domain *domain, unsigned long iova,
+				   size_t pgsize, size_t pgcount,
+				   struct iommu_iotlb_gather *gather)
 {
 	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
 	struct io_pgtable_ops *ops = smmu_domain->pgtbl_ops;
@@ -2459,7 +2460,7 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
 	if (!ops)
 		return 0;
 
-	return ops->unmap(ops, iova, size, gather);
+	return ops->unmap_pages(ops, iova, pgsize, pgcount, gather);
 }
 
 static void arm_smmu_flush_iotlb_all(struct iommu_domain *domain)
@@ -2823,7 +2824,7 @@ static struct iommu_ops arm_smmu_ops = {
 	.domain_free		= arm_smmu_domain_free,
 	.attach_dev		= arm_smmu_attach_dev,
 	.map			= arm_smmu_map,
-	.unmap			= arm_smmu_unmap,
+	.unmap_pages		= arm_smmu_unmap_pages,
 	.flush_iotlb_all	= arm_smmu_flush_iotlb_all,
 	.iotlb_sync		= arm_smmu_iotlb_sync,
 	.iova_to_phys		= arm_smmu_iova_to_phys,
-- 
2.8.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iommu/arm-smmu-v3: Implement the map_pages() IOMMU driver callback
  2021-07-31  2:17 [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 chenxiang
  2021-07-31  2:17 ` [PATCH 1/2] iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback chenxiang
@ 2021-07-31  2:17 ` chenxiang
  2021-08-02 14:43 ` [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: chenxiang @ 2021-07-31  2:17 UTC (permalink / raw)
  To: robin.murphy, will, joro; +Cc: iommu, linuxarm

From: Xiang Chen <chenxiang66@hisilicon.com>

Implement the map_pages() callback for ARM SMMUV3 driver to allow calls
from iommu_map to map multiple pages of the same size in one call.
Also remove the map() callback for the ARM SMMUV3 driver as it will no
longer be used.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 2060e6d..35d5491 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2439,15 +2439,16 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 	return ret;
 }
 
-static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
-			phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
+static int arm_smmu_map_pages(struct iommu_domain *domain, unsigned long iova,
+			      phys_addr_t paddr, size_t pgsize, size_t pgcount,
+			      int prot, gfp_t gfp, size_t *mapped)
 {
 	struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops;
 
 	if (!ops)
 		return -ENODEV;
 
-	return ops->map(ops, iova, paddr, size, prot, gfp);
+	return ops->map_pages(ops, iova, paddr, pgsize, pgcount, prot, gfp, mapped);
 }
 
 static size_t arm_smmu_unmap_pages(struct iommu_domain *domain, unsigned long iova,
@@ -2823,7 +2824,7 @@ static struct iommu_ops arm_smmu_ops = {
 	.domain_alloc		= arm_smmu_domain_alloc,
 	.domain_free		= arm_smmu_domain_free,
 	.attach_dev		= arm_smmu_attach_dev,
-	.map			= arm_smmu_map,
+	.map_pages		= arm_smmu_map_pages,
 	.unmap_pages		= arm_smmu_unmap_pages,
 	.flush_iotlb_all	= arm_smmu_flush_iotlb_all,
 	.iotlb_sync		= arm_smmu_iotlb_sync,
-- 
2.8.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3
  2021-07-31  2:17 [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 chenxiang
  2021-07-31  2:17 ` [PATCH 1/2] iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback chenxiang
  2021-07-31  2:17 ` [PATCH 2/2] iommu/arm-smmu-v3: Implement the map_pages() " chenxiang
@ 2021-08-02 14:43 ` Will Deacon
  2021-08-02 14:56   ` Joerg Roedel
  2 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2021-08-02 14:43 UTC (permalink / raw)
  To: chenxiang; +Cc: robin.murphy, iommu, linuxarm

On Sat, Jul 31, 2021 at 10:17:09AM +0800, chenxiang wrote:
> From: Xiang Chen <chenxiang66@hisilicon.com>
> 
> The series ("Optimizing iommu_[map/unmap] performance") improve the
> iommu_[map/unmap] performance. Based on the series, implement [map/unmap]_pages
> callbacks for ARM SMMUV3.
> Use tool dma_map_benchmark to test the latency of map/unmap, and it promotes
> much on it. The test result is as follows:
> t = 1(thread = 1):
>                    before opt(us)   after opt(us)
> g=1(4K size)        0.1/1.3          0.1/0.8
> g=2(8K size)        0.2/1.5          0.2/0.9
> g=4(16K size)       0.3/1.9          0.1/1.1
> g=8(32K size)       0.5/2.7          0.2/1.4
> g=16(64K size)      1.0/4.5          0.2/2.0
> g=32(128K size)     1.8/7.9          0.2/3.3
> g=64(256K size)     3.7/14.8         0.4/6.1
> g=128(512K size)    7.1/14.7         0.5/10.4
> g=256(1M size)      14.0/53.9        0.8/19.3
> g=512(2M size)      0.2/0.9          0.2/0.9
> g=1024(4M size)     0.5/1.5          0.4/1.0
> 
> t = 10(thread = 10):
>                    before opt(us)   after opt(us)
> g=1(4K size)        0.3/7.0          0.1/5.8
> g=2(8K size)        0.4/6.7          0.3/6.0
> g=4(16K size)       0.5/6.3          0.3/5.6
> g=8(32K size)       0.5/8.3          0.2/6.3
> g=16(64K size)      1.0/17.3         0.3/12.4
> g=32(128K size)     1.8/36.0         0.2/24.2
> g=64(256K size)     4.3/67.2         1.2/46.4
> g=128(512K size)    7.8/93.7         1.3/94.2
> g=256(1M size)      14.7/280.8       1.8/191.5
> g=512(2M size)      3.6/3.2          1.5/2.5
> g=1024(4M size)     2.0/3.1          1.8/2.6 
> 
> Xiang Chen (2):
>   iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback
>   iommu/arm-smmu-v3: Implement the map_pages() IOMMU driver callback

For both patches:

Acked-by: Will Deacon <will@kernel.org>

Joerg -- please can you take these directly? They build on top of the
changes from Isaac which you have queued on your 'core' branch.

Cheers,

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3
  2021-08-02 14:43 ` [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 Will Deacon
@ 2021-08-02 14:56   ` Joerg Roedel
  0 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2021-08-02 14:56 UTC (permalink / raw)
  To: Will Deacon; +Cc: iommu, robin.murphy, linuxarm

On Mon, Aug 02, 2021 at 03:43:20PM +0100, Will Deacon wrote:
> For both patches:
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Joerg -- please can you take these directly? They build on top of the
> changes from Isaac which you have queued on your 'core' branch.

Sure, applied to core branch now.

Thanks,

	Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-02 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  2:17 [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 chenxiang
2021-07-31  2:17 ` [PATCH 1/2] iommu/arm-smmu-v3: Implement the unmap_pages() IOMMU driver callback chenxiang
2021-07-31  2:17 ` [PATCH 2/2] iommu/arm-smmu-v3: Implement the map_pages() " chenxiang
2021-08-02 14:43 ` [PATCH 0/2] Implement [map/unmap]_pages callbacks for ARM SMMUV3 Will Deacon
2021-08-02 14:56   ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.