From patchwork Wed Feb 5 14:40:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13961237 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 188051925AB; Wed, 5 Feb 2025 14:41:07 +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=1738766468; cv=none; b=rVvwMNuPnazzu0ekBDsHq9t4WJRdeDMulwpcrOrmZPpulrQMifFxUsDNqmk5qCIuZqkHqOKakdulTSsIrLrN/KNAxW/cA3oAuOr2GRjlirP9oT7uzTlxkKN1wQXXulYmxKSpBRFjUUOsZpgC2bBVS2Y/szshHf7QS7VNQ42Lm6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738766468; c=relaxed/simple; bh=0zY9wH2OP9d22rL1O7KXuZTa/ogQAL5HzMoIiMUubaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z7xVzxo1sKOXv5b5Wn+de+8wftw123iIM/w/0+vo3ABSCcXI9Bb3VJQ3lWCwDeYM7wm3Cvhk2s9PUK6W+tBQ85vV61/7cgAMGq0nxvnfZ2mtWzTA6Em9zJmKGNnYdD8t11T63vQPO3jiUA/2YypfmqhfmkV3bt6ithfi4yf2ZEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=paVneeAJ; 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="paVneeAJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19E9DC4CEDD; Wed, 5 Feb 2025 14:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738766467; bh=0zY9wH2OP9d22rL1O7KXuZTa/ogQAL5HzMoIiMUubaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=paVneeAJqn/ltBJv6BGhRXTQ/1o7gRgteq2iCdVfu0se6SR44/XZ19uVDs57AYcx5 G6SYFwf9oPkm9cSNiuGfKntNAWNpRrba6qFPBtdsBpcbKc4/ygjDK7v9rRTgtNgXJY wMEOH+TPUG4apPSNsLSopbZGBVV/xLPSIuqZV6NOJslRLA1vKskQA0UyhxlHcTpCDu DL1YnlM5CiKBwg4+D+3xSdmQ51egLGcf890c1UIfYj2+bGGKlIShSQq08wTw6gpzyw F/J3DHrDVo1YPqcaiE1BNjK2tJyO9YQnTqr6eKZ8NQTx3Y+qbGNoPheStWyzcZwbPr fZsxDVy3Q2DYg== 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?SsOpcsO0bWUgR2xpc3Nl?= , 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 v7 04/17] iommu: add kernel-doc for iommu_unmap and iommu_unmap_fast Date: Wed, 5 Feb 2025 16:40:24 +0200 Message-ID: <49d9ef3273ab03821931114329c49ae02b1cd902.1738765879.git.leonro@nvidia.com> X-Mailer: git-send-email 2.48.1 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 32b161988c4b..89b538eec5cb 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)