Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp209224imj; Thu, 14 Feb 2019 18:45:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IbDH2E+arQ2EDJh3qvn6dwUqR3gU6XIw/UD9MV8uzsBiFGeBXuvoj8Jr4IMFqt+NS+xZ91h X-Received: by 2002:a63:3541:: with SMTP id c62mr3120359pga.191.1550198707092; Thu, 14 Feb 2019 18:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198707; cv=none; d=google.com; s=arc-20160816; b=n1HjFtZfeOyE7marPmpXQ9A99yzkC9PMQWXf7pId3GKzjpNE3uyERAhyzSwNrJKW3h IZ2aqaiPbyM6HnNDjNcrsiw7EIfvBAhqSLqXYV50cpBHdbYAe82fbssmeK/ZUvSbOIMt IUc5uE559KLbeFOYCAi9e4DcNpYQZY5ssUfMytrIHGrusZNk9U/3pML9yzxl20d5nEHV 8j0uyyTpQg4M0DdZcDr7dFjgX7UsU1B+YqX5/cPuEqHbhN3S49lStDNYzGBQJ2v056vh nxaaBl7ZjZuVAmA77vvUYOd/0uOa5PcH0DUzkCf/PwaWhCBUpLU+NlyqxJc7EWS3ELgO j1mg== 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=XQSNSZywn2J5tIibcMqEyCRYg0DoENdsUd09NDa1qxo=; b=gimC0lc58zJ9C+aSdmcjsfC7MFDDhMt/R+OXs15NHUdBFyfvbC14Vh+KUc0dbf9bc5 A8Ke5i+wO7q6TTfdbuX/I0DeC1b4GLM3Bh1hY6fhrqM8RvlJeYLkQ8jxh+QFqsR2fVEL +zE3IOZhAjhbSTf35alJrcwQNkUidte9tGuP0iLvCPNTWtkyKtpfyq2es3FZLwdAxYHS eDZysAUdvnEZ4+xC9OkSqm8F5k2weLdx6+3WmGAyo9nj+4swhw57PvpIHTLRcBdwqzlv tP9OLHNXI5FUkAhga3tUnKmq+k+fHxb/+vIpynswm/+E0BQsY1saf2fH3EYWzgor4ixx LIIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JZi03g5m; 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 v7si4004027pga.15.2019.02.14.18.44.51; Thu, 14 Feb 2019 18:45:07 -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=JZi03g5m; 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 S1733307AbfBOCmq (ORCPT + 99 others); Thu, 14 Feb 2019 21:42:46 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43200 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729274AbfBOCmn (ORCPT ); Thu, 14 Feb 2019 21:42:43 -0500 Received: by mail-pl1-f196.google.com with SMTP id f90so4172904plb.10 for ; Thu, 14 Feb 2019 18:42:42 -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=XQSNSZywn2J5tIibcMqEyCRYg0DoENdsUd09NDa1qxo=; b=JZi03g5m8SqN4fzXTLvaMrZBoX3tseOnsMCKC/62M1fb+WcWoioZRu2l43B9pfFRQ2 WXlq2oi4wn0yLXfiWFYswzWzIwq4w5bg5KUOQqXwHgWQAE+lk6jNrBiI49ibZOXzAjYB S8xwAOlxwx6HrAa45AL9/1l+BkEjI1D/wYBYF5rR1UnrnGZzphD/5/CSGuRCJ64MvEcH DReeXATf/+Jz4/zN0EJD+9cfFSCrLW6CKrkgZOu8eMnbvIrFvUZ+1Plc5qyMCcYCp2YU 2sV0wsN2fmCXsUVqfPMdD0e6g3l2vcbQyVMaPVeMlRxx/bfrmGunMWVPf8F0LURXsG/d FuLA== 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=XQSNSZywn2J5tIibcMqEyCRYg0DoENdsUd09NDa1qxo=; b=l8bpY4Xk+dN10EnJyyclEhHDYk8qSO+X5n7QDQ0zaM9Fioe5wloawLIvGLMW5Oqt6Z do+vZZLpvZhyPtTZ9+PberIlCQt7XQcuG0m5uD3+yCWOLXs77QmmHRM8V5FYjKLa6Adu JYlvgn+yW3nK1XHqrBTPbVxXhvWc+XQxyBDr6/HAxBwJMkgKRXbLLF+cANGJfNjveV4E EczcRgbGq5xFr+RZ1zUl6to9YIp0TgVNIZJ0lIt+WjUsNRgAF2YkEHNUKLUpv/dBRsvB gqF/6LDrpLkP0d/J3l6+3vwm5qJDDAOg7S+HxnZnJCJHIpsrovSihet8AJgiQ9LcZQFX 3k0g== X-Gm-Message-State: AHQUAuYFJfu6FdFc8sYfW7f9iup4fEKQIa9X20eWDJxyguGA+huwseWv Vz4aIF+nR6U78yam/NxYbzQ= X-Received: by 2002:a17:902:bd82:: with SMTP id q2mr7737899pls.156.1550198562436; Thu, 14 Feb 2019 18:42:42 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.53.51]) by smtp.gmail.com with ESMTPSA id z62sm8961035pfi.4.2019.02.14.18.42.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Feb 2019 18:42:41 -0800 (PST) Date: Fri, 15 Feb 2019 08:17:02 +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 v4 6/9] iommu/dma-iommu.c: Convert to use vm_map_pages() Message-ID: <20190215024702.GA26442@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_map_pages() 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..bacebff 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_map_pages(vma, pages, PAGE_ALIGN(size) >> PAGE_SHIFT); } static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys, -- 1.9.1