fifo.h 3.17 KB
Newer Older
1
/* SPDX-License-Identifier: MIT */
2 3
#ifndef __NVKM_FIFO_H__
#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_CHID_NR 4096
10
#define NVKM_FIFO_ENGN_NR 16
11 12 13 14 15 16

struct nvkm_fifo_engn {
	struct nvkm_object *object;
	int refcount;
	int usecount;
};
17

18
struct nvkm_fifo_chan {
19 20
	const struct nvkm_fifo_chan_func *func;
	struct nvkm_fifo *fifo;
21
	u32 engm;
22 23 24 25 26 27
	struct nvkm_object object;

	struct list_head head;
	u16 chid;
	struct nvkm_gpuobj *inst;
	struct nvkm_gpuobj *push;
28
	struct nvkm_vmm *vmm;
29
	u64 addr;
30
	u32 size;
31

32
	struct nvkm_fifo_engn engn[NVKM_FIFO_ENGN_NR];
33 34
};

35
struct nvkm_fifo {
36
	const struct nvkm_fifo_func *func;
37
	struct nvkm_engine engine;
38

39 40 41
	DECLARE_BITMAP(mask, NVKM_FIFO_CHID_NR);
	int nr;
	struct list_head chan;
42
	spinlock_t lock;
43
	struct mutex mutex;
44

45
	struct nvkm_event uevent; /* async user trigger */
46
	struct nvkm_event kevent; /* channel killed */
47 48
};

49
void nvkm_fifo_fault(struct nvkm_fifo *, struct nvkm_fault_data *);
50 51
void nvkm_fifo_pause(struct nvkm_fifo *, unsigned long *);
void nvkm_fifo_start(struct nvkm_fifo *, unsigned long *);
52

53 54 55 56 57 58 59
void nvkm_fifo_chan_put(struct nvkm_fifo *, unsigned long flags,
			struct nvkm_fifo_chan **);
struct nvkm_fifo_chan *
nvkm_fifo_chan_inst(struct nvkm_fifo *, u64 inst, unsigned long *flags);
struct nvkm_fifo_chan *
nvkm_fifo_chan_chid(struct nvkm_fifo *, int chid, unsigned long *flags);

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
int nv04_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int nv10_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int nv17_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int nv40_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int nv50_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int g84_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gf100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gk104_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gk110_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gk208_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gk20a_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gm107_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gm200_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gm20b_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gp100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gp10b_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int gv100_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
int tu102_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
78
int ga102_fifo_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fifo **);
79
#endif