Skip to content
Commit b0e21c42 authored by Jon Pan-Doh's avatar Jon Pan-Doh Committed by Greg Kroah-Hartman
Browse files

iommu/amd: Fix domain flush size when syncing iotlb

commit 2212fc2a upstream.

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: a270be1b

 ("iommu/amd: Use only natural aligned flushes in a VM")
Cc: stable@vger.kernel.org # >= 5.15
Signed-off-by: default avatarJon Pan-Doh <pandoh@google.com>
Tested-by: default avatarSudheer Dantuluri <dantuluris@google.com>
Suggested-by: default avatarGary Zibrat <gzibrat@google.com>
Reviewed-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Acked-by: default avatarNadav Amit <namit@vmware.com>
Link: https://lore.kernel.org/r/20230426203256.237116-1-pandoh@google.com
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 251cf7fd
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment