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: 13943136 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 9CFE41FECBB; Fri, 17 Jan 2025 10:04:10 +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=1737108250; cv=none; b=CGG/vFSCjirBCW5WqrMueTnxZEPJMSnljfQQ+cem7WKWTGigHNk9yNtXWKHNjksgtvoxWzDKpiSNDR79j8f+kcdyumy+DHykQ2SZcpJRQYkNxy2pa/b9+z7LdoQOseBPibxJx8Rto7PWJFkUaCYds/ueIMmMf6ULdBJ6VIWsxrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737108250; c=relaxed/simple; bh=F8sJw/87mV5gIytPIjyBvaX8yGczgIz08QAVaYWaMzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uWW38niJhjjk/hvyDIFZB1X0p7h7QvrQXuQhfykJ5nunaCsYfGmzYQrJ0dX3cxTzwMxS6vOlsrTCpbDN8jyaI9XtBRdQCwiaqsnGI4uco2dbM5Dqiw0ic1KRdUCp9npuB/9XoYaoLLH9Qpo3QlinEDQHv1pv/ti6CyJYYm7IAQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q9tywBk0; 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="Q9tywBk0" 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: Precedence: bulk X-Mailing-List: linux-block@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 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)