Re: [PATCH v1 1/1] iommu/amd: Don't split flush for amd_iommu_domain_flush_all()

Jason Gunthorpe
2026-04-14T23:36:12Z

On Tue, Apr 14, 2026 at 09:06:26PM +0000, Weinan Liu wrote:
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 760d5f4623b5..bcec8721d228 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -1769,7 +1769,8 @@ void amd_iommu_domain_flush_pages(struct protection_domain *domain,
> {
> lockdep_assert_held(&domain->lock);
>
> - if (likely(!amd_iommu_np_cache)) {
> + if (likely(!amd_iommu_np_cache) ||
> + size == CMD_INV_IOMMU_ALL_PAGES_ADDRESS) {

This is better as size >= (1ULL<<52)

Which is the break point where it switches over to full invalidation
anyhow, there is no sense then in doing the special np flow..

Otherwise

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason