Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp208370imj; Thu, 14 Feb 2019 18:43:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IabyAqB8d/YlXluZjRE8XpMT0LAPLz8J4tXqPWxSXqVroL5p3sx/A19OgngUENddDGVFwYK X-Received: by 2002:a63:4005:: with SMTP id n5mr3027580pga.86.1550198628442; Thu, 14 Feb 2019 18:43:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198628; cv=none; d=google.com; s=arc-20160816; b=awa3oFCq9+6j/rRPTBZGICEOttRnp7GIYL0bHmUCldZFl2NyUX+uDd3bdJY9V3gt2E lw//bCJ/FeS4Ts/ZeBSizpB3i2hsGVNFCR88UC/cLwah/nsde/AoVmPLMtWyPRR08HUq CjbZHO/ielpwsRuFlwvvH9bvZadUu0shYWOSZSfik2ugBlRJJUKgjzDqV1S2fZskOh+C j71D+NfYai0Uahi+whrblSuSl4LJX36xhaxAZsB8rYqnOlhPcpyo/014+njhI8BtsdFY 8EhjO/ndMOsRsf8WDga9BRLmcihKiJlr+lml7nNhE4W+wa9tVPMNNFPbRjkBHlCZxoxt KHrQ== 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=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=WrPzGCUHlYC/zjXSuUTDzncDYzPkNsxLEQzSOx18VnYITx7sML6ZUxx/OZqoHLkBWZ CjAV9oP9ikdd+IYBvgtBeaWF1Fwuft8KQOUiFCfdQd490p220SlP/WCvP5F2pRui4jbk /lBETPcJobkTLZS4zFrbQif4cMb/oVxjgMEuJ5OcnuIE5gqsJK7r1t8twtmfVsot2ZVO ebR47z1jA1H6DixchMIgvG58JUMTVdCyoUepq0uP0jSfxEeuJLU2KEK59TTTObjyNULB XARheilFJpN0r1TyZSIrN1aIwX8OWEQlUgy2I1SwC9TL/F3VQAAeS5Pp3DMGyhd2JJiS MvZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=foVgED8Y; 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 k125si4069196pfc.21.2019.02.14.18.43.31; Thu, 14 Feb 2019 18:43: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=foVgED8Y; 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 S1732079AbfBOCmG (ORCPT + 99 others); Thu, 14 Feb 2019 21:42:06 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35646 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728881AbfBOCmF (ORCPT ); Thu, 14 Feb 2019 21:42:05 -0500 Received: by mail-pf1-f194.google.com with SMTP id z15so4109341pfa.2 for ; Thu, 14 Feb 2019 18:42:04 -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=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=foVgED8YU33cGUdNyMsYu1taL/xGldIA8jDJx5x9y9I6QigtUvC602CKjwOr0ZsAS/ PrLVwNvSCYqqXgJkNNgsj/JW4o6PWnnMVV+sOZHXGFsGHwcW805LK+wgOzI/x/OVBO8m OE0NJpOQoDOheB7ogbrxz4yXHYX8Q4ORkgGb4p4hR8jDn2jxBGx513wY4g/BSbtUttC0 +EUbqxPKWKxaEIwFfueP5dYGJ5wiFaiaVgytXN65xCDqGoDPEgYzQajnm8GLjMI6x6lJ uIsXrJrh4nv4qyfZmh7llHMdCo3NwZqLV9pBFVPB3QNi9ryMrkqN29sj6ImJovEthc7N Txrw== 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=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=VqvwZ81f7KzE2ADPdyZWieE8Zlkey2ZwIabns0/V8FX6cz291uh/Gy3D++IlcnIDfm J3E752UQFbZbASILHP/pZsmL4CJOG9DVj/KGjreoyGxxA/BzaPwqXG5lA3qdh4cuvqBW ez2s5/7/23usznoCwI3HcXcTKXW62EtRYT8RDlvCIgO8ZFS4swc58sMAnoHxIHNCnAoL pUdIHkiEHUKqIv9zKctVP/IXCx+v/Nt0pEchz/nLk6GGTRccq6Zagx1MS+6DuEnm5F5l U6EXt5Dx439RgXs+zsUu0A345W+udIm8IHWB/0EYSt5GcQRZa9uq7k1K3BhTxsgNRYoc m1bw== X-Gm-Message-State: AHQUAuaeZNbpYYDax73lTyEaX9801StDfNn6Q2zZ4byt/0L3c1S+Tn3u QIHMGvq7U8Sf7He4+4VFGqg= X-Received: by 2002:a62:2e03:: with SMTP id u3mr2225821pfu.257.1550198524099; Thu, 14 Feb 2019 18:42:04 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.53.51]) by smtp.gmail.com with ESMTPSA id k19sm2131657pfi.126.2019.02.14.18.42.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Feb 2019 18:42:03 -0800 (PST) Date: Fri, 15 Feb 2019 08:16:24 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, oleksandr_andrushchenko@epam.com, airlied@linux.ie, linux@armlinux.org.uk, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, xen-devel@lists.xen.org Subject: [PATCH v4 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_map_pages() Message-ID: <20190215024624.GA26425@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 Reviewed-by: Oleksandr Andrushchenko --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c index 28bc501..dd0602d 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -224,8 +224,7 @@ struct drm_gem_object * static int gem_mmap_obj(struct xen_gem_object *xen_obj, struct vm_area_struct *vma) { - unsigned long addr = vma->vm_start; - int i; + int ret; /* * clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the @@ -246,18 +245,11 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj, * FIXME: as we insert all the pages now then no .fault handler must * be called, so don't provide one */ - for (i = 0; i < xen_obj->num_pages; i++) { - int ret; - - ret = vm_insert_page(vma, addr, xen_obj->pages[i]); - if (ret < 0) { - DRM_ERROR("Failed to insert pages into vma: %d\n", ret); - return ret; - } + ret = vm_map_pages(vma, xen_obj->pages, xen_obj->num_pages); + if (ret < 0) + DRM_ERROR("Failed to map pages into vma: %d\n", ret); - addr += PAGE_SIZE; - } - return 0; + return ret; } int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma) -- 1.9.1