Commit 01699160 authored by Vasant Hegde's avatar Vasant Hegde Committed by Joerg Roedel
Browse files

iommu/amd/pgtbl_v2: Take protection domain lock before invalidating TLB



Commit c7fc1235 ("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: c7fc1235 ("iommu/amd/pgtbl_v2: Invalidate updated page ranges only")
Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20241030063556.6104-2-vasant.hegde@amd.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 556af583
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -268,8 +268,11 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
out:
	if (updated) {
		struct protection_domain *pdom = io_pgtable_ops_to_domain(ops);
		unsigned long flags;

		spin_lock_irqsave(&pdom->lock, flags);
		amd_iommu_domain_flush_pages(pdom, o_iova, size);
		spin_unlock_irqrestore(&pdom->lock, flags);
	}

	if (mapped)