1 /* SPDX-License-Identifier: MIT */ 2 #ifndef __NVKM_FIFO_H__ 3 #define __NVKM_FIFO_H__ 4 #include <core/engine.h> 5 #include <core/object.h> 6 #include <core/event.h> 7 struct nvkm_fault_data; 8 9 #define NVKM_FIFO_ENGN_NR 16 10 11 struct nvkm_chan { 12 const struct nvkm_chan_func *func; 13 char name[64]; 14 struct nvkm_cgrp *cgrp; 15 int runq; 16 17 struct nvkm_gpuobj *inst; 18 struct nvkm_vmm *vmm; 19 struct nvkm_gpuobj *push; 20 int id; 21 22 struct { 23 struct nvkm_memory *mem; 24 u32 base; 25 } userd; 26 27 u32 ramfc_offset; 28 struct nvkm_gpuobj *ramfc; 29 struct nvkm_gpuobj *cache; 30 struct nvkm_gpuobj *eng; 31 struct nvkm_gpuobj *pgd; 32 struct nvkm_ramht *ramht; 33 34 spinlock_t lock; 35 atomic_t blocked; 36 atomic_t errored; 37 38 struct list_head cctxs; 39 struct list_head head; 40 }; 41 42 struct nvkm_chan *nvkm_chan_get_chid(struct nvkm_engine *, int id, unsigned long *irqflags); 43 struct nvkm_chan *nvkm_chan_get_inst(struct nvkm_engine *, u64 inst, unsigned long *irqflags); 44 void nvkm_chan_put(struct nvkm_chan **, unsigned long irqflags); 45 46 struct nvkm_fifo { 47 const struct nvkm_fifo_func *func; 48 struct nvkm_engine engine; 49 50 struct nvkm_chid *chid; 51 struct nvkm_chid *cgid; 52 53 struct list_head runqs; 54 struct list_head runls; 55 56 struct { 57 #define NVKM_FIFO_NONSTALL_EVENT BIT(0) 58 struct nvkm_event event; 59 struct nvkm_inth intr; 60 } nonstall; 61 62 struct { 63 u32 chan_msec; 64 } timeout; 65 66 struct { 67 struct nvkm_memory *mem; 68 struct nvkm_vma *bar1; 69 } userd; 70 71 spinlock_t lock; 72 struct mutex mutex; 73 }; 74 75 void nvkm_fifo_fault(struct nvkm_fifo *, struct nvkm_fault_data *); 76 void nvkm_fifo_pause(struct nvkm_fifo *, unsigned long *); 77 void nvkm_fifo_start(struct nvkm_fifo *, unsigned long *); 78 bool nvkm_fifo_ctxsw_in_progress(struct nvkm_engine *); 79 80 int nv04_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 81 int nv10_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 82 int nv17_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 83 int nv40_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 84 int nv50_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 85 int g84_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 86 int g98_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 87 int gf100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 88 int gk104_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 89 int gk110_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 90 int gk208_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 91 int gk20a_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 92 int gm107_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 93 int gm200_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 94 int gp100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 95 int gv100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 96 int tu102_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 97 int ga100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 98 int ga102_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **); 99 #endif 100