Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3133453imu; Sun, 27 Jan 2019 22:34:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN4zhqk2kPlWYHkB3BsgPHtqLE6N4aFr7MfDO94rNVN6V+tDVkjyqncQ/W2M5ohL7FjojUiC X-Received: by 2002:a17:902:2867:: with SMTP id e94mr20914630plb.264.1548657248702; Sun, 27 Jan 2019 22:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657248; cv=none; d=google.com; s=arc-20160816; b=cCWuqkR9SH3HiWemx5xqoEtUqqTdl09Dfp6V+3qlbeAT7A6yxZ0KgHGl/aEX9jQo8h tIcMemrTSpnc49kJuWgq57xdTQmWLuqy9Kn2qiS8BGKnvWGa2aSlQ0DtGiT7L2wWNa7i ZTRzesi/SmPJY0/+C5J//X1qhAlZHY9Hrm+nOXdcSoYQd4vRUQLd9pls6nECULGEfLJo h7vn7SfrWUAAGKYD2qXgUVpBXEAGfBZyo4fsfKjDpElmNCDEOxGFp/mok+KfgDWgIRwt EnO7ClIA36pkv0e+IQn7WlwD68uycSGu0LQ5yIuG/esl/R15qCRCB0rYMEb75xfSky1s XDJA== 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=Xo1XRWo+UsOWJB0j8DeP+bJpW8d+zCzkO/oslyAm+ZY=; b=kdb14gWfLgbQL8pii2AvKzy5HkLnax9H7EYD569i9hndAvhNYf5wUMqf2+Xy9eKn/d GnM0Cx5x2yVU9byTj7vSFtL6yHlnAMG1EMmvQnBOVu+KK/iyRyQ/3cG5B2azxzgchVyj pQvF3cX0zObxs/xBdM0okYmolPFz04CHHBh3gTbqhOgtPcDCUWwRxdp/wKsmNY1HAw/H a/VmUksHhV8SHoebGv/pifUOPmfQ2RC7EnKyNPUC/0Mv2gMc3IMHnTHg3A74vntQheQb X3cItQNPGnc1QUKQNCpMuYrY4D2pplIEVmninmsKtUF84edu1Iok1cKQBMXPD1BipUrY klVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SrkEZvke; 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 j26si12256507pgl.537.2019.01.27.22.33.53; Sun, 27 Jan 2019 22:34:08 -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=SrkEZvke; 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 S1726845AbfA1Gb4 (ORCPT + 99 others); Mon, 28 Jan 2019 01:31:56 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33177 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbfA1Gbz (ORCPT ); Mon, 28 Jan 2019 01:31:55 -0500 Received: by mail-lj1-f194.google.com with SMTP id v1-v6so13225532ljd.0 for ; Sun, 27 Jan 2019 22:31:54 -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=Xo1XRWo+UsOWJB0j8DeP+bJpW8d+zCzkO/oslyAm+ZY=; b=SrkEZvkewK8wCGCd4tU8le3LqMBD4FgqPce3jh4E0ohaqyKSaIfEK/T5MsQOsvOG0O VUtaLhraTkB6Od+YDPTqiH42Wp4M/w3QE51Rm7pYkn8HUzajXjGk9IOY8oGo7nUnqp1z ySB4RLtrTZByVloU5g9dGD/tLdVrksFbZKMYIkEII/XeruQrgsVAlXp/PXsxUC+TV+tA PyQGdNzEBr7b3vmqZu3B0hVsLpi9WoapymNWZXcdUIbMO18OmpqSs5kddu6kb+hRLJvD vz4Lui3WBETrIqEuQvkPe/deSUL4doBbTdWHuwAxyD4+tfL+NumMNwKyFzWTQDfenQaM mraQ== 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=Xo1XRWo+UsOWJB0j8DeP+bJpW8d+zCzkO/oslyAm+ZY=; b=Je3eWmM6eoKaZZAa4mstrMuNyQEr8dzq0fZeS6bIoWhxh8M5LeDb/yshDB3ntXhe2r CLDfrbRmc+ECN1Ro+SANlPlvqrMpAgi8nRQ59XvWDAGw0u3mAC6TcCqzQYLd/i+G3mnC qn2SNvx7YowkheW0LJqnbz7o+XfeGyIyMeg6DwKSF07U+ZC84PZqQdR8n4ZDI1BXU7c8 ai15KWLV4rUY1TCWv1ln04Rhq2SfDC6CAvAblug0T9aC6Wur4jHzzWFe2E92kpTlqJf8 kE7OYkeGMNjXzT5Fj4ygbvt2q6f8A48HnmsfwJU5/u/AdFujXBCjQwPEvcJ08X0ntP82 0KOA== X-Gm-Message-State: AJcUukduoDbMM1hHX3NjBRCrO6iXhsQrYQIgVchXxxhEzLjRW4VwCdw1 lRI2PZ3ZuzXfvFCiYUxoy1UDJV4gtabBjSXIR1Y= X-Received: by 2002:a05:651c:14e:: with SMTP id c14mr16469993ljd.20.1548657113701; Sun, 27 Jan 2019 22:31:53 -0800 (PST) MIME-Version: 1.0 References: <20190111151110.GA2798@jordon-HP-15-Notebook-PC> In-Reply-To: <20190111151110.GA2798@jordon-HP-15-Notebook-PC> From: Souptick Joarder Date: Mon, 28 Jan 2019 12:01:42 +0530 Message-ID: Subject: Re: [PATCH 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 On Fri, Jan 11, 2019 at 8:37 PM Souptick Joarder wrote: > > Convert to use vm_insert_range() to map range of kernel > memory to user vma. > > Signed-off-by: Souptick Joarder Any comment on 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 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, > -- > 1.9.1 >