]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/amd/pgtbl_v2: Take protection domain lock before invalidating TLB
authorVasant Hegde <vasant.hegde@amd.com>
Wed, 30 Oct 2024 06:35:45 +0000 (06:35 +0000)
committerJoerg Roedel <jroedel@suse.de>
Wed, 30 Oct 2024 10:06:39 +0000 (11:06 +0100)
Commit c7fc12354be0 ("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: c7fc12354be0 ("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>
drivers/iommu/amd/io_pgtable_v2.c

index 25b9042fa4530791b36f6e89fbfb4c55f4b3da13..c616de2c5926ec837557afdccb76a015e439b939 100644 (file)
@@ -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)