Skip to content

Commit 59f6a3d

Browse files
committed
nouveau/gsp: convert gsp errors to generic errors
This should let the upper layers retry as needed on EAGAIN. There may be other values we will care about in the future, but this covers our present needs. Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cf22fc2 commit 59f6a3d

File tree

1 file changed

+21
-5
lines changed
  • drivers/gpu/drm/nouveau/nvkm/subdev/gsp

1 file changed

+21
-5
lines changed

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ struct r535_gsp_msg {
7070

7171
#define GSP_MSG_HDR_SIZE offsetof(struct r535_gsp_msg, data)
7272

73+
static int
74+
r535_rpc_status_to_errno(uint32_t rpc_status)
75+
{
76+
switch (rpc_status) {
77+
case 0x55: /* NV_ERR_NOT_READY */
78+
case 0x66: /* NV_ERR_TIMEOUT_RETRY */
79+
return -EAGAIN;
80+
case 0x51: /* NV_ERR_NO_MEMORY */
81+
return -ENOMEM;
82+
default:
83+
return -EINVAL;
84+
}
85+
}
86+
7387
static void *
7488
r535_gsp_msgq_wait(struct nvkm_gsp *gsp, u32 repc, u32 *prepc, int *ptime)
7589
{
@@ -584,8 +598,9 @@ r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *argv, u32 repc)
584598
return rpc;
585599

586600
if (rpc->status) {
587-
nvkm_error(&gsp->subdev, "RM_ALLOC: 0x%x\n", rpc->status);
588-
ret = ERR_PTR(-EINVAL);
601+
ret = ERR_PTR(r535_rpc_status_to_errno(rpc->status));
602+
if (ret != -EAGAIN)
603+
nvkm_error(&gsp->subdev, "RM_ALLOC: 0x%x\n", rpc->status);
589604
} else {
590605
ret = repc ? rpc->params : NULL;
591606
}
@@ -639,9 +654,10 @@ r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void *argv, u32 repc)
639654
return rpc;
640655

641656
if (rpc->status) {
642-
nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n",
643-
object->client->object.handle, object->handle, rpc->cmd, rpc->status);
644-
ret = ERR_PTR(-EINVAL);
657+
ret = ERR_PTR(r535_rpc_status_to_errno(rpc->status));
658+
if (ret != -EAGAIN)
659+
nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n",
660+
object->client->object.handle, object->handle, rpc->cmd, rpc->status);
645661
} else {
646662
ret = repc ? rpc->params : NULL;
647663
}

0 commit comments

Comments
 (0)