]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/nouveau/nvkm: introduce new GSP reply policy NVKM_GSP_RPC_REPLY_POLL
authorZhi Wang <zhiw@nvidia.com>
Thu, 27 Feb 2025 01:35:54 +0000 (01:35 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Sun, 9 Mar 2025 12:42:10 +0000 (13:42 +0100)
Some GSP RPC commands need a new reply policy: "caller don't care about
the message content but want to make sure a reply is received". To
support this case, a new reply policy is introduced.

NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY is a large GSP RPC command. The actual
required policy is NVKM_GSP_RPC_REPLY_POLL. This can be observed from the
dump of the GSP message queue. After the large GSP RPC command is issued,
GSP will write only an empty RPC header in the queue as the reply.

Without this change, the policy "receiving the entire message" is used
for NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY. This causes the timeout of receiving
the returned GSP message in the suspend/resume path.

Introduce the new reply policy NVKM_GSP_RPC_REPLY_POLL, which waits for
the returned GSP message but discards it for the caller. Use the new policy
NVKM_GSP_RPC_REPLY_POLL on the GSP RPC command
NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY.

Fixes: 50f290053d79 ("drm/nouveau: support handling the return of large GSP message")
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Ben Skeggs <bskeggs@nvidia.com>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250227013554.8269-3-zhiw@nvidia.com
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c

index e5fe44589bbda6398d9c3267a369201d8fc99fc6..1c12854a85505a875a445c99a9b91b5e22205996 100644 (file)
@@ -44,10 +44,14 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep
  * NVKM_GSP_RPC_REPLY_RECV - If specified, wait and receive the entire GSP
  * RPC message after the GSP RPC command is issued.
  *
+ * NVKM_GSP_RPC_REPLY_POLL - If specified, wait for the specific reply and
+ * discard the reply before returning to the caller.
+ *
  */
 enum nvkm_gsp_rpc_reply_policy {
        NVKM_GSP_RPC_REPLY_NOWAIT = 0,
        NVKM_GSP_RPC_REPLY_RECV,
+       NVKM_GSP_RPC_REPLY_POLL,
 };
 
 struct nvkm_gsp {
index f73dcc3e1c0d04e451ffd39a34d1523292882cd6..969f6b921fdbd4cebd976d77c4d6d4784302755b 100644 (file)
@@ -602,6 +602,9 @@ r535_gsp_rpc_handle_reply(struct nvkm_gsp *gsp, u32 fn,
                else
                        repv = reply;
                break;
+       case NVKM_GSP_RPC_REPLY_POLL:
+               repv = r535_gsp_msg_recv(gsp, fn, 0);
+               break;
        }
 
        return repv;
index 2789efe9c100e4b97432524b679b2acea76c071b..35ba1798ee6e49f512b60957fdd66583d121d0de 100644 (file)
@@ -105,7 +105,7 @@ fbsr_memlist(struct nvkm_gsp_device *device, u32 handle, enum nvkm_memory_target
                        rpc->pteDesc.pte_pde[i].pte = (phys >> 12) + i;
        }
 
-       ret = nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_RECV);
+       ret = nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_POLL);
        if (ret)
                return ret;