summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2024-07-12 17:53:39 +0200
committerWill Deacon <will@kernel.org>2024-07-12 17:53:39 +0200
commit5012650a15e4eea14bcd34be1feffb57ee91940d (patch)
tree4c6ce60f7dbca3d389d2aa6eab16ab17ab69b80f
parentMerge branch 'iommu/allwinner/sun50i' into iommu/next (diff)
parentiommu/amd: Use try_cmpxchg64() in v2_alloc_pte() (diff)
downloadlinux-5012650a15e4eea14bcd34be1feffb57ee91940d.tar.xz
linux-5012650a15e4eea14bcd34be1feffb57ee91940d.zip
Merge branch 'iommu/amd/amd-vi' into iommu/next
* iommu/amd/amd-vi: iommu/amd: Use try_cmpxchg64() in v2_alloc_pte()
-rw-r--r--drivers/iommu/amd/io_pgtable_v2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/amd/io_pgtable_v2.c b/drivers/iommu/amd/io_pgtable_v2.c
index 78ac37c5ccc1..664e91c88748 100644
--- a/drivers/iommu/amd/io_pgtable_v2.c
+++ b/drivers/iommu/amd/io_pgtable_v2.c
@@ -158,7 +158,7 @@ static u64 *v2_alloc_pte(int nid, u64 *pgd, unsigned long iova,
__npte = set_pgtable_attr(page);
/* pte could have been changed somewhere. */
- if (cmpxchg64(pte, __pte, __npte) != __pte)
+ if (!try_cmpxchg64(pte, &__pte, __npte))
iommu_free_page(page);
else if (IOMMU_PTE_PRESENT(__pte))
*updated = true;