Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp327214lqs; Tue, 5 Mar 2024 03:22:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQKK/mGpFRKbldEZ1KFP0WcNkwgh5wwBSkn4FP+Oz7KhPoOT4FB01s5rVkY3cFe+0aWsEWZjMG8vf831lUwr03qZZup7uasltIfFt0sA== X-Google-Smtp-Source: AGHT+IHKlFsi8YvcvkNu2Fj006G0pFslKCSyUW3jZV5rCe6CYe2DluxoKRAFRAXmfEyF5mLcf7zr X-Received: by 2002:ad4:4383:0:b0:690:3a87:8694 with SMTP id s3-20020ad44383000000b006903a878694mr1762054qvr.2.1709637730182; Tue, 05 Mar 2024 03:22:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709637730; cv=pass; d=google.com; s=arc-20160816; b=sTDn0Hu8s31C2aJuh6XmSLGI+n/iOtHjDINMXblIi6Z1e0kp7r9cNf9tvHdTC3ey78 aOkygEHddm2lY8mW7dObsRRPZiJPsyWlOo1HJoN8SmVqwHePpybvsb+RwhH3AcnV/KsZ bLh02xnxTG7/94GkCxFRtDRWqiLso+qpDq61jUAlJST9NhJHVX+Nm7FW8HT6FUEb2kKo Wv24eTENJCA1Kxd87wDaI3CuqKPkcHxXdGy0KEVpfHfbUBrdzVa3sdTco5beUY4Kc2Z+ MuCnsXkC/o3EmhH1ZSQmRjjsN5uOKdTN2J6Zg3rv2J8C9Meb+deU8oOyd5JpFwfHY7PQ BuQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nX2hAFEH1HSNcc2953eD/Rf6lJqonK3MWEmZQ3VuDkE=; fh=q7c0K0LtlTicAt6eDmJJJM50IJoKBwH/AvPNHUILEIs=; b=PTa6Go/1kzKgb1H+1lbvF6EReHsmlDD/LPWAOpoOvxztNb9Mhfv62fQpK1Of72Dlhz Wzkjr6UJT2GSTcjf1vGya+cMWV4ipI+2Kjujaxnq53ZkZyvn9trRw3o9OHdeTe5IdTCV OKGJhu+W6UTSGmkpYIZ6Ge6XCyY6EACZCQQTzt+IhNVzvlUp8aUv5HamRZJfYkJw3y99 3OoajBoRyysPCOCBvZ2DV5KGBnhOu03L7HJfTq7Is+KLTGiMm7yFIL60UWUOr9KyOK5o lyryrJorCaT5tW5Bz4Atyihwj05fjwhIYJiUEPiBELPvUi+Mu6DWYM/Gj6uA8p1TIbF+ +w/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VA62QsmE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fo10-20020ad45f0a000000b0068efb5d3adbsi12305230qvb.165.2024.03.05.03.22.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 03:22:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VA62QsmE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E47471C2095B for ; Tue, 5 Mar 2024 11:22:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 710575C8F0; Tue, 5 Mar 2024 11:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VA62QsmE" 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 834045C608; Tue, 5 Mar 2024 11:19:18 +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=1709637558; cv=none; b=QCaKBBmQ5t/mVSWdm/oG9ha1mAx3QZHrIGr3QF3dDlCYcLLSN2FbReEQW/nRvSWkyE4POccuqrz4bxwyhemV5qVeQY2NmIOakTGgdGTqZcayLrpZy/De6ajip8wGS51HT2pMLWdRN44RFUbhdbHPF5TmJ+yVaH+ikS/PHYFUO6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709637558; c=relaxed/simple; bh=buI8QIvB9qQbf6UKyQhoBlduuXAN0B68Jk0a66fCfeA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WDcbHcCFGq1MH+jnWD1fugsxXhL/KTb2RY0235X6kGZB9QipJYHCr/XMmgHGTiGqnuaQSo3HHYM0z/0H/yhhq+6LgSMqOOeDEZPOM4scp+FS2lQDEWu3wzubnL6eh2de1axkk2JdI4A40C9vtaBDYTvMleqtQv/if4QhLH6KnnE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VA62QsmE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57BD1C433C7; Tue, 5 Mar 2024 11:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709637558; bh=buI8QIvB9qQbf6UKyQhoBlduuXAN0B68Jk0a66fCfeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VA62QsmEtqhXBGAK4rN6VNEitTXLkb/2XYlSb4WBudevL9kDdBoh4tifdL/VjRFar 1H+/u30Q6gMUDemnHEK81ZwzsQARd67GB/2fvAmpk2CcjeRwvxKaTYdXgZ6GlVbmJJ 8uClIzWnmd+JyzMwtCHXLFF+u11aUDPMDymVmgmB8ncNrM8PGMvr5oAFCmcsFQ1qHg 1PKhw1asupu8LCj6Rp9jbukxSAp+szjyVb0frvcUjnShx1fXiOT6haE07ec60A46X/ 4KPQMde2Kg01UiKCpNqSAs27L3iCvFAZykPVHDsIOgRFXstkHoDfFwljyvBg+8qvrU PdxEE8VVerc/g== From: Leon Romanovsky To: Christoph Hellwig , Robin Murphy , Marek Szyprowski , Joerg Roedel , Will Deacon , Jason Gunthorpe , Chaitanya Kulkarni Cc: Leon Romanovsky , Jonathan Corbet , Jens Axboe , Keith Busch , Sagi Grimberg , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , 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, kvm@vger.kernel.org, linux-mm@kvack.org, Bart Van Assche , Damien Le Moal , Amir Goldstein , "josef@toxicpanda.com" , "Martin K. Petersen" , "daniel@iogearbox.net" , Dan Williams , "jack@suse.com" , Zhu Yanjun Subject: [RFC RESEND 06/16] iommu/dma: Implement link/unlink page callbacks Date: Tue, 5 Mar 2024 13:18:37 +0200 Message-ID: <1d3d26afcdbf95b053a3a44ceff34a4fa5334582.1709635535.git.leon@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Leon Romanovsky Add an implementation of link/unlink interface to perform in map/unmap pages in fast patch for pre-allocated IOVA. Signed-off-by: Leon Romanovsky --- drivers/iommu/dma-iommu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index dbdd373a609a..b683c4a4e9f8 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1752,6 +1752,21 @@ static void iommu_dma_free_iova(struct device *dev, dma_addr_t iova, __iommu_dma_free_iova(cookie, iova, size, &iotlb_gather); } +static dma_addr_t iommu_dma_link_range(struct device *dev, struct page *page, + unsigned long offset, dma_addr_t iova, + size_t size, enum dma_data_direction dir, + unsigned long attrs) +{ + return __iommu_dma_map_pages(dev, page, offset, iova, size, dir, attrs); +} + +static void iommu_dma_unlink_range(struct device *dev, dma_addr_t addr, + size_t size, enum dma_data_direction dir, + unsigned long attrs) +{ + __iommu_dma_unmap_pages(dev, addr, size, dir, attrs, false); +} + static const struct dma_map_ops iommu_dma_ops = { .flags = DMA_F_PCI_P2PDMA_SUPPORTED, .alloc = iommu_dma_alloc, @@ -1776,6 +1791,8 @@ static const struct dma_map_ops iommu_dma_ops = { .opt_mapping_size = iommu_dma_opt_mapping_size, .alloc_iova = iommu_dma_alloc_iova, .free_iova = iommu_dma_free_iova, + .link_range = iommu_dma_link_range, + .unlink_range = iommu_dma_unlink_range, }; /* -- 2.44.0