Re: [PATCH] iommu/amd: Fix domain flush size when syncing iotlb
From: Jon Pan-Doh
Date: Wed May 17 2023 - 01:49:30 EST
On Wed, Apr 26, 2023 at 1:32 PM Jon Pan-Doh <pandoh@xxxxxxxxxx> wrote:
>
> 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: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM")
> Signed-off-by: Jon Pan-Doh <pandoh@xxxxxxxxxx>
> Tested-by: Sudheer Dantuluri <dantuluris@xxxxxxxxxx>
> Suggested-by: Gary Zibrat <gzibrat@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx