Skip to content

Commit 2212fc2

Browse files
Jon Pan-Dohjoergroedel
authored andcommitted
iommu/amd: Fix domain flush size when syncing iotlb
When running on an AMD vIOMMU, we observed multiple invalidations (of decreasing power of 2 aligned sizes) when unmapping a single page. Domain flush takes gather bounds (end-start) as size param. However, gather->end is defined as the last inclusive address (start + size - 1). This leads to an off by 1 error. With this patch, verified that 1 invalidation occurs when unmapping a single page. Fixes: a270be1 ("iommu/amd: Use only natural aligned flushes in a VM") Cc: [email protected] # >= 5.15 Signed-off-by: Jon Pan-Doh <[email protected]> Tested-by: Sudheer Dantuluri <[email protected]> Suggested-by: Gary Zibrat <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Acked-by: Nadav Amit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 29f5474 commit 2212fc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2398,7 +2398,7 @@ static void amd_iommu_iotlb_sync(struct iommu_domain *domain,
23982398
unsigned long flags;
23992399

24002400
spin_lock_irqsave(&dom->lock, flags);
2401-
domain_flush_pages(dom, gather->start, gather->end - gather->start, 1);
2401+
domain_flush_pages(dom, gather->start, gather->end - gather->start + 1, 1);
24022402
amd_iommu_domain_flush_complete(dom);
24032403
spin_unlock_irqrestore(&dom->lock, flags);
24042404
}

0 commit comments

Comments
 (0)