From patchwork Tue Sep 12 16:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 13381921 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC0D4CA0EEB for ; Tue, 12 Sep 2023 16:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FnwDmc3DJR/BeWVmPMvoUVHxI9IPzQ2n/0Vu5jFIEUw=; b=kjaXBESCza9MGL KUZxjoU5kniplm2ysCyB9HdfYfdTiSWia8oqmcYm6Z08UbDhCncTNlgIStsiY4mZcGH5OE1jt9O3V I/2/gU6EVCxaTV6CtB/EPX6dPSD5XEpwdtFFDGTjwygIR0YlenS2WVMGK8spKITAhr2JMC1lEHnBF A7z94YkWRUsZhZy6LmBuSDuYaGQ7mOc+0amsDsDld01o1AO5oQJZbgri6BvxB46XRqYXF+8VzSsyg btdQaC+74ooZB9p83Cco8IDgPbMzQf47YYpMlZ5UwNAmCJ6tCZBOuaPk+41k4fU9aS0TwgBAB94qQ wiBNoruYC1rdVsM/tepw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qg66R-003oMF-3A; Tue, 12 Sep 2023 16:19:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qg66M-003oIU-1g for linux-arm-kernel@lists.infradead.org; Tue, 12 Sep 2023 16:19:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E6B5D75; Tue, 12 Sep 2023 09:19:35 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 893453F738; Tue, 12 Sep 2023 09:18:56 -0700 (PDT) From: Robin Murphy To: joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com, heiko@sntech.de, jernej.skrabec@gmail.com, thierry.reding@gmail.com, vdumpa@nvidia.com Subject: [PATCH 5/8] iommu/tegra-gart: Update to {map,unmap}_pages Date: Tue, 12 Sep 2023 17:18:41 +0100 Message-Id: X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230912_091858_604275_0DBF4082 X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Trivially update map/unmap to the new interface, which is quite happy for drivers to still process just one page per call. Signed-off-by: Robin Murphy --- drivers/iommu/tegra-gart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index a482ff838b53..a0136cd881e6 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -178,7 +178,8 @@ static inline int __gart_iommu_map(struct gart_device *gart, unsigned long iova, } static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova, - phys_addr_t pa, size_t bytes, int prot, gfp_t gfp) + phys_addr_t pa, size_t bytes, size_t count, + int prot, gfp_t gfp, size_t *mapped) { struct gart_device *gart = gart_handle; int ret; @@ -190,6 +191,9 @@ static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova, ret = __gart_iommu_map(gart, iova, (unsigned long)pa); spin_unlock(&gart->pte_lock); + if (!ret) + *mapped = bytes; + return ret; } @@ -207,7 +211,7 @@ static inline int __gart_iommu_unmap(struct gart_device *gart, } static size_t gart_iommu_unmap(struct iommu_domain *domain, unsigned long iova, - size_t bytes, struct iommu_iotlb_gather *gather) + size_t bytes, size_t count, struct iommu_iotlb_gather *gather) { struct gart_device *gart = gart_handle; int err; @@ -275,8 +279,8 @@ static const struct iommu_ops gart_iommu_ops = { .of_xlate = gart_iommu_of_xlate, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = gart_iommu_attach_dev, - .map = gart_iommu_map, - .unmap = gart_iommu_unmap, + .map_pages = gart_iommu_map, + .unmap_pages = gart_iommu_unmap, .iova_to_phys = gart_iommu_iova_to_phys, .iotlb_sync_map = gart_iommu_sync_map, .iotlb_sync = gart_iommu_sync,