Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6622424imu; Wed, 30 Jan 2019 19:09:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN61jhCHncgQce3FkGwOZXahRRil2LJDIXxMok6e34+JpEVwfzlEayQQglH6flWEgdlyG/TG X-Received: by 2002:a17:902:1122:: with SMTP id d31mr32925145pla.246.1548904188993; Wed, 30 Jan 2019 19:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548904188; cv=none; d=google.com; s=arc-20160816; b=dW09oZH489AKjE8LSbIVH53C7u5uiG0hIcbYWMjxpeNxY/8+vIVgR5++5sl0ggu9Z+ 1tl3zX4/R0hNyQkYJaXZD3HQ4OpCSqr55Y+zclT4mjuz6twd6z/1zRG3sxU7q9/N+dAF pT0LzVt2iEv4Yp0uWUejTlmDkb0CPNDi2pVH7X6xQI9uw+dQeAr1ApmzPivzi7CJfIxD z2Caugjun9c6CeMz5zmf2R5X/YcU+Jx1yk3C2GYWyewX6r2TykMjeJkYGfqQhXoa67yQ iHuaPFxeYVSrf+sDYlMryv3USlguMx/WkqpUw4x/T6ebU7qOJ8qvB83TgMZ3H8UDr3+G sUcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=iec/iwyk+9yIyetIpSnDlz9q4nLWbzvs4Tb+BjkPjDE=; b=uuPeTngDayfqNWvuI7nWliT5LKvbnJC0JygfJE07CJC3m2Bvo8biTrDjihvqfy7Yis LmzSA2p+/BCyPzjlhhOBp99cCDKnl59Rtfz2dMw0q3dENwhla1ofWa+n8Ll2yJCWNDB5 Kp7shUIC8gH5uv0oaHqXexQjAMTs15Rz1fJjxFiLqlhYBVL5392FEBa8457jWKreaaEK ImsrXrOda1CFbkoGdJdv9IV06mKQamLWKuKBQs9Z/lEA1x7Qkz103sXnindMbeaVtbEs iDdJJ+GCuvOtfyp/sojKjHyVtCBBj8RBzsIkCie92Ag3A9DjRG/KoSnPlaaxwy486FH/ mjSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=btJPnHFF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si3261196pls.367.2019.01.30.19.09.33; Wed, 30 Jan 2019 19:09:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=btJPnHFF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729343AbfAaDIK (ORCPT + 99 others); Wed, 30 Jan 2019 22:08:10 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33139 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfAaDIJ (ORCPT ); Wed, 30 Jan 2019 22:08:09 -0500 Received: by mail-pf1-f196.google.com with SMTP id c123so817853pfb.0 for ; Wed, 30 Jan 2019 19:08:09 -0800 (PST) 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=iec/iwyk+9yIyetIpSnDlz9q4nLWbzvs4Tb+BjkPjDE=; b=btJPnHFFmNfaReq5/e7TkaGbwn15giRl9XlitU46PRtF/0teXo0bWC1peOMGRPqPA8 hxAb0yGT180I0FDMfC86c/tvU+9G6qZ1Rx1ilqWyX4vHBBETh7UPpSVVyUGUHQV1uQQo Nd3mIgmXCAbNkh8lBEMTntnGXxdqSwKzraFTYyTORHy0zOogKhLvdaw47rbsjlLPPuRs aeqhr8e4CwkRDvSeOrC7vIPstO0GVYeSubKCmIlkrToB20gf51xWHeogaA5+SVliS+ZB SoSvM7OtvGHYInHjKr77zMMAlEywrAABgpKu1dA0bjh0cumvwJ/m0hgNXUPCXOF1J3H7 mDkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=iec/iwyk+9yIyetIpSnDlz9q4nLWbzvs4Tb+BjkPjDE=; b=mSxzQRbn2puyIMTCL/ALCJP3yKlUEgRWhSCyNFL7rtSYAYggr8c+scBfdBlyWfxxt+ 6hsLwGPKouG/M0rrsB5xLLkn17FOo5QHZBvSUVOaH0IW49aYWhtaKvxw/wUYHyqEQ9vO D3S6D7glmDU/8XLuCJXedpJOtr3hZ4JJFkJPS621QOuKF3k6d+pqeNZq8XnPuS2nndbi SWXuXDksFtSWjwrobJP1VJqApdzNRMwQDGc41US2PBQsMnOTLNVtzhQxb581If98WMtr KSupZgeZn4UzxH6uVrtuVvFDKLUcLBdiorE15IrcMk+VQMyFww0lj8TNXLefq/Bp0fyL o4bg== X-Gm-Message-State: AJcUukfTPf8nGIsD91oqyzldPb0ZcBPy5/RGh0XhsUbeHTUP4yeOpLvp /s1hl0teicuTOR8O2e4ma/A= X-Received: by 2002:a63:1f4e:: with SMTP id q14mr28672360pgm.88.1548904089076; Wed, 30 Jan 2019 19:08:09 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.20.103]) by smtp.gmail.com with ESMTPSA id z13sm3977258pgf.84.2019.01.30.19.08.07 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Jan 2019 19:08:08 -0800 (PST) Date: Thu, 31 Jan 2019 08:42:22 +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: [PATCHv2 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range Message-ID: <20190131031222.GA2356@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 d19f3d6..bdf14b87 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -620,17 +620,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, -- 1.9.1