Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp744111pxb; Fri, 8 Jan 2021 17:55:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP6t0iRb3Iq5bdapUrba4lXyhofBpLqdXosgsAYSRFKeJFNS8xPPRoiTdUjd4lm6rvgA9j X-Received: by 2002:a17:906:ca47:: with SMTP id jx7mr4552858ejb.237.1610157300596; Fri, 08 Jan 2021 17:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610157300; cv=none; d=google.com; s=arc-20160816; b=IQ6d949zaRC/7kBSGpAg1dC8r9Eh+F+tD8Rpxw5xiH/sXyyrxknKi1iCGL6eGHqIvF 6F1mSNyJCeNSDop2at5dorr7WSaTkWCAMPL+Z8dwD6eOn0TTtHKhKWYz4K9IwZEp4fO8 qWbPassMk19JHtPwfN9weTy9TdT6QPIQPJXNBiEiiOMc1AalUNkLuoP9KmdM0u1S0fBC xheVC4Gz11n8xaT1quRhhLcpWBHTJNiEyWS6PK5HpoIOPBbkfmSujhTf0r4/cam8Hcuu 4syFgnoxb8d1fquD5laColNNNNV3GoeVP5Jnun9Dp1Ulc+gwRvwJEV7q7l6Fk1K5quap d3qQ== 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=K+f2Q/EJdasBNYVD+EspGT3ZOBQETm0mWhfK3z06MvA=; b=YKM5qZ+Ly0kiNKMiy2IuSVEIXSGy1dP9+yeKX+cKXQ5v5FddM2FfzBvN3eVTGAXsJX bSdsZgE8QWY/NfM0FaHNYsqVmJVfCiAgJqFocodVNeUh0gKn/xITuokWtE/Pm+a42ca7 Ps8T7BgBoZ8lA9c9Bs8xfui+ccwauSS8dCbriY5uWthkzaahcfuqYeR97TNu7fSNTZ3W s8+MD+k3YS728uwkA8oYAZNLvDhfdSkJhnY10CnbRmu0fXApqB2QeACEx+wLOk67ji7Z ivVtgN8/59rytquVlLCNwLcqUEUDUt/WsStO3CLTiz5le2G6fJaeZzwAVUInbMfXJO1I kfIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=lcxk7J4V; 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 i3si4105799ejk.273.2021.01.08.17.54.37; Fri, 08 Jan 2021 17:55:00 -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=lcxk7J4V; 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 S1726650AbhAIBvj (ORCPT + 99 others); Fri, 8 Jan 2021 20:51:39 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:60486 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbhAIBvj (ORCPT ); Fri, 8 Jan 2021 20:51:39 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1610157079; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=K+f2Q/EJdasBNYVD+EspGT3ZOBQETm0mWhfK3z06MvA=; b=lcxk7J4V61vLSRJSZ5yR7ghtlOKs8x3+rCPxQhmwQmudjEAqFuMXTdXkIeYgw6u/+YTcLJLi l3EVl9p/XRJtCOxWBlluBzBWSJZwpUXv8c4Mk2mL2XaP23wwDUeAXhcIpUVFoiKVLfiMssff X/EqxPtfI5RzuvRTMMYDbyOcFQk= 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-n07.prod.us-east-1.postgun.com with SMTP id 5ff90bfa4dcca1247515d8f6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 09 Jan 2021 01:50:50 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 72DA5C43464; Sat, 9 Jan 2021 01:50:49 +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 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 4D904C43462; Sat, 9 Jan 2021 01:50:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4D904C43462 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 5/5] iommu/arm-smmu: Hook up map_sg() Date: Fri, 8 Jan 2021 17:50:31 -0800 Message-Id: <1610157031-26301-6-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610157031-26301-1-git-send-email-isaacm@codeaurora.org> References: <1610157031-26301-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 --- 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