Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2324586pxb; Mon, 11 Jan 2021 06:57:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwK2Wh9TBIZP+NDs0C3LyEb81/nb23cygml7vEuLXzGO1knQMqBcKG6a7EIDDJAgEu25AT1 X-Received: by 2002:a17:906:eb49:: with SMTP id mc9mr10554119ejb.487.1610377058425; Mon, 11 Jan 2021 06:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610377058; cv=none; d=google.com; s=arc-20160816; b=bKkVqFAP+Sq1AI/5Depbw8XCKMK9KzZdNq3nJjf8IV3aLfH8NjrKqyZBfC/Wk6FKUs 6H0z8bY9VG17YUObRLtReFCV97fJZKy8dXir3Rts1ii7kad8BS/pCmd9bFKXR/CpEXcd jDhc67aVqy6s/INRDpf05TUXJEiK6OWy7i9Jdq05z5MZMkbmNj8pDHudc+fBpNYWFd1G jdewN5C024LuQk7H3BXDc62uhhuhW0rv9BZAQA37X3bIzyuksngb12Vq4JQKdypJAZvi leTclhsoJ2JwdQrD+qLqxckA+HE9fhyhqKudsEhgYnf34bd2adbrqsPLKrCZlBs+ZmyT NFcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=EgoXBzkvRFRBe7rpnVTVbV7udtTIgKjckgseHfiFLac=; b=yKDzLbmDNjQPbIwOGFJUWi7D/WO/i3vlxcIOGE5u5PWz+HFsW6TA4I0JBgy74gXpzK z6snvKeNFrve0/5LsjDX2hbAJ7FPK96XEO/vMyXvDrjImMhCbc4er8AM8NM6dPqWnlQA rBC+sdltdd4Ev3zB+6V9dbCPeZ+JWMif1K1JuI9oMExtnE5hRdtAB9rng+ir+A2mEPDj Y2sr9oGDYhgWqX/FdS8IJEzZKh7RefHI78rCiZgyroZQWVGIgHkMPcbksVe4x0WK6fLl K6/z7PkDrr2hKtkond3QvWBguJhAZ4TECtdeu/E/Ns9jcMMQM7kj1CqMzSoul8bn05Y2 pvfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=n0eKiqGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de28si21144edb.166.2021.01.11.06.57.14; Mon, 11 Jan 2021 06:57:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=n0eKiqGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733083AbhAKOzf (ORCPT + 99 others); Mon, 11 Jan 2021 09:55:35 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:54956 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732816AbhAKOzb (ORCPT ); Mon, 11 Jan 2021 09:55:31 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1610376908; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=EgoXBzkvRFRBe7rpnVTVbV7udtTIgKjckgseHfiFLac=; b=n0eKiqGS6pYYjJ1ugopIlBm1nYBBBw08I+Ghs/pxHoDbDqb6v/ol3PuWgE8f1XczrMMnNY14 xrlOvNGUwjJtrJOi+fJ4Lsvmmaq7WohWVBq/9GHkYMMKdBHnz0OAZHaoBvosZROqtqk3Jpqm lmgd4NhNEK4Ezv6e/fJT3JnjsFA= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 5ffc66adc88af06107278ac4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 11 Jan 2021 14:54:37 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E0587C433ED; Mon, 11 Jan 2021 14:54:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id D88EEC43462; Mon, 11 Jan 2021 14:54:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D88EEC43462 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org Cc: "Isaac J. Manjarres" , pdaly@codeaurora.org, pratikp@codeaurora.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] iommu/arm-smmu: Hook up map_sg() Date: Mon, 11 Jan 2021 06:54:22 -0800 Message-Id: <1610376862-927-6-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610376862-927-1-git-send-email-isaacm@codeaurora.org> References: <1610376862-927-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that everything is in place for iommu_map_sg() to defer mapping a scatter-gather list to the io-pgtable layer, implement the map_sg() callback in the SMMU driver, so that iommu_map_sg() can invoke it with the entire scatter-gather list that will be mapped. Signed-off-by: Isaac J. Manjarres Tested-by: Sai Prakash Ranjan --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index d8c6bfd..52acc68 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -1208,6 +1208,24 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, return ret; } +static int arm_smmu_map_sg(struct iommu_domain *domain, unsigned long iova, + struct scatterlist *sg, unsigned int nents, int prot, + gfp_t gfp, size_t *mapped) +{ + struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops; + struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu; + int ret; + + if (!ops) + return -ENODEV; + + arm_smmu_rpm_get(smmu); + ret = ops->map_sg(ops, iova, sg, nents, prot, gfp, mapped); + arm_smmu_rpm_put(smmu); + + return ret; +} + static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size, struct iommu_iotlb_gather *gather) { @@ -1624,6 +1642,7 @@ static struct iommu_ops arm_smmu_ops = { .domain_free = arm_smmu_domain_free, .attach_dev = arm_smmu_attach_dev, .map = arm_smmu_map, + .map_sg = arm_smmu_map_sg, .unmap = arm_smmu_unmap, .flush_iotlb_all = arm_smmu_flush_iotlb_all, .iotlb_sync = arm_smmu_iotlb_sync, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project