From patchwork Tue Feb 19 10:20:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 2162401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 75B7CDF24C for ; Tue, 19 Feb 2013 10:21:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BEF9E60E8 for ; Tue, 19 Feb 2013 02:21:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by gabe.freedesktop.org (Postfix) with ESMTP id D4C3EE5C94; Tue, 19 Feb 2013 02:20:56 -0800 (PST) Received: by mail-wg0-f46.google.com with SMTP id fg15so5228925wgb.1 for ; Tue, 19 Feb 2013 02:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=K15g1lpnOjDEwAULaPON9aB5Z7+E+zRURF0x7AbaqB4=; b=zEn1yC+2vVAol0COkpLURHiVEolort6iibeVrxIDFDRnti5MrlKjtbXg4j4uv9Fg7k 4Po2dYo62er1F1acUnVHMUN622P/oJugiVYPx6S0yP4X1jEJjmYq0IANhItoybc7CHuE YDJAHIivC6yEu/FndbCxHIGb4mUyKGNKKAkEiQ7+hKesYA91zgF6VAWySnVpNO1gnsxn vlsEvAGUyLU5FwGiIjVVcY1r7619D2SPl8qbuEt/4Vmnf9KvOsyGTB+4TVYjAckv49y4 9ZbCYBL5LwHXbDqaCp3pIn2xe+mLgrcvC+Fuv/NKbwIGO0uMnnzeV9hPUygzxgZkxIq1 DhCQ== MIME-Version: 1.0 X-Received: by 10.180.79.227 with SMTP id m3mr22260295wix.12.1361269255913; Tue, 19 Feb 2013 02:20:55 -0800 (PST) Received: by 10.194.173.103 with HTTP; Tue, 19 Feb 2013 02:20:55 -0800 (PST) Date: Tue, 19 Feb 2013 10:20:55 +0000 Message-ID: Subject: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org 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: , 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 Everywhere else the constant is multiplied by 16/4, so it looks like nvc0_fence_suspend/resume is buggy here. Signed-off-by: Maarten Lankhorst Cc: stable@vger.kernel.org [3.7+] Reviewed-by: Marcin Slusarz diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c index 85a0e78..4f46d8b 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c @@ -161,11 +161,12 @@ nvc0_fence_suspend(struct nouveau_drm *drm) struct nouveau_fifo *pfifo = nouveau_fifo(drm->device); struct nvc0_fence_priv *priv = drm->fence; int i; + u32 chan = pfifo->max + 1; - priv->suspend = vmalloc((pfifo->max + 1) * sizeof(u32)); + priv->suspend = vmalloc(chan * sizeof(u32)); if (priv->suspend) { - for (i = 0; i <= pfifo->max; i++) - priv->suspend[i] = nouveau_bo_rd32(priv->bo, i); + for (i = 0; i < chan; i++) + priv->suspend[i] = nouveau_bo_rd32(priv->bo, i * 16/4); } return priv->suspend != NULL; @@ -177,10 +178,11 @@ nvc0_fence_resume(struct nouveau_drm *drm) struct nouveau_fifo *pfifo = nouveau_fifo(drm->device); struct nvc0_fence_priv *priv = drm->fence; int i; + u32 chan = pfifo->max + 1; if (priv->suspend) { - for (i = 0; i <= pfifo->max; i++) - nouveau_bo_wr32(priv->bo, i, priv->suspend[i]); + for (i = 0; i < chan; i++) + nouveau_bo_wr32(priv->bo, i * 16/4, priv->suspend[i]); vfree(priv->suspend); priv->suspend = NULL; }