1 /* SPDX-License-Identifier: MIT */
2 #ifndef __GK104_FIFO_H__
3 #define __GK104_FIFO_H__
4 #define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
9 #include <subdev/mmu.h>
11 struct gk104_fifo_chan;
13 const struct gk104_fifo_func *func;
14 struct nvkm_fifo base;
17 struct work_struct work;
25 struct nvkm_engine *engine;
32 struct nvkm_memory *mem[2];
34 wait_queue_head_t wait;
35 struct list_head cgrp;
36 struct list_head chan;
43 struct nvkm_memory *mem;
48 struct gk104_fifo_func {
50 void (*fault)(struct nvkm_fifo *, int unit);
53 const struct gk104_fifo_pbdma_func {
54 int (*nr)(struct gk104_fifo *);
55 void (*init)(struct gk104_fifo *);
56 void (*init_timeout)(struct gk104_fifo *);
60 const struct nvkm_enum *access;
61 const struct nvkm_enum *engine;
62 const struct nvkm_enum *reason;
63 const struct nvkm_enum *hubclient;
64 const struct nvkm_enum *gpcclient;
67 const struct gk104_fifo_runlist_func {
69 void (*cgrp)(struct nvkm_fifo_cgrp *,
70 struct nvkm_memory *, u32 offset);
71 void (*chan)(struct gk104_fifo_chan *,
72 struct nvkm_memory *, u32 offset);
73 void (*commit)(struct gk104_fifo *, int runl,
74 struct nvkm_memory *, int entries);
77 struct gk104_fifo_user_user {
78 struct nvkm_sclass user;
79 int (*ctor)(const struct nvkm_oclass *, void *, u32,
80 struct nvkm_object **);
83 struct gk104_fifo_chan_user {
84 struct nvkm_sclass user;
85 int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *,
86 void *, u32, struct nvkm_object **);
91 struct gk104_fifo_engine_status {
103 int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *, enum nvkm_subdev_type,
104 int index, int nr, struct nvkm_fifo **);
105 void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
106 void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
107 void gk104_fifo_runlist_update(struct gk104_fifo *, int runl);
108 void gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn,
109 struct gk104_fifo_engine_status *status);
110 void gk104_fifo_intr_bind(struct gk104_fifo *fifo);
111 void gk104_fifo_intr_chsw(struct gk104_fifo *fifo);
112 void gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo);
113 void gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit);
114 void gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit);
115 void gk104_fifo_intr_runlist(struct gk104_fifo *fifo);
116 void gk104_fifo_intr_engine(struct gk104_fifo *fifo);
117 void *gk104_fifo_dtor(struct nvkm_fifo *base);
118 int gk104_fifo_oneinit(struct nvkm_fifo *base);
119 int gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data);
120 void gk104_fifo_init(struct nvkm_fifo *base);
121 void gk104_fifo_fini(struct nvkm_fifo *base);
122 int gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
123 void *argv, u32 argc, struct nvkm_object **pobject);
124 int gk104_fifo_class_get(struct nvkm_fifo *base, int index,
125 struct nvkm_oclass *oclass);
126 void gk104_fifo_uevent_fini(struct nvkm_fifo *fifo);
127 void gk104_fifo_uevent_init(struct nvkm_fifo *fifo);
129 extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma;
130 int gk104_fifo_pbdma_nr(struct gk104_fifo *);
131 void gk104_fifo_pbdma_init(struct gk104_fifo *);
132 extern const struct nvkm_enum gk104_fifo_fault_access[];
133 extern const struct nvkm_enum gk104_fifo_fault_engine[];
134 extern const struct nvkm_enum gk104_fifo_fault_reason[];
135 extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
136 extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
137 extern const struct gk104_fifo_runlist_func gk104_fifo_runlist;
138 void gk104_fifo_runlist_chan(struct gk104_fifo_chan *,
139 struct nvkm_memory *, u32);
140 void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl,
141 struct nvkm_memory *, int);
143 extern const struct gk104_fifo_runlist_func gk110_fifo_runlist;
144 void gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
145 struct nvkm_memory *, u32);
147 extern const struct gk104_fifo_pbdma_func gk208_fifo_pbdma;
148 void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *);
150 void gm107_fifo_intr_fault(struct nvkm_fifo *, int);
151 extern const struct nvkm_enum gm107_fifo_fault_engine[];
152 extern const struct gk104_fifo_runlist_func gm107_fifo_runlist;
154 extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma;
155 int gm200_fifo_pbdma_nr(struct gk104_fifo *);
157 void gp100_fifo_intr_fault(struct nvkm_fifo *, int);
158 extern const struct nvkm_enum gp100_fifo_fault_engine[];
160 extern const struct nvkm_enum gv100_fifo_fault_access[];
161 extern const struct nvkm_enum gv100_fifo_fault_reason[];
162 extern const struct nvkm_enum gv100_fifo_fault_hubclient[];
163 extern const struct nvkm_enum gv100_fifo_fault_gpcclient[];
164 void gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
165 struct nvkm_memory *, u32);
166 void gv100_fifo_runlist_chan(struct gk104_fifo_chan *,
167 struct nvkm_memory *, u32);