Linux Audio

Check our new training course

Embedded Linux training

Mar 10-20, 2025, special US time zones
Register
Loading...
Note: File does not exist in v6.8.
  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)
  5#include "priv.h"
  6struct nvkm_fifo_cgrp;
  7
  8#include <core/enum.h>
  9#include <subdev/mmu.h>
 10
 11struct gk104_fifo_chan;
 12struct gk104_fifo {
 13	const struct gk104_fifo_func *func;
 14	struct nvkm_fifo base;
 15
 16	struct {
 17		struct work_struct work;
 18		u32 engm;
 19		u32 runm;
 20	} recover;
 21
 22	int pbdma_nr;
 23
 24	struct {
 25		struct nvkm_engine *engine;
 26		int runl;
 27		int pbid;
 28	} engine[16];
 29	int engine_nr;
 30
 31	struct {
 32		struct nvkm_memory *mem[2];
 33		int next;
 34		wait_queue_head_t wait;
 35		struct list_head cgrp;
 36		struct list_head chan;
 37		u32 engm;
 38		u32 engm_sw;
 39	} runlist[16];
 40	int runlist_nr;
 41
 42	struct {
 43		struct nvkm_memory *mem;
 44		struct nvkm_vma *bar;
 45	} user;
 46};
 47
 48struct gk104_fifo_func {
 49	struct {
 50		void (*fault)(struct nvkm_fifo *, int unit);
 51	} intr;
 52
 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 *);
 57	} *pbdma;
 58
 59	struct {
 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;
 65	} fault;
 66
 67	const struct gk104_fifo_runlist_func {
 68		u8 size;
 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);
 75	} *runlist;
 76
 77	struct gk104_fifo_user_user {
 78		struct nvkm_sclass user;
 79		int (*ctor)(const struct nvkm_oclass *, void *, u32,
 80			    struct nvkm_object **);
 81	} user;
 82
 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 **);
 87	} chan;
 88	bool cgrp_force;
 89};
 90
 91struct gk104_fifo_engine_status {
 92	bool busy;
 93	bool faulted;
 94	bool chsw;
 95	bool save;
 96	bool load;
 97	struct {
 98		bool tsg;
 99		u32 id;
100	} prev, next, *chan;
101};
102
103int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *, enum nvkm_subdev_type,
104		    int index, int nr, struct nvkm_fifo **);
105void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
106void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
107void gk104_fifo_runlist_update(struct gk104_fifo *, int runl);
108void gk104_fifo_engine_status(struct gk104_fifo *fifo, int engn,
109			      struct gk104_fifo_engine_status *status);
110void gk104_fifo_intr_bind(struct gk104_fifo *fifo);
111void gk104_fifo_intr_chsw(struct gk104_fifo *fifo);
112void gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo);
113void gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit);
114void gk104_fifo_intr_pbdma_1(struct gk104_fifo *fifo, int unit);
115void gk104_fifo_intr_runlist(struct gk104_fifo *fifo);
116void gk104_fifo_intr_engine(struct gk104_fifo *fifo);
117void *gk104_fifo_dtor(struct nvkm_fifo *base);
118int gk104_fifo_oneinit(struct nvkm_fifo *base);
119int gk104_fifo_info(struct nvkm_fifo *base, u64 mthd, u64 *data);
120void gk104_fifo_init(struct nvkm_fifo *base);
121void gk104_fifo_fini(struct nvkm_fifo *base);
122int gk104_fifo_class_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
123			 void *argv, u32 argc, struct nvkm_object **pobject);
124int gk104_fifo_class_get(struct nvkm_fifo *base, int index,
125			 struct nvkm_oclass *oclass);
126void gk104_fifo_uevent_fini(struct nvkm_fifo *fifo);
127void gk104_fifo_uevent_init(struct nvkm_fifo *fifo);
128
129extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma;
130int gk104_fifo_pbdma_nr(struct gk104_fifo *);
131void gk104_fifo_pbdma_init(struct gk104_fifo *);
132extern const struct nvkm_enum gk104_fifo_fault_access[];
133extern const struct nvkm_enum gk104_fifo_fault_engine[];
134extern const struct nvkm_enum gk104_fifo_fault_reason[];
135extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
136extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
137extern const struct gk104_fifo_runlist_func gk104_fifo_runlist;
138void gk104_fifo_runlist_chan(struct gk104_fifo_chan *,
139			     struct nvkm_memory *, u32);
140void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl,
141			       struct nvkm_memory *, int);
142
143extern const struct gk104_fifo_runlist_func gk110_fifo_runlist;
144void gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
145			     struct nvkm_memory *, u32);
146
147extern const struct gk104_fifo_pbdma_func gk208_fifo_pbdma;
148void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *);
149
150void gm107_fifo_intr_fault(struct nvkm_fifo *, int);
151extern const struct nvkm_enum gm107_fifo_fault_engine[];
152extern const struct gk104_fifo_runlist_func gm107_fifo_runlist;
153
154extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma;
155int gm200_fifo_pbdma_nr(struct gk104_fifo *);
156
157void gp100_fifo_intr_fault(struct nvkm_fifo *, int);
158extern const struct nvkm_enum gp100_fifo_fault_engine[];
159
160extern const struct nvkm_enum gv100_fifo_fault_access[];
161extern const struct nvkm_enum gv100_fifo_fault_reason[];
162extern const struct nvkm_enum gv100_fifo_fault_hubclient[];
163extern const struct nvkm_enum gv100_fifo_fault_gpcclient[];
164void gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
165			     struct nvkm_memory *, u32);
166void gv100_fifo_runlist_chan(struct gk104_fifo_chan *,
167			     struct nvkm_memory *, u32);
168#endif