[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <khum3zw7dw2cyoxni5wg5a4tayhhuwmst2jk6mkh4zonqamw2h@rq54ishxhfmx>
Date: Tue, 3 Feb 2026 14:36:41 +0100
From: Joerg Roedel <joro@...tes.org>
To: Yu Zhang <zhangyu1@...ux.microsoft.com>
Cc: iommu@...ts.linux.dev, Jason Gunthorpe <jgg@...pe.ca>,
Jacob Pan <jacob.pan@...ux.microsoft.com>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>, Kevin Tian <kevin.tian@...el.com>,
Samiullah Khawaja <skhawaja@...gle.com>, Lu Baolu <baolu.lu@...ux.intel.com>,
Pasha Tatashin <pasha.tatashin@...een.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] iommupt: Always add IOVA range to iotlb_gather in
gather_range_pages()
On Tue, Feb 03, 2026 at 04:29:34PM +0800, Yu Zhang wrote:
> Add current (iova, len) to the iotlb gather, regardless of the setting
> of PT_FEAT_FLUSH_RANGE or PT_FEAT_FLUSH_RANGE_NO_GAPS.
>
> In gather_range_pages(), the current IOVA range is only added to
> iotlb_gather when PT_FEAT_FLUSH_RANGE is set. Yet a virtual IOMMU with
> NpCache uses only PT_FEAT_FLUSH_RANGE_NO_GAPS. In that case, iotlb_gather
> will stay empty (start=ULONG_MAX, end=0) after initialization, and the
> current (iova, len) will not be added to the iotlb_gather, causing
> subsequent iommu_iotlb_sync() to perform IOTLB invalidation with wrong
> parameters (e.g., amd_iommu_iotlb_sync() computes size from
> gather->end - gather->start + 1, leading to an invalid range).
>
> The disjoint check and sync for PT_FEAT_FLUSH_RANGE_NO_GAPS remain
> unchanged: when the new range is disjoint from the existing gather,
> we still sync first and then add the new range, so semantics for
> NO_GAPS are preserved.
>
> Fixes: 7c53f4238aa8 ("iommupt: Add unmap_pages op")
> Cc: stable@...r.kernel.org
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
> Signed-off-by: Yu Zhang <zhangyu1@...ux.microsoft.com>
Applied, thanks.
Powered by blists - more mailing lists