Blob Blame History Raw
From c32c529f575fec21b3183a475d1fa940a594eab3 Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Wed, 15 Jan 2020 06:34:22 +1000
Subject: drm/nouveau/flcn/cmdq: cmd_queue_close always commits, simplify it
Git-commit: c2c9b243189fd4f92cb2ed52a1ab76277d9807a5
Patch-mainline: v5.6-rc1
References: jsc#SLE-12680, jsc#SLE-12880, jsc#SLE-12882, jsc#SLE-12883, jsc#SLE-13496, jsc#SLE-15322

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c b/drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c
index b91971e15cc9..13e6e302a09e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c
+++ b/drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c
@@ -97,14 +97,9 @@ cmd_queue_open(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue,
 }
 
 static void
-cmd_queue_close(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue,
-		bool commit)
+cmd_queue_close(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue)
 {
-	struct nvkm_falcon *falcon = priv->falcon;
-
-	if (commit)
-		nvkm_falcon_wr32(falcon, queue->head_reg, queue->position);
-
+	nvkm_falcon_wr32(queue->qmgr->falcon, queue->head_reg, queue->position);
 	mutex_unlock(&queue->mutex);
 }
 
@@ -116,7 +111,6 @@ cmd_write(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_hdr *cmd,
 	static unsigned timeout = 2000;
 	unsigned long end_jiffies = jiffies + msecs_to_jiffies(timeout);
 	int ret = -EAGAIN;
-	bool commit = true;
 
 	while (ret == -EAGAIN && time_before(jiffies, end_jiffies))
 		ret = cmd_queue_open(priv, queue, cmd->size);
@@ -126,7 +120,7 @@ cmd_write(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_hdr *cmd,
 	}
 
 	cmd_queue_push(priv, queue, cmd, cmd->size);
-	cmd_queue_close(priv, queue, commit);
+	cmd_queue_close(priv, queue);
 	return ret;
 }
 
-- 
2.28.0