* [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c
@ 2024-10-07 8:43 Uros Bizjak
2024-10-08 18:12 ` Jason Gunthorpe
2024-10-15 8:22 ` Joerg Roedel
0 siblings, 2 replies; 3+ messages in thread
From: Uros Bizjak @ 2024-10-07 8:43 UTC (permalink / raw)
To: iommu, linux-kernel
Cc: Uros Bizjak, Joerg Roedel, Suravee Suthikulpanit, Will Deacon,
Robin Murphy
Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
to use optimized implementation and ease register pressure around
the primitive for targets that implement optimized variant.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
---
drivers/iommu/amd/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 8364cd6fa47d..074effba7fbe 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1230,7 +1230,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
if (!iommu->need_sync)
return 0;
- data = atomic64_add_return(1, &iommu->cmd_sem_val);
+ data = atomic64_inc_return(&iommu->cmd_sem_val);
build_completion_wait(&cmd, iommu, data);
raw_spin_lock_irqsave(&iommu->lock, flags);
@@ -2890,7 +2890,7 @@ static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid)
return;
build_inv_irt(&cmd, devid);
- data = atomic64_add_return(1, &iommu->cmd_sem_val);
+ data = atomic64_inc_return(&iommu->cmd_sem_val);
build_completion_wait(&cmd2, iommu, data);
raw_spin_lock_irqsave(&iommu->lock, flags);
--
2.46.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c
2024-10-07 8:43 [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c Uros Bizjak
@ 2024-10-08 18:12 ` Jason Gunthorpe
2024-10-15 8:22 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2024-10-08 18:12 UTC (permalink / raw)
To: Uros Bizjak
Cc: iommu, linux-kernel, Joerg Roedel, Suravee Suthikulpanit,
Will Deacon, Robin Murphy
On Mon, Oct 07, 2024 at 10:43:31AM +0200, Uros Bizjak wrote:
> Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
> to use optimized implementation and ease register pressure around
> the primitive for targets that implement optimized variant.
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/iommu/amd/iommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c
2024-10-07 8:43 [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c Uros Bizjak
2024-10-08 18:12 ` Jason Gunthorpe
@ 2024-10-15 8:22 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2024-10-15 8:22 UTC (permalink / raw)
To: Uros Bizjak
Cc: iommu, linux-kernel, Suravee Suthikulpanit, Will Deacon,
Robin Murphy
On Mon, Oct 07, 2024 at 10:43:31AM +0200, Uros Bizjak wrote:
> Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
> to use optimized implementation and ease register pressure around
> the primitive for targets that implement optimized variant.
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/iommu/amd/iommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-15 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 8:43 [PATCH] iommu/amd: Use atomic64_inc_return() in iommu.c Uros Bizjak
2024-10-08 18:12 ` Jason Gunthorpe
2024-10-15 8:22 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox