Skip to content

Commit 0169916

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd/pgtbl_v2: Take protection domain lock before invalidating TLB
Commit c7fc123 ("iommu/amd/pgtbl_v2: Invalidate updated page ranges only") missed to take domain lock before calling amd_iommu_domain_flush_pages(). Fix this by taking protection domain lock before calling TLB invalidation function. Fixes: c7fc123 ("iommu/amd/pgtbl_v2: Invalidate updated page ranges only") Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20241030063556.6104-2-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 556af58 commit 0169916

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iommu/amd/io_pgtable_v2.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
268268
out:
269269
if (updated) {
270270
struct protection_domain *pdom = io_pgtable_ops_to_domain(ops);
271+
unsigned long flags;
271272

273+
spin_lock_irqsave(&pdom->lock, flags);
272274
amd_iommu_domain_flush_pages(pdom, o_iova, size);
275+
spin_unlock_irqrestore(&pdom->lock, flags);
273276
}
274277

275278
if (mapped)

0 commit comments

Comments
 (0)