From patchwork Fri Jan 11 15:11:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10758217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B35A1515 for ; Fri, 11 Jan 2019 15:07:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65A0D29C71 for ; Fri, 11 Jan 2019 15:07:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5964229F93; Fri, 11 Jan 2019 15:07:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002F829C71 for ; Fri, 11 Jan 2019 15:07:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8623B8E0008; Fri, 11 Jan 2019 10:07:12 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8110A8E0001; Fri, 11 Jan 2019 10:07:12 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7011E8E0008; Fri, 11 Jan 2019 10:07:12 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 325338E0001 for ; Fri, 11 Jan 2019 10:07:12 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id b17so10490592pfc.11 for ; Fri, 11 Jan 2019 07:07:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=H+XEWk1I6YvnG7zAQB/PAaG77CKJ8GMXs53H7O+PAoewgsLxxxZJurHS1FMRl7GWGU UTXAA/nLg8Uo6QWd648DgHuYerAfT/u5Q7PYxewi+CJClLw0rz08BEmtCpTBaccT2QFi u/19A6WGnHl/o/1FCT/hywsmwb1qlntojusgpaeNVjCeGdApkZHL5f4A6G5LPLHdcft9 iDU1Cz/2oDdzVe0awxBcQXdfc8uaaKgJxG8SsNS2vPf+qUgR6qx2z0+tgbvQKE9vGy0v LOXlubQGNAi1hvTIRu7J7U3Ha25MTUPmmej/yv7j/p7+baP0hOoJH9n4JoeyDq+5ZsjW tNRg== X-Gm-Message-State: AJcUukdpGuk8sfuY5uunQdpXhMSwszWYq56wOSJ/W1KH9yAHDvFclbTB v+lvyWL1Z9kZrzIRcpf2hOEWU6mqsp+PZQQZBcsr+cOnE3TokjqCrNkGi0tvg0deKELULSa/e9J 3M7lFhg2obd80pNe5w+Ax+PCVQq5J5O0fcrUJvgZ91GUCmK1rCBhdxLK8FOHikFApzRdWrHJytM /RTumJiem0ShbinryOuC5CbN3HRZ6iYy5UqaNtkPeYb6fPXJS97v91FGA76K8KVPjx38DUL+NV1 HvNtfYuDEy1NxK7MhQLfBOysJDdfNfvPLwmN54rqE8jkpThZiJk7q6iun9rd9cZAjB0jpSXrfEP L8XxGk89MbRrbLbthymUq+s1EV9kv3JlyDPOuZpsAjeCHFwVDJ8iZGXcEdDUW7vI42J1yU3tIZS W X-Received: by 2002:a17:902:e28e:: with SMTP id cf14mr15234605plb.311.1547219231895; Fri, 11 Jan 2019 07:07:11 -0800 (PST) X-Received: by 2002:a17:902:e28e:: with SMTP id cf14mr15234555plb.311.1547219231222; Fri, 11 Jan 2019 07:07:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219231; cv=none; d=google.com; s=arc-20160816; b=UVK9tl3W7XqDGpXEU2YtWZPfEHWXZCarEepODTbbYqcxxSpVwRvY0iQU0lIGqc4YcZ fkue5kIV9qlPCl1ozuZ5E7ju6+4rYeCD2Q+H70ABHgmB9AE7NXZB01JXeq02nXVl1+9c m9+2EAa2TPAHjWFlb0yJvQLlq48XloGNBQr0VizM1ZnN9HmZDxdMwP8DK7lg2g3PpqrK kei7hYW3eGrBw1Fshju42CGYd3Kv/MihKfsF7C8H56TxrN35244exLbmWWDpjhXVR0/2 BvzqXxrce6yQ5IEgLIkMfMyA1Z4CLZLdUYD0ZCSPfxuBpAV9b4SZcxByAkI2BAcQYfB2 LTtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=JecqqrHHjd7ezHeRE0z0oaP8aUi3ImLP7gYLZzrBOI8yfvz6uUaMP94NhuAM7f9gGf 04YKh5ZZQhSzRMGsWzgOBHQgSyi9twPLLiiKtDMPws+172c1+xnNHkOFGUmexuXh8/WL 8w2CdarjkPg2FxdFJ7oj+t1e6/EzJ7GfEdTU2MUty6odWBboRHgaqEqYb/WkwZ5mjHYc tFwfq5tZNys3ii33Hzl4pFwHIXQVLcXHVSm8jFHJOA9KQjxwXbz7+hz4vTZ1HsKZMlPI 8GS1Xpr/jWd/sIJx1jim8TyxNtba9ZKo29sKIncBjR5AFil3Rgfhla/2sqJKc31R+C+T JQnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QsvM0uu4; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l12sor3909024pfb.43.2019.01.11.07.07.11 for (Google Transport Security); Fri, 11 Jan 2019 07:07:11 -0800 (PST) Received-SPF: pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QsvM0uu4; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=QsvM0uu4icAZvextylbdiwQF+jVmwkwcRTFbwvekeKAkggRQtNuG1yoUKv9QGnngR+ DK2boV+OXN4GEhRdq8EaSr0OONaDWE88K/OJ5VAxGivZoh+YGndf9KfrXkwvF6gnVkQX nTyB6idbYpK55CJm0E7qRJQSDcfPgFFxJTFLEELimduks6bbI/fiwhEUg+VQq+4UbKEO /5m8X2KXTUvmdgd9pkhtAPR9EFxD7sLEnYFjQO13ov5Khi9lOk2hF31OiH2YFVU1fvkc ti6rmIsEVP1wp/8gEx/yh8Oebts9hgzlTUAdFMrdOT/2E8srkxPSJ70jx7N4ou8HhnWV uW+w== X-Google-Smtp-Source: ALg8bN6KjwykscB3sBkV9lO0D9hkHDIbI6Lk2JEn0IITS33oEFeAQ1Opc96e0VUEvQ74PX81me3O3Q== X-Received: by 2002:a62:1043:: with SMTP id y64mr15144503pfi.78.1547219230435; Fri, 11 Jan 2019 07:07:10 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.52.190]) by smtp.gmail.com with ESMTPSA id b202sm150546595pfb.88.2019.01.11.07.07.08 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jan 2019 07:07:09 -0800 (PST) Date: Fri, 11 Jan 2019 20:41:11 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, joro@8bytes.org, linux@armlinux.org.uk, robin.murphy@arm.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range Message-ID: <20190111151110.GA2798@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: X-Virus-Scanned: ClamAV using ClamSMTP Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder --- drivers/iommu/dma-iommu.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index d1b0475..802de67 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -622,17 +622,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, int iommu_dma_mmap(struct page **pages, size_t size, struct vm_area_struct *vma) { - unsigned long uaddr = vma->vm_start; - unsigned int i, count = PAGE_ALIGN(size) >> PAGE_SHIFT; - int ret = -ENXIO; - - for (i = vma->vm_pgoff; i < count && uaddr < vma->vm_end; i++) { - ret = vm_insert_page(vma, uaddr, pages[i]); - if (ret) - break; - uaddr += PAGE_SIZE; - } - return ret; + return vm_insert_range(vma, pages, PAGE_ALIGN(size) >> PAGE_SHIFT); } static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,