summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
blob: 1b0a3027f297c0b7494184757a948fdf6fa77827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/* SPDX-License-Identifier: MIT */
#ifndef __NVKM_FIFO_PRIV_H__
#define __NVKM_FIFO_PRIV_H__
#define nvkm_fifo(p) container_of((p), struct nvkm_fifo, engine)
#include <engine/fifo.h>
struct nvkm_cgrp;
struct nvkm_memory;
struct gk104_fifo;
struct gk104_fifo_chan;

void nvkm_fifo_uevent(struct nvkm_fifo *);
void nvkm_fifo_kevent(struct nvkm_fifo *, int chid);
void nvkm_fifo_recover_chan(struct nvkm_fifo *, int chid);

struct nvkm_fifo_chan *
nvkm_fifo_chan_inst_locked(struct nvkm_fifo *, u64 inst);

struct nvkm_fifo_chan_oclass;
struct nvkm_fifo_func {
	void *(*dtor)(struct nvkm_fifo *);

	int (*oneinit)(struct nvkm_fifo *);
	int (*chid_nr)(struct nvkm_fifo *);
	int (*chid_ctor)(struct nvkm_fifo *, int nr);
	int (*runq_nr)(struct nvkm_fifo *);
	int (*runl_ctor)(struct nvkm_fifo *);

	void (*init)(struct nvkm_fifo *);
	void (*fini)(struct nvkm_fifo *);

	void (*intr)(struct nvkm_fifo *);
	void (*intr_mmu_fault_unit)(struct nvkm_fifo *, int unit);

	const struct nvkm_fifo_func_mmu_fault {
		void (*recover)(struct nvkm_fifo *, struct nvkm_fault_data *);
	} *mmu_fault;

	struct {
		const struct nvkm_enum *access;
		const struct nvkm_enum *engine;
		const struct nvkm_enum *reason;
		const struct nvkm_enum *hubclient;
		const struct nvkm_enum *gpcclient;
	} fault;

	int (*engine_id)(struct nvkm_fifo *, struct nvkm_engine *);
	void (*pause)(struct nvkm_fifo *, unsigned long *);
	void (*start)(struct nvkm_fifo *, unsigned long *);
	void (*uevent_init)(struct nvkm_fifo *);
	void (*uevent_fini)(struct nvkm_fifo *);
	void (*recover_chan)(struct nvkm_fifo *, int chid);

	const struct gk104_fifo_runlist_func {
		u8 size;
		void (*cgrp)(struct nvkm_fifo_cgrp *,
			     struct nvkm_memory *, u32 offset);
		void (*chan)(struct gk104_fifo_chan *,
			     struct nvkm_memory *, u32 offset);
		void (*commit)(struct gk104_fifo *, int runl,
			       struct nvkm_memory *, int entries);
	} *runlist;

	const struct gk104_fifo_pbdma_func {
		void (*init)(struct gk104_fifo *);
		void (*init_timeout)(struct gk104_fifo *);
	} *pbdma;

	const struct nvkm_runl_func *runl;
	const struct nvkm_runq_func *runq;
	const struct nvkm_engn_func *engn;
	const struct nvkm_engn_func *engn_sw;
	const struct nvkm_engn_func *engn_ce;

	struct nvkm_fifo_func_cgrp {
		struct nvkm_sclass user;
		const struct nvkm_cgrp_func *func;
		bool force;
	} cgrp;

	struct nvkm_fifo_func_chan {
		struct nvkm_sclass user;
		const struct nvkm_chan_func *func;
		const struct nvkm_fifo_chan_oclass {
			int (*ctor)(struct nvkm_fifo *, const struct nvkm_oclass *,
			void *data, u32 size, struct nvkm_object **);
		} *oclass;
		int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *, void *, u32,
			    struct nvkm_object **);
	} chan;
};

int nvkm_fifo_ctor(const struct nvkm_fifo_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
		   struct nvkm_fifo *);

int nv04_fifo_chid_ctor(struct nvkm_fifo *, int);
int nv04_fifo_runl_ctor(struct nvkm_fifo *);
void nv04_fifo_init(struct nvkm_fifo *);
void nv04_fifo_intr(struct nvkm_fifo *);
int nv04_fifo_engine_id(struct nvkm_fifo *, struct nvkm_engine *);
void nv04_fifo_pause(struct nvkm_fifo *, unsigned long *);
void nv04_fifo_start(struct nvkm_fifo *, unsigned long *);
extern const struct nvkm_runl_func nv04_runl;
extern const struct nvkm_engn_func nv04_engn;
extern const struct nvkm_cgrp_func nv04_cgrp;

int nv10_fifo_chid_nr(struct nvkm_fifo *);

int nv50_fifo_chid_nr(struct nvkm_fifo *);
int nv50_fifo_chid_ctor(struct nvkm_fifo *, int);
extern const struct nvkm_runl_func nv50_runl;
extern const struct nvkm_engn_func nv50_engn_sw;

extern const struct nvkm_engn_func g84_engn;
extern const struct nvkm_chan_func g84_chan;

int gf100_fifo_chid_ctor(struct nvkm_fifo *, int);
int gf100_fifo_runq_nr(struct nvkm_fifo *);
void gf100_fifo_intr_mmu_fault_unit(struct nvkm_fifo *, int);
extern const struct nvkm_engn_func gf100_engn_sw;

int gk104_fifo_chid_nr(struct nvkm_fifo *);
int gk104_fifo_runl_ctor(struct nvkm_fifo *);
void gk104_fifo_intr(struct nvkm_fifo *);
extern const struct nvkm_fifo_func_mmu_fault gk104_fifo_mmu_fault;
void gk104_fifo_fault(struct nvkm_fifo *, struct nvkm_fault_data *);
void gk104_fifo_recover_chan(struct nvkm_fifo *, int);
int gk104_fifo_engine_id(struct nvkm_fifo *, struct nvkm_engine *);
extern const struct nvkm_runq_func gk104_runq;
extern const struct nvkm_engn_func gk104_engn;
extern const struct nvkm_engn_func gk104_engn_ce;

int gk110_fifo_chid_ctor(struct nvkm_fifo *, int);
extern const struct nvkm_runl_func gk110_runl;
extern const struct nvkm_cgrp_func gk110_cgrp;
extern const struct nvkm_chan_func gk110_chan;

extern const struct nvkm_runq_func gk208_runq;

void gm107_fifo_intr_mmu_fault_unit(struct nvkm_fifo *, int);
extern const struct nvkm_fifo_func_mmu_fault gm107_fifo_mmu_fault;
extern const struct nvkm_runl_func gm107_runl;
extern const struct nvkm_chan_func gm107_chan;

int gm200_fifo_chid_nr(struct nvkm_fifo *);
int gm200_fifo_runq_nr(struct nvkm_fifo *);

void gp100_fifo_intr_mmu_fault_unit(struct nvkm_fifo *, int);

extern const struct nvkm_runq_func gv100_runq;
extern const struct nvkm_engn_func gv100_engn;
extern const struct nvkm_engn_func gv100_engn_ce;

extern const struct nvkm_fifo_func_mmu_fault tu102_fifo_mmu_fault;

int nvkm_uchan_new(struct nvkm_fifo *, struct nvkm_cgrp *, const struct nvkm_oclass *,
		   void *argv, u32 argc, struct nvkm_object **);
#endif