Skip to content

Commit 90caca3

Browse files
committed
nouveau/gsp: use rpc sequence numbers properly.
There are two layers of sequence numbers, one at the msg level and one at the rpc level. 570 firmware started asserting on the sequence numbers being in the right order, and we would see nocat records with asserts in them. Add the rpc level sequence number support. Fixes: 53dac06 ("drm/nouveau/gsp: add support for 570.144") Cc: <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Tested-by: Lyude Paul <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 78f1421 commit 90caca3

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep
4444
* NVKM_GSP_RPC_REPLY_NOWAIT - If specified, immediately return to the
4545
* caller after the GSP RPC command is issued.
4646
*
47+
* NVKM_GSP_RPC_REPLY_NOSEQ - If specified, exactly like NOWAIT
48+
* but don't emit RPC sequence number.
49+
*
4750
* NVKM_GSP_RPC_REPLY_RECV - If specified, wait and receive the entire GSP
4851
* RPC message after the GSP RPC command is issued.
4952
*
@@ -53,6 +56,7 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep
5356
*/
5457
enum nvkm_gsp_rpc_reply_policy {
5558
NVKM_GSP_RPC_REPLY_NOWAIT = 0,
59+
NVKM_GSP_RPC_REPLY_NOSEQ,
5660
NVKM_GSP_RPC_REPLY_RECV,
5761
NVKM_GSP_RPC_REPLY_POLL,
5862
};
@@ -242,6 +246,8 @@ struct nvkm_gsp {
242246
/* The size of the registry RPC */
243247
size_t registry_rpc_size;
244248

249+
u32 rpc_seq;
250+
245251
#ifdef CONFIG_DEBUG_FS
246252
/*
247253
* Logging buffers in debugfs. The wrapper objects need to remain

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp)
704704

705705
build_registry(gsp, rpc);
706706

707-
return nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_NOWAIT);
707+
return nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_NOSEQ);
708708

709709
fail:
710710
clean_registry(gsp);
@@ -921,7 +921,7 @@ r535_gsp_set_system_info(struct nvkm_gsp *gsp)
921921
info->pciConfigMirrorSize = device->pci->func->cfg.size;
922922
r535_gsp_acpi_info(gsp, &info->acpiMethodData);
923923

924-
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOWAIT);
924+
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOSEQ);
925925
}
926926

927927
static int

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ r535_gsp_rpc_handle_reply(struct nvkm_gsp *gsp, u32 fn,
557557

558558
switch (policy) {
559559
case NVKM_GSP_RPC_REPLY_NOWAIT:
560+
case NVKM_GSP_RPC_REPLY_NOSEQ:
560561
break;
561562
case NVKM_GSP_RPC_REPLY_RECV:
562563
reply = r535_gsp_msg_recv(gsp, fn, gsp_rpc_len);
@@ -588,6 +589,11 @@ r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *payload,
588589
rpc->data, rpc->length - sizeof(*rpc), true);
589590
}
590591

592+
if (policy == NVKM_GSP_RPC_REPLY_NOSEQ)
593+
rpc->sequence = 0;
594+
else
595+
rpc->sequence = gsp->rpc_seq++;
596+
591597
ret = r535_gsp_cmdq_push(gsp, rpc);
592598
if (ret)
593599
return ERR_PTR(ret);

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ r570_gsp_set_system_info(struct nvkm_gsp *gsp)
176176
info->bIsPrimary = video_is_primary_device(device->dev);
177177
info->bPreserveVideoMemoryAllocations = false;
178178

179-
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOWAIT);
179+
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOSEQ);
180180
}
181181

182182
static void

0 commit comments

Comments
 (0)