xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fault/priv.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 #ifndef __NVKM_FAULT_PRIV_H__
2 #define __NVKM_FAULT_PRIV_H__
3 #define nvkm_fault_buffer(p) container_of((p), struct nvkm_fault_buffer, object)
4 #define nvkm_fault(p) container_of((p), struct nvkm_fault, subdev)
5 #include <subdev/fault.h>
6 
7 #include <core/event.h>
8 #include <core/object.h>
9 
10 struct nvkm_fault_buffer {
11 	struct nvkm_object object;
12 	struct nvkm_fault *fault;
13 	int id;
14 	int entries;
15 	u32 get;
16 	u32 put;
17 	struct nvkm_memory *mem;
18 	u64 addr;
19 
20 	struct nvkm_inth inth;
21 };
22 
23 int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *, enum nvkm_subdev_type,
24 		    int inst, struct nvkm_fault **);
25 
26 struct nvkm_fault_func {
27 	int (*oneinit)(struct nvkm_fault *);
28 	void (*init)(struct nvkm_fault *);
29 	void (*fini)(struct nvkm_fault *);
30 	void (*intr)(struct nvkm_fault *);
31 	struct {
32 		int nr;
33 		u32 entry_size;
34 		void (*info)(struct nvkm_fault_buffer *);
35 		u64 (*pin)(struct nvkm_fault_buffer *);
36 		void (*init)(struct nvkm_fault_buffer *);
37 		void (*fini)(struct nvkm_fault_buffer *);
38 		void (*intr)(struct nvkm_fault_buffer *, bool enable);
39 	} buffer;
40 	struct {
41 		struct nvkm_sclass base;
42 		int rp;
43 	} user;
44 };
45 
46 void gp100_fault_buffer_intr(struct nvkm_fault_buffer *, bool enable);
47 void gp100_fault_buffer_fini(struct nvkm_fault_buffer *);
48 void gp100_fault_buffer_init(struct nvkm_fault_buffer *);
49 u64 gp100_fault_buffer_pin(struct nvkm_fault_buffer *);
50 void gp100_fault_buffer_info(struct nvkm_fault_buffer *);
51 void gv100_fault_buffer_process(struct work_struct *);
52 void gp100_fault_intr(struct nvkm_fault *);
53 
54 u64 gp10b_fault_buffer_pin(struct nvkm_fault_buffer *);
55 
56 int gv100_fault_oneinit(struct nvkm_fault *);
57 
58 int nvkm_ufault_new(struct nvkm_device *, const struct nvkm_oclass *,
59 		    void *, u32, struct nvkm_object **);
60 #endif
61