From ae9466b8ab3b57aed55dbab53ba00ca9d7b52d50 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Tue, 19 Feb 2013 20:30:04 +0100 Subject: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation 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+] --- drivers/gpu/drm/nouveau/nvc0_fence.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c index 2a56b1b..d198386 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c @@ -160,11 +160,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; @@ -176,10 +177,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; } -- 1.8.1