Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp960070img; Mon, 18 Mar 2019 19:24:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxq2VbmeDb/15ajdsagIB54I/bBlwr8WAH+GtYmJ3k6Bxi98IErtbBoB/qXJgDX6Zw6AIKd X-Received: by 2002:a65:41ca:: with SMTP id b10mr5263pgq.146.1552962245899; Mon, 18 Mar 2019 19:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552962245; cv=none; d=google.com; s=arc-20160816; b=pa95CDqxAC3xApZiE32uKdirP6SeGPFi1AO4R+cNt/+bd7r1c40AoSoHiS8xmY5J3h JDlHcDcDWYqisWhvjqZg1O2GsR6qRa/H9R7YKakzVIVlnybe7undGBCEU+jP9quAAiSm TpUnOBfqaxcaz8R1VdwlOVCgoqNtqNS16iGVCZy1m6wIryddr9ZbDc0a+MIx0WfhgwOW RBaTcOro6Dfhd8BQfLxQu1ytBa4wMfSu9V3w6uvINi8NAu7u3tQ9HJiUwqtF04iCqw0P P/h/tm79MLlkC0qak4n17SSGfHv/2dpnxmG3GwE5h3/oaDQa34IvVhIZak3Zxnqc5e57 JNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=AUAFFqX2n8sIpw7SScBV/3eXS2qKRY5C7MELhXvAPGmfwPMihVGO33L7RsdQvoma6+ BS/W+q5aWdwKugbzffzCr3t1/yWoNVE1od9NsQc5C3mQq5F++UnvB3Q8TRQs/nfK2lPg OAVmK8QsFSw0c0HN7UgmckzC6vZWJjkLNfl2Xx4HlpD8cjcOvl5DGSe8GdX15KZDBeyv 6sq609NAyi1x5RKBrPN+aCVK8a3wepoS+saw5JjM+P4K6UbDiQGs2ayzA30Lrncv9Yfj vd8H3naie8FsJJSK0k1HEQLhk78TKHy9EiwsM6gQQk0ZZBFGe7YW6UiRxEKTm6khJvMC FyNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r0tcryB8; 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 a7si10179221pgq.429.2019.03.18.19.23.51; Mon, 18 Mar 2019 19:24:05 -0700 (PDT) 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=r0tcryB8; 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 S1727472AbfCSCXD (ORCPT + 99 others); Mon, 18 Mar 2019 22:23:03 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38319 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfCSCXC (ORCPT ); Mon, 18 Mar 2019 22:23:02 -0400 Received: by mail-pf1-f195.google.com with SMTP id n125so12595955pfn.5 for ; Mon, 18 Mar 2019 19:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=r0tcryB8FIFERLIj7h0R33SOmYQKY3BszrJoO9gjENz3TFDIJjslV5YKjuYSuiYBUV i4+oGUagTKlmINiPDRLeTjbaA0eWp0BIpZZgCb2Qe0Tao76itUzijedlOG2GIRjFE/Hz BaWedKn2ryfGsOn5FBK7iz78EkzaoCRUznER5dHb86rqpZNrvE6rCWhhXrrRvSBpf9C1 7ILDZf7aFsdefLmMnDiUZnSWFexWdlbI3y3kvYZ9e/pzLyTe0dvAvQ2aONlmJJdR4Pcn X3qaxjDMZwQfqR4Aaa6V6UxgRjnM6WB3QSwTbx0ZuSHyFlLa2E63NVEBREXlVUGi2Z6J 6X6g== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wsI5nOykFSX6S7SyN92+LRaxG3yXSZXxVHkiaYJTa/M=; b=p1XGX/Fcfy+g5ZM1jtwGCEcNFX5ZozcD+4MEsTqA6YJqqif4KV1DUe1aJmwh03N5K0 //EEkrPuyRbc7M1jQuvhvMoMa/8lYRVUY8t7IHFx6MmXe83IuWu03tXmMF6Uqd/WqP51 K+lyO0V2kjBT92+e0J+zHbAxFX778OxQR9bhjMbPXFHDJWw2n85vcH79V+9LF7KLmlHU AfhDslvtG6JBosDE5wHhyC1PxlzWcW8PIfzBf05dQ47Lm0ez0w3xDfXPMcnBQ6Uvtwyf KFS3Zd+B78YoVD0fwNcpgQlApRfRtt+R4pq64mPPwMHMoyToiC7IU0aWgiBABbFxsoif wE1A== X-Gm-Message-State: APjAAAVqaoNAXPzXX2SjB5/AyvC6RKqaB033JUhXItLOmsSCYxgs3X1n zy0xt3KdWfXZIzTPX5TewG4= X-Received: by 2002:a17:902:1:: with SMTP id 1mr13784pla.226.1552962181959; Mon, 18 Mar 2019 19:23:01 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([106.51.22.39]) by smtp.gmail.com with ESMTPSA id 3sm15567578pfp.115.2019.03.18.19.23.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Mar 2019 19:23:01 -0700 (PDT) Date: Tue, 19 Mar 2019 07:57:36 +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: [RESEND PATCH v4 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_map_pages() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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