• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __GK104_FIFO_H__
2 #define __GK104_FIFO_H__
3 #define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
4 #include "priv.h"
5 
6 #include <subdev/mmu.h>
7 
8 struct gk104_fifo_engn {
9 	struct nvkm_memory *runlist[2];
10 	int cur_runlist;
11 	wait_queue_head_t wait;
12 	struct list_head chan;
13 };
14 
15 struct gk104_fifo {
16 	struct nvkm_fifo base;
17 
18 	struct work_struct fault;
19 	u64 mask;
20 
21 	struct gk104_fifo_engn engine[7];
22 	struct {
23 		struct nvkm_memory *mem;
24 		struct nvkm_vma bar;
25 	} user;
26 	int spoon_nr;
27 };
28 
29 int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *,
30 		    int index, int nr, struct nvkm_fifo **);
31 void *gk104_fifo_dtor(struct nvkm_fifo *);
32 int gk104_fifo_oneinit(struct nvkm_fifo *);
33 void gk104_fifo_init(struct nvkm_fifo *);
34 void gk104_fifo_fini(struct nvkm_fifo *);
35 void gk104_fifo_intr(struct nvkm_fifo *);
36 void gk104_fifo_uevent_init(struct nvkm_fifo *);
37 void gk104_fifo_uevent_fini(struct nvkm_fifo *);
38 void gk104_fifo_runlist_update(struct gk104_fifo *, u32 engine);
39 
40 static inline u64
gk104_fifo_engine_subdev(int engine)41 gk104_fifo_engine_subdev(int engine)
42 {
43 	switch (engine) {
44 	case 0: return (1ULL << NVKM_ENGINE_GR) |
45 		       (1ULL << NVKM_ENGINE_SW) |
46 		       (1ULL << NVKM_ENGINE_CE2);
47 	case 1: return (1ULL << NVKM_ENGINE_MSPDEC);
48 	case 2: return (1ULL << NVKM_ENGINE_MSPPP);
49 	case 3: return (1ULL << NVKM_ENGINE_MSVLD);
50 	case 4: return (1ULL << NVKM_ENGINE_CE0);
51 	case 5: return (1ULL << NVKM_ENGINE_CE1);
52 	case 6: return (1ULL << NVKM_ENGINE_MSENC);
53 	default:
54 		WARN_ON(1);
55 		return 0;
56 	}
57 }
58 
59 static inline int
gk104_fifo_subdev_engine(int subdev)60 gk104_fifo_subdev_engine(int subdev)
61 {
62 	switch (subdev) {
63 	case NVKM_ENGINE_GR:
64 	case NVKM_ENGINE_SW:
65 	case NVKM_ENGINE_CE2   : return 0;
66 	case NVKM_ENGINE_MSPDEC: return 1;
67 	case NVKM_ENGINE_MSPPP : return 2;
68 	case NVKM_ENGINE_MSVLD : return 3;
69 	case NVKM_ENGINE_CE0   : return 4;
70 	case NVKM_ENGINE_CE1   : return 5;
71 	case NVKM_ENGINE_MSENC : return 6;
72 	default:
73 		WARN_ON(1);
74 		return 0;
75 	}
76 }
77 #endif
78