xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/fifo/runq.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_RUNQ_H__
3 #define __NVKM_RUNQ_H__
4 #include <core/os.h>
5 struct nvkm_runl;
6 
7 struct nvkm_runq {
8 	const struct nvkm_runq_func {
9 		void (*init)(struct nvkm_runq *);
10 		bool (*intr)(struct nvkm_runq *, struct nvkm_runl *);
11 		const struct nvkm_bitfield *intr_0_names;
12 		bool (*intr_1_ctxnotvalid)(struct nvkm_runq *, int chid);
13 		bool (*idle)(struct nvkm_runq *);
14 	} *func;
15 	struct nvkm_fifo *fifo;
16 	int id;
17 
18 	struct list_head head;
19 };
20 
21 struct nvkm_runq *nvkm_runq_new(struct nvkm_fifo *, int pbid);
22 void nvkm_runq_del(struct nvkm_runq *);
23 
24 #define nvkm_runq_foreach(runq,fifo) list_for_each_entry((runq), &(fifo)->runqs, head)
25 #define nvkm_runq_foreach_cond(runq,fifo,cond) nvkm_list_foreach(runq, &(fifo)->runqs, head, (cond))
26 
27 #define RUNQ_PRINT(r,l,p,f,a...)							   \
28 	nvkm_printk__(&(r)->fifo->engine.subdev, NV_DBG_##l, p, "PBDMA%d:"f, (r)->id, ##a)
29 #define RUNQ_ERROR(r,f,a...) RUNQ_PRINT((r), ERROR,    err, " "f"\n", ##a)
30 #define RUNQ_DEBUG(r,f,a...) RUNQ_PRINT((r), DEBUG,   info, " "f"\n", ##a)
31 #endif
32