Skip to content

Commit 5ce73c5

Browse files
ubizjakjoergroedel
authored andcommitted
iommu/amd: Use atomic64_inc_return() in iommu.c
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> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20241007084356.47799-1-ubizjak@gmail.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 8e929cb commit 5ce73c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
12301230
if (!iommu->need_sync)
12311231
return 0;
12321232

1233-
data = atomic64_add_return(1, &iommu->cmd_sem_val);
1233+
data = atomic64_inc_return(&iommu->cmd_sem_val);
12341234
build_completion_wait(&cmd, iommu, data);
12351235

12361236
raw_spin_lock_irqsave(&iommu->lock, flags);
@@ -2890,7 +2890,7 @@ static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid)
28902890
return;
28912891

28922892
build_inv_irt(&cmd, devid);
2893-
data = atomic64_add_return(1, &iommu->cmd_sem_val);
2893+
data = atomic64_inc_return(&iommu->cmd_sem_val);
28942894
build_completion_wait(&cmd2, iommu, data);
28952895

28962896
raw_spin_lock_irqsave(&iommu->lock, flags);

0 commit comments

Comments
 (0)