From patchwork Fri Apr 18 06:47:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 14056913 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59BD26A1C2; Fri, 18 Apr 2025 06:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744958897; cv=none; b=jt3BvAi1bHHzUvtjqJKMKHTUn0yZ7JUWvpKIP+iI4xRSNQOpa5QlWU7tywzOjF/sk4rre/LKRNH4bFg2MslH1biJKib82btjY4HU52AmosRZoVM1Ak0ClpPEpgU8qUi8yfsLnlw3WNhUIRCyXxpoTDw9CXZldDt7YS082kqmS6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744958897; c=relaxed/simple; bh=nlY3wEh3C1IEo+kSRhyetcCIxn/sZk9XJjHYh0zo1y8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=romb7d7bVpMBGOUl3XsullsQUe+Wqg/r2G5aAxW+nQSLIV6sj6ZJZUzRV/Whg+eQSvkbWruoNOXQTJJ1VzUU0psmTs7A+dy5h+j5R/84wDLNe/6m+Gy2vL3voZs173fGgJMIy4Z8OhIQOA5+lzaPsNjFlAxvS/BMD7ANr5U3GMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Uenu4moj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Uenu4moj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80C09C4CEED; Fri, 18 Apr 2025 06:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744958896; bh=nlY3wEh3C1IEo+kSRhyetcCIxn/sZk9XJjHYh0zo1y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uenu4mojsxkgpDo5apIoPvdB5TZ7+KyME7dRrsezlKFIzSNrqK0G6xnaj1lMmhtJg wJTNctFgkZizdGl1TqzRmL09k1+xz0tnpmPMjexc9xpeJvfDeuLQ4LYsQzlawKBCxB 1FZSP+CYslGLH9ayoD3ssQITRF4htPUkTw5R53V9MCsdAvWQAR+/usSZ7pXgH6Lk5d W6xt4cIXK16YUHoDSnZz+oSOqofM0WxvxEn9hm90qSpgE11qKEQVdipq46JN12PNH3 nvjN6kF40fxtXoDpCYfD1q6bh0Tb77gPByXyKgBr6e7PdcO1PZbRnLgjigChGvLqWP QFyBahGLt7GdQ== From: Leon Romanovsky To: Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch Cc: Leon Romanovsky , Jake Edge , Jonathan Corbet , Jason Gunthorpe , Zhu Yanjun , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?utf-8?b?SsOpcsO0bWUgR2xp?= =?utf-8?b?c3Nl?= , Andrew Morton , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Niklas Schnelle , Chuck Lever , Luis Chamberlain , Matthew Wilcox , Dan Williams , Kanchan Joshi , Chaitanya Kulkarni , Jason Gunthorpe Subject: [PATCH v8 04/24] iommu: add kernel-doc for iommu_unmap and iommu_unmap_fast Date: Fri, 18 Apr 2025 09:47:34 +0300 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Leon Romanovsky Add kernel-doc section for iommu_unmap and iommu_unmap_fast to document existing limitation of underlying functions which can't split individual ranges. Suggested-by: Jason Gunthorpe Acked-by: Will Deacon Reviewed-by: Christoph Hellwig Signed-off-by: Leon Romanovsky --- drivers/iommu/iommu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 3dc47f62d9ff..66b0bf6418ef 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2618,6 +2618,25 @@ size_t iommu_unmap(struct iommu_domain *domain, } EXPORT_SYMBOL_GPL(iommu_unmap); +/** + * iommu_unmap_fast() - Remove mappings from a range of IOVA without IOTLB sync + * @domain: Domain to manipulate + * @iova: IO virtual address to start + * @size: Length of the range starting from @iova + * @iotlb_gather: range information for a pending IOTLB flush + * + * iommu_unmap_fast() will remove a translation created by iommu_map(). + * It can't subdivide a mapping created by iommu_map(), so it should be + * called with IOVA ranges that match what was passed to iommu_map(). The + * range can aggregate contiguous iommu_map() calls so long as no individual + * range is split. + * + * Basically iommu_unmap_fast() is the same as iommu_unmap() but for callers + * which manage the IOTLB flushing externally to perform a batched sync. + * + * Returns: Number of bytes of IOVA unmapped. iova + res will be the point + * unmapping stopped. + */ size_t iommu_unmap_fast(struct iommu_domain *domain, unsigned long iova, size_t size, struct iommu_iotlb_gather *iotlb_gather)