From patchwork Fri Jan 17 10:03:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13943118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83B4C02185 for ; Fri, 17 Jan 2025 10:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D594280006; Fri, 17 Jan 2025 05:04:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65C24280001; Fri, 17 Jan 2025 05:04:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF77280006; Fri, 17 Jan 2025 05:04:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2D826280001 for ; Fri, 17 Jan 2025 05:04:14 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B63D0A18D0 for ; Fri, 17 Jan 2025 10:04:13 +0000 (UTC) X-FDA: 83016508386.15.FBA031A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 03606A0011 for ; Fri, 17 Jan 2025 10:04:11 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Q9tywBk0; spf=pass (imf15.hostedemail.com: domain of leon@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737108252; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ku8ubNYre/w13pJMtu7Kp0D6VT+U0ludZSt17Nd8EU4=; b=ziDa/uBtiHedLVwH7OUf0ySV1j7sRoJXknkVSTTvSCgeRruHRI3bmQjyEBXJSha2xxB4gF uAiJuuQ6ox66In88XuC+DYMcpRLRQDy1YJ0ZFhCmQXxFecSwOgxujiX+AcYMkO8jW1D9RP wf9GelVxfM2ovbdSRpcSWJblIe5lj0k= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Q9tywBk0; spf=pass (imf15.hostedemail.com: domain of leon@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737108252; a=rsa-sha256; cv=none; b=l5QvVjf2vpFWeKhQfKzDGDcgZfJ4HB3+tWlpoAxyreQInJ5mRZdOJLAJ2NaZVs/WMNVBWY CHH4G0wxPbDFHv0gbLy/ecPzS9SaiTqp0wHopuHdM2r/9whVGWQcmmnYNfOPC6d/RwXClY gUDYU6yW/lZXcZTbMXyfQ2a3BS9tZMs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1D1215C5710; Fri, 17 Jan 2025 10:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAD5BC4CEE5; Fri, 17 Jan 2025 10:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737108250; bh=F8sJw/87mV5gIytPIjyBvaX8yGczgIz08QAVaYWaMzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9tywBk0v0rMbF2vqYafzs4kkPbPNI5m9+Y6dMJkANGUXLqUMewUXxW8CCTVE0O5+ 4/h08s6bsJmh1lhXo7P6OpgiTbG4BmCxLQeNTIFVqUSPWjgEnOcRiOeau5NGCxbOTS mkGR/8kOyOxWSxJVNrM04Wj+trb2Fp5EH7vOJmSdxGc/c7tqX+yYL4nz07hJZ1Cz+F R/BbHgmwV6EIXl4GFoyM6mIOCRD/RLUzC9lakllGhSiyT4MNuSLgpKtPJi6rBUs+BU R3+UWt2WOc17d19WYOWBh9efL6SYldmI8WwttyBmNNLetjghTsui0z3GCdExEIiX9G Bb2gdP4klOqaA== From: Leon Romanovsky To: Christoph Hellwig , Jason Gunthorpe , Robin Murphy Cc: Leon Romanovsky , Jens Axboe , Joerg Roedel , Will Deacon , Sagi Grimberg , "Keith Busch" , "Bjorn Helgaas" , "Logan Gunthorpe" , "Yishai Hadas" , "Shameer Kolothum" , "Kevin Tian" , "Alex Williamson" , "Marek Szyprowski" , =?utf-8?b?SsOpcsO0bWUgR2xp?= =?utf-8?b?c3Nl?= , "Andrew Morton" , "Jonathan Corbet" , 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, "Randy Dunlap" , Jason Gunthorpe Subject: [PATCH v6 04/17] iommu: add kernel-doc for iommu_unmap and iommu_unmap_fast Date: Fri, 17 Jan 2025 12:03:35 +0200 Message-ID: <0ae577f8b99f7e03c679729434c87ea7daf78955.1737106761.git.leon@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 03606A0011 X-Stat-Signature: wfkpp7bxrm6kg7gcsjsnmru4ksjiihyi X-Rspam-User: X-HE-Tag: 1737108251-618514 X-HE-Meta: U2FsdGVkX1+rxm5alaYocZ5GbEZ2RI4QWgOF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Ddbnn4ZuPIuRsUdg9pATfJnkCmV7q+Rjuv4QLv+AwD+EBqlNmXbuEz15FY6gXEkgfF9FE7EoDSHb5Y/WNlNHIvbVyON1L9kAGiFZtOv5ttR/KXGXAAjsmFGR9gRi8ncpAnSV+nJrM11SpgSp2XymVddAGnFMtTw9HEkF3ZzAsgQcbQ9NDG1TntCPMbDmBw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 ec75d14497bf..c86a57abe292 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2590,6 +2590,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)