From patchwork Fri Jul 26 09:24:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2833932 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 292A49F4D4 for ; Fri, 26 Jul 2013 09:25:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C70320142 for ; Fri, 26 Jul 2013 09:25:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E356A2013D for ; Fri, 26 Jul 2013 09:25:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05768E6406 for ; Fri, 26 Jul 2013 02:25:33 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by gabe.freedesktop.org (Postfix) with ESMTP id A5D4DE5BF7 for ; Fri, 26 Jul 2013 02:25:18 -0700 (PDT) Received: by mail-ee0-f47.google.com with SMTP id e49so1416680eek.20 for ; Fri, 26 Jul 2013 02:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=aAXmFDz+sn8P4PWUjHZ+HHzXUG1avvRnp6l55K0gXSc=; b=ycI4vq4UrwP9LIjUM/u2tR/4gkkWY9xKdmC4acDAla42s345BVmcywEaRzhln6S/uI QJlARxybwxsPR1XVoMiaWjHKAwrIXKGElhuQeNICVh4W74VYoS4mkrKX2pTYXA+uUaQR bUSjxXtxPxBwxy8ngxD4AgOSy01MD2lxkaOkFVAzmGzcCQsnLd93hu/7I1pJvBC0Xvhr gPafhkTGU/BEEzPssSaV18CFWlTpCOLordsHXqJlU89Ce6WtHKTH3dDOjCik/GlO4Ius 13zLIq7sjbEA/K4Kh9yh/udSbVeNGVkgBLQJu3ctU58cCYKqyTvpjBK1MeOh/sMu3SM1 2HTA== X-Received: by 10.15.90.139 with SMTP id q11mr46531092eez.137.1374830717737; Fri, 26 Jul 2013 02:25:17 -0700 (PDT) Received: from localhost.localdomain (stgt-5f718745.pool.mediaWays.net. [95.113.135.69]) by mx.google.com with ESMTPSA id n45sm79717048eew.1.2013.07.26.02.25.15 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jul 2013 02:25:16 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/gem: fix mmap vma size calculations Date: Fri, 26 Jul 2013 11:24:45 +0200 Message-Id: <1374830685-21602-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: References: Cc: Sedat Dilek , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The VMA manager is page-size based so drm_vma_node_size() returns the size in pages. However, drm_gem_mmap_obj() requires the size in bytes. Apply PAGE_SHIFT so we no longer get EINVAL during mmaps. This bug was introduced with the recent intrduction of the unified VMA manager. Fixes i915 gtt mmap failure reported by Sedat Dilek in: Re: linux-next: Tree for Jul 25 [ call-trace: drm | drm-intel related? ] Cc: Sedat Dilek Cc: Daniel Vetter Cc: Chris Wilson Signed-off-by: David Herrmann --- drivers/gpu/drm/drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 3613b50..1f76572 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -666,7 +666,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) } obj = container_of(node, struct drm_gem_object, vma_node); - ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node), vma); + ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT, vma); mutex_unlock(&dev->struct_mutex);