Skip to content

Commit 8887abb

Browse files
Ben Skeggsairlied
authored andcommitted
drm/nouveau/gsp: add hal for fifo.rc_triggered()
565.57.01 has incompatible changes to rpc_rc_triggered_v17_02. Signed-off-by: Ben Skeggs <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Timur Tabi <[email protected]> Tested-by: Timur Tabi <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent 3194bed commit 8887abb

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,39 @@ r535_runl = {
339339
.allow = r535_runl_allow,
340340
};
341341

342+
static void
343+
r535_fifo_rc_chid(struct nvkm_fifo *fifo, int chid)
344+
{
345+
struct nvkm_chan *chan;
346+
unsigned long flags;
347+
348+
chan = nvkm_chan_get_chid(&fifo->engine, chid, &flags);
349+
if (!chan) {
350+
nvkm_error(&fifo->engine.subdev, "rc: chid %d not found!\n", chid);
351+
return;
352+
}
353+
354+
nvkm_chan_error(chan, false);
355+
nvkm_chan_put(&chan, flags);
356+
}
357+
358+
static int
359+
r535_fifo_rc_triggered(void *priv, u32 fn, void *repv, u32 repc)
360+
{
361+
rpc_rc_triggered_v17_02 *msg = repv;
362+
struct nvkm_gsp *gsp = priv;
363+
364+
if (WARN_ON(repc < sizeof(*msg)))
365+
return -EINVAL;
366+
367+
nvkm_error(&gsp->subdev, "rc: engn:%08x chid:%d type:%d scope:%d part:%d\n",
368+
msg->nv2080EngineType, msg->chid, msg->exceptType, msg->scope,
369+
msg->partitionAttributionId);
370+
371+
r535_fifo_rc_chid(gsp->subdev.device->fifo, msg->chid);
372+
return 0;
373+
}
374+
342375
static int
343376
r535_fifo_xlat_rm_engine_type(u32 rm, enum nvkm_subdev_type *ptype, int *p2080)
344377
{
@@ -558,6 +591,7 @@ const struct nvkm_rm_api_fifo
558591
r535_fifo = {
559592
.xlat_rm_engine_type = r535_fifo_xlat_rm_engine_type,
560593
.ectx_size = r535_fifo_ectx_size,
594+
.rc_triggered = r535_fifo_rc_triggered,
561595
.chan = {
562596
.alloc = r535_chan_alloc,
563597
},

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

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -926,33 +926,6 @@ r535_gsp_msg_os_error_log(void *priv, u32 fn, void *repv, u32 repc)
926926
return 0;
927927
}
928928

929-
static int
930-
r535_gsp_msg_rc_triggered(void *priv, u32 fn, void *repv, u32 repc)
931-
{
932-
rpc_rc_triggered_v17_02 *msg = repv;
933-
struct nvkm_gsp *gsp = priv;
934-
struct nvkm_subdev *subdev = &gsp->subdev;
935-
struct nvkm_chan *chan;
936-
unsigned long flags;
937-
938-
if (WARN_ON(repc < sizeof(*msg)))
939-
return -EINVAL;
940-
941-
nvkm_error(subdev, "rc engn:%08x chid:%d type:%d scope:%d part:%d\n",
942-
msg->nv2080EngineType, msg->chid, msg->exceptType, msg->scope,
943-
msg->partitionAttributionId);
944-
945-
chan = nvkm_chan_get_chid(&subdev->device->fifo->engine, msg->chid, &flags);
946-
if (!chan) {
947-
nvkm_error(subdev, "rc chid:%d not found!\n", msg->chid);
948-
return 0;
949-
}
950-
951-
nvkm_chan_error(chan, false);
952-
nvkm_chan_put(&chan, flags);
953-
return 0;
954-
}
955-
956929
static int
957930
r535_gsp_msg_mmu_fault_queued(void *priv, u32 fn, void *repv, u32 repc)
958931
{
@@ -2154,8 +2127,7 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)
21542127
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER,
21552128
r535_gsp_msg_run_cpu_sequencer, gsp);
21562129
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_POST_EVENT, r535_gsp_msg_post_event, gsp);
2157-
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_RC_TRIGGERED,
2158-
r535_gsp_msg_rc_triggered, gsp);
2130+
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_RC_TRIGGERED, rmapi->fifo->rc_triggered, gsp);
21592131
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED,
21602132
r535_gsp_msg_mmu_fault_queued, gsp);
21612133
r535_gsp_msg_ntfy_add(gsp, NV_VGPU_MSG_EVENT_OS_ERROR_LOG, r535_gsp_msg_os_error_log, gsp);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ struct nvkm_rm_api {
102102
enum nvkm_subdev_type *, int *nv2080_type);
103103
int (*ectx_size)(struct nvkm_fifo *);
104104
unsigned rsvd_chids;
105+
int (*rc_triggered)(void *priv, u32 fn, void *repv, u32 repc);
105106
struct {
106107
int (*alloc)(struct nvkm_gsp_device *, u32 handle,
107108
u32 nv2080_engine_type, u8 runq, bool priv, int chid,

0 commit comments

Comments
 (0)