Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp213105imj; Wed, 13 Feb 2019 07:10:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IaPiH1tLTNdFydzfLNJVNeXi/miQ4cDtNAleLQ8/f8NYhC4RlX3wvS/LkYjqeu7mOBUlvMr X-Received: by 2002:a65:64d6:: with SMTP id t22mr943960pgv.52.1550070603631; Wed, 13 Feb 2019 07:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550070603; cv=none; d=google.com; s=arc-20160816; b=wAD2+Czh4nUndOZzXgZvdSpqDKDmreRq9seeQS1uofhbSGZRHyKpg85LXz0UAbuTvm QIVnvZaPHlKVi1t0QlDykYyeDTwc47rnbdnhVlW/Tue17XZaV0z9ANLMEpjDGM8xzY4Y 0/pplyqqOPxPjGPDveo4qHmUv2ltvctrhJiVU788+DpUi0b+yZA/HgVp04ntE/9hi//j sL39iytO1ZEFbCCaZZifMRzzlH5AYuZSHO1cOtuHE18o4Xp3v5h/SrcnpwKgi0XxofOp uIrBqrliRTlzfJzdhDj3Fz6n57C5D+DZ5B/ssfwdv7BYVj2HAaoCU+taezCJm2RyKHMB 3kGQ== 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=P2eBUcPVo05aTnywivAmN1MMtZGipZtZcEH3pyXU/IUbaWEWUfx6HtIc6YryJPqwcp nC9hGhHjCeA8+93f83K6jwURwQ87eLm5Q0+hhN06M41TVAVprfO+J+kmoGbYZ9gyB/QA Zst51O9Bj2osiPzOt1P5b/tt4ZnS1oVBkSQwURpxCmA73wo8AXRKlOjlZeb7v5zYCHD7 7gkxs7GDbv+TZ4sLpN71wx8+6Qp8+Vi1nCmAvWWkfDDYOZtOWAX5FePUtx6VZWq3ftsW HJknolBqy6z+JuiB5xH/9JSrOmdkRoly1ifQAeXU7YErPsVpl+z1Y+wMUe4gFNafvscM ZS9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a3NB43+T; 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 p15si16320256plq.24.2019.02.13.07.09.47; Wed, 13 Feb 2019 07:10:03 -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=a3NB43+T; 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 S2391314AbfBMOBD (ORCPT + 99 others); Wed, 13 Feb 2019 09:01:03 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34680 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728701AbfBMOBC (ORCPT ); Wed, 13 Feb 2019 09:01:02 -0500 Received: by mail-pl1-f193.google.com with SMTP id w4so1219084plz.1 for ; Wed, 13 Feb 2019 06:01:02 -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=a3NB43+TY8+WgWQevWmth0jDcxyBS/n2gAoDY2YZP49uixFVqF9mvLnqWGduB6Va/H feQh5HfmgXevrSsUjZhdngnb/naX2abIqktrI2KmmPQ8oNpgax5etRPOVTOOFtAOb1YG zhhHS9mNeuWvPEeHM5vcn+7gTBoWwJ0R+XoaM8QBfMA+CTM2NXjJVl6JImLxquz6l9Fl BtCPxnokINBzCCKtI+vM8SJ03eMGBK4CKngpr1xjCKL7zP2xXkcut5n3iNwAMAKrAb7P epNaoBisfUaCTj5Cg8+sPkYrY82yZ+MPAE/klZurmQjZ9YF6Q78A1sMJks+f4FhOgCiO J+WA== 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=PM30rG9TmZN4ydx/iElO0Cj3TX12p4wVfI4w3bSimzv8/cNHZVCJJImX2SNf4LC964 tbMoLMKmnLq1d7Vzz+ErpAdbpu1I1Km0m0cYFjrSLL3n6lgyuzEcA9KQ4qm2qpsAqsQD eGbS+9fJnpHy1FXuROtVX9PkNgyxQDtEj0nflVZ9jcnO9Gvu1lSWlS/bum69vVSIXbXX CCZ8JLnlBIAK4XWqgkOs119LZ+tHc32MfAA647p76sFpkrrat09d7vRiF8thqa7bd8Nz lUk8lv3WLglrkgQhj8XTT+lLFzFwvckIQYuQXFwQlQR6pPJj8S+aliKbcYv58I+AmHY+ jCgQ== X-Gm-Message-State: AHQUAuZlwsRA5nCgwALm6fdKWxIEMjCLVyNNrlTX8xU0mnHj0YvhIQqL 04JW/mYeUrbhtQBLLYpLpH0= X-Received: by 2002:a17:902:346:: with SMTP id 64mr650376pld.337.1550066462186; Wed, 13 Feb 2019 06:01:02 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.48.54]) by smtp.gmail.com with ESMTPSA id w65sm18734568pfb.23.2019.02.13.06.01.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Feb 2019 06:01:01 -0800 (PST) Date: Wed, 13 Feb 2019 19:35:20 +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 v3 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_map_pages() Message-ID: <20190213140520.GA22029@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