Skip to content

Commit a738fa9

Browse files
zhiwang-nvidiaDanilo Krummrich
authored andcommitted
drm/nouveau/nvkm: introduce new GSP reply policy NVKM_GSP_RPC_REPLY_POLL
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: 50f2900 ("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
1 parent 4570355 commit a738fa9

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep
4444
* NVKM_GSP_RPC_REPLY_RECV - If specified, wait and receive the entire GSP
4545
* RPC message after the GSP RPC command is issued.
4646
*
47+
* NVKM_GSP_RPC_REPLY_POLL - If specified, wait for the specific reply and
48+
* discard the reply before returning to the caller.
49+
*
4750
*/
4851
enum nvkm_gsp_rpc_reply_policy {
4952
NVKM_GSP_RPC_REPLY_NOWAIT = 0,
5053
NVKM_GSP_RPC_REPLY_RECV,
54+
NVKM_GSP_RPC_REPLY_POLL,
5155
};
5256

5357
struct nvkm_gsp {

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ r535_gsp_rpc_handle_reply(struct nvkm_gsp *gsp, u32 fn,
602602
else
603603
repv = reply;
604604
break;
605+
case NVKM_GSP_RPC_REPLY_POLL:
606+
repv = r535_gsp_msg_recv(gsp, fn, 0);
607+
break;
605608
}
606609

607610
return repv;

drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fbsr_memlist(struct nvkm_gsp_device *device, u32 handle, enum nvkm_memory_target
105105
rpc->pteDesc.pte_pde[i].pte = (phys >> 12) + i;
106106
}
107107

108-
ret = nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_RECV);
108+
ret = nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_POLL);
109109
if (ret)
110110
return ret;
111111

0 commit comments

Comments
 (0)