Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2652494ima; Sun, 3 Feb 2019 04:13:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IbG06A52JgxbjMpwUq8P05k+MGCnlw1FLW5O76DuEsrIq4ZpnAxbKLctHDLhxFmWlr3iyt+ X-Received: by 2002:a63:3f89:: with SMTP id m131mr6608323pga.115.1549196015098; Sun, 03 Feb 2019 04:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549196015; cv=none; d=google.com; s=arc-20160816; b=mQ5J1qzmumUcmZHYReBkb4cHg6vq58Wtp27LOUk+XjgyzskLEU4cobGhjznVaoTnwO vQ6+F/1vqosQGlSGyXq0n4sWINgWhlPfbDPRmJFw4x/jAB0a7NlTuv//tSQMARNqKZDA 9BVb8qlZpzpnHIDQKZmQ3Y/zvfojBSOD+Tk/1H+06Osm3waEaVUFUMicWnKrFObehwvI 6ie0zv/Q3C1npdOipz3GawKNUHmjd/ZHaEVHDh5FVJyTlB11dCoRLfL0+E/qN1eiCqjg 4IrRbGyKp9eJc69GL48mmOt+Y84a18jJwBDKqYoffUmVK8buyXHagLN3IEbVYEgmOgIm pWIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=10Q4A8cRCVZ62JEp8/wkwk+13xjXhUiGKYrwNjDciL8=; b=r7oD5rcG5Scr1LG4vcxDMcZwOL2iYgLdZkCoREv6lJFIZFJt26W35rL40oNF+Advfc x5bC+jrwqvpnX5GgguWiYSo0vQP1780xWH8biEbqff6zx0I0Dk+7j+IS14VGtnXr+11R fPk13StUH2jCzXQLaCjpj74Z+Smzvck8K7He2vQsua5EWfB9f2/+Hpv+5NuNB7Wn64/n s3IGpp5KnvFGACaUrzycxqhep268ZDDHq2YJvt14FF9SukPac+iBl5HU5cf/zGK/Id9N A08GIvyRWxXX+NZHNWYLdGyNse9Scj6tZbhuRtEkkCZsBCqyZxCqDeAa1ZgN/VYq+OLO 7NQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nFfWeqvC; 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 n78si13302358pfi.235.2019.02.03.04.13.19; Sun, 03 Feb 2019 04:13:35 -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=nFfWeqvC; 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 S1727806AbfBCMMU (ORCPT + 99 others); Sun, 3 Feb 2019 07:12:20 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36266 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727646AbfBCMMT (ORCPT ); Sun, 3 Feb 2019 07:12:19 -0500 Received: by mail-lj1-f194.google.com with SMTP id g11-v6so9446825ljk.3 for ; Sun, 03 Feb 2019 04:12:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=10Q4A8cRCVZ62JEp8/wkwk+13xjXhUiGKYrwNjDciL8=; b=nFfWeqvCAFPf7SyAF02GxnT6T0aeeFZK6SDzSFPnAFHXCMXkqhXP7WaR//u0/QIFBo /krDPpuTpTU25c9htE+FY6UCucyRl3ngWDnoPEEmSNY+EMfNZi1gCS4HCK47bBIZPjLv H8IGi9gskuDoZz5cDX8mxEJeyeekYVEBnCIkRlyOrU67eqkuRY49O7Cc+JBbj+Bt9IDY v2MIw2+a2Bquf7hsXOZRor6Uzyaut/+b7elxyDnGP3FG6DeUPTmhuAq4eaXbeyiVR90j EHy1JWUSAH/6YHsTI0u4a9jeu/oM2RgBidKqsATvR2UgYsR+RR0Z9iQdSVoclpV3U0p1 P0AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=10Q4A8cRCVZ62JEp8/wkwk+13xjXhUiGKYrwNjDciL8=; b=CsnV7I9fPYhnneXBurGswGAm7GtciTYsXzg61hWnp3vnZGjBkAEvAwd6IJmb3r94ar jFNb8Mhih0jgOKSYvJuNd1pvxfQo49AQOm/xWlV2rF/A+0NZfoIK6mrNft0qRpgn/9Ru PVwmvoB2XEZ/BnDEihU4xC6EkaROe/ubeJrBj0vmJIxOyjQxVekI1cGZ52HB96po8VY2 0clIwHCakTzRpcDnO4AZFWFMf0Ba0uo/POY/y0QgELu4MVUsAxtzuw+2l8+X7j3HqHjt TFGar9+wwX55d6e0QT3wlWMw1nOsSpCKM4AebYPzulwrSPoAuprFYjezD3G3L9MwKUcT IFPQ== X-Gm-Message-State: AJcUukdaX+ncn3WrPZK5+GwAk4XkMYNrdo7Zuf/pYjSoHGHnhSy3Sy0l KetebKNyatjM9oWxfZSWpgVXPg4xLgPIYHqQ10A= X-Received: by 2002:a2e:9849:: with SMTP id e9-v6mr36673565ljj.9.1549195937638; Sun, 03 Feb 2019 04:12:17 -0800 (PST) MIME-Version: 1.0 References: <20190131031222.GA2356@jordon-HP-15-Notebook-PC> In-Reply-To: <20190131031222.GA2356@jordon-HP-15-Notebook-PC> From: Souptick Joarder Date: Sun, 3 Feb 2019 17:42:09 +0530 Message-ID: Subject: Re: [PATCHv2 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range To: Andrew Morton , Matthew Wilcox , Michal Hocko , joro@8bytes.org, Russell King - ARM Linux , robin.murphy@arm.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Linux-MM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joerg, On Thu, Jan 31, 2019 at 8:38 AM Souptick Joarder wrote: > > Convert to use vm_insert_range() to map range of kernel > memory to user vma. > > Signed-off-by: Souptick Joarder Can you please help to review this patch ? > --- > 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 >