From patchwork Thu Dec 5 13:21:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13895250 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 3F02CE7716D for ; Thu, 5 Dec 2024 13:21:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D13BF6B008C; Thu, 5 Dec 2024 08:21:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C9BD06B0092; Thu, 5 Dec 2024 08:21:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3D876B0093; Thu, 5 Dec 2024 08:21:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 919A46B008C for ; Thu, 5 Dec 2024 08:21:46 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 58A3A42AE2 for ; Thu, 5 Dec 2024 13:21:46 +0000 (UTC) X-FDA: 82860967434.05.E35355C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf26.hostedemail.com (Postfix) with ESMTP id B5108140002 for ; Thu, 5 Dec 2024 13:21:32 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RPr7ALUa; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of leon@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=leon@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733404890; a=rsa-sha256; cv=none; b=as6G1KJ9qJd5g5qv5ltN1ccll2cSPAI3I4P3mMjYaI8Zy9Yps2hejdveDV+1NPDiJ/40Y5 dKy7iyshlGpbx0eEQTY+UQcXCTzb9RkdsX5HaR+l3RMcC4yBV1ILW2vHJn87f09Jc+VWAB 513eHz7UaaqwlvOmw5hKmuiLF88qzH8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RPr7ALUa; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of leon@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=leon@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733404890; 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=qpTt14P3ma/vFxnr88yRVgpt6BJA3gmOkkDT64/M4xk=; b=u7xfRYRll/gjiyoWS3rAitvSiAv/w3DVDoevPyLCJVldNNFntvWztfN1wCGmB5YnQcvV4S MoT0kkP5dzmrU7VQcTeOUZUyC/+EAQe39HKvoh0YE2mkMaUdsTotbSL1wtJDX3hZX6vvRc QLetdHzAdjg4hHqpFRMQCq7Wzvu+b2s= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A35CE5C6483; Thu, 5 Dec 2024 13:21:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EF8DC4CEDD; Thu, 5 Dec 2024 13:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733404903; bh=VDNJrNgrvXeiKwTQI653m0SaajGvRheByl4V4Wf2JY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPr7ALUaMhuypEqnOZAReGPsJO+L7CxPCXOtIRW390pP3BgIq43qVAlYTCBl50Tbq AYLMWWZEi1Wf4ldGPrnc+Cn9gGcnH1q/N8n2YizrGGPvKhMmV8i7CB0YsnQu9W4RIy r23PPnc9oFtb7FGHBWlz8+3XmxQDarPEGuOS3STWY2u7wIf69ZigOhPi96tgHvPxCC YSqEJ9uf4DMnaj+VJaog96+zDb56sp50z1+PreCl7/Ifk5VyRiXRpQLJ+ASdXeTURE GEXRyiz661D9BBLygBY64ddV7oTPuKAw293jbjhYaAPogLRmlENxCxlOzuck2YzWcG pORaBiUE8Rx5Q== From: Leon Romanovsky To: Jens Axboe , Jason Gunthorpe , Robin Murphy , Joerg Roedel , Will Deacon , Christoph Hellwig , Sagi Grimberg Cc: Leon Romanovsky , 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 v4 04/18] iommu: add kernel-doc for iommu_unmap and iommu_unmap_fast Date: Thu, 5 Dec 2024 15:21:03 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: i5w156rdq4bx9e3461e6re84xi6nxkqj X-Rspam-User: X-Rspamd-Queue-Id: B5108140002 X-Rspamd-Server: rspam08 X-HE-Tag: 1733404892-493442 X-HE-Meta: U2FsdGVkX1/jktdV990etg9KVYMFRyara1S0fGZNYiIggUvu1bOPxUDCbDYOPzTbi8swnA5L7h45Jh6Zubg+L4iAgbSyKqC7xFctIaDYSWAlB6oHVuK8GQ/FwoIFoicUkB7tW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T0ckmEm3ZUU7gJEPg3Su8VfpT/C1p8qfFfACeurh7xiBUu7NWXZdRHCrHHGzflR 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 Signed-off-by: Leon Romanovsky Acked-by: Will Deacon Reviewed-by: Christoph Hellwig --- drivers/iommu/iommu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ec75d14497bf..9eb7c7d7aa70 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2590,6 +2590,24 @@ 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 cannot + * 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. + * + * Basicly iommu_unmap_fast() as the same as iommu_unmap() but for callers + * which manage IOTLB flush range externaly to perform 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)