iommu/amd/pgtbl_v2: Take protection domain lock before invalidating TLB
BugLink: https://bugs.launchpad.net/bugs/2101915 [ Upstream commit 016991606aa01c4d92e6941be636c0c897aa05c7 ] Commitc7fc12354b("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:c7fc12354b("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> Signed-off-by: Sasha Levin <sashal@kernel.org> [koichiroden: adjusted context without backporting the following commits (which have been applied in linux-6.11.y) to avoid multiple conflicts and reduce regression risk: - 9ac0b3380acd ("iommu/amd: Narrow the use of struct protection_domain to invalidation") - 47f218d10895 ("iommu/amd: Store the nid in io_pgtable_cfg instead of the domain") - 670b57796c5d ("iommu/amd: Rename struct amd_io_pgtable iopt to pgtbl") - 1ed2d21d471c ("iommu/amd: Remove the amd_iommu_domain_set_pt_root() and related")] Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
This commit is contained in:
committed by
Stefan Bader
parent
258f582713
commit
c0471c0ffd
@@ -270,8 +270,13 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
|
||||
}
|
||||
|
||||
out:
|
||||
if (updated)
|
||||
if (updated) {
|
||||
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)
|
||||
*mapped += mapped_size;
|
||||
|
||||
Reference in New Issue
Block a user