xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fault/priv.h (revision 95298d63c67673c654c08952672d016212b26054)
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 
21 int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *,
22 		    int index, struct nvkm_fault **);
23 
24 struct nvkm_fault_func {
25 	int (*oneinit)(struct nvkm_fault *);
26 	void (*init)(struct nvkm_fault *);
27 	void (*fini)(struct nvkm_fault *);
28 	void (*intr)(struct nvkm_fault *);
29 	struct {
30 		int nr;
31 		u32 entry_size;
32 		void (*info)(struct nvkm_fault_buffer *);
33 		u64 (*pin)(struct nvkm_fault_buffer *);
34 		void (*init)(struct nvkm_fault_buffer *);
35 		void (*fini)(struct nvkm_fault_buffer *);
36 		void (*intr)(struct nvkm_fault_buffer *, bool enable);
37 	} buffer;
38 	struct {
39 		struct nvkm_sclass base;
40 		int rp;
41 	} user;
42 };
43 
44 void gp100_fault_buffer_intr(struct nvkm_fault_buffer *, bool enable);
45 void gp100_fault_buffer_fini(struct nvkm_fault_buffer *);
46 void gp100_fault_buffer_init(struct nvkm_fault_buffer *);
47 u64 gp100_fault_buffer_pin(struct nvkm_fault_buffer *);
48 void gp100_fault_buffer_info(struct nvkm_fault_buffer *);
49 void gp100_fault_intr(struct nvkm_fault *);
50 
51 u64 gp10b_fault_buffer_pin(struct nvkm_fault_buffer *);
52 
53 int gv100_fault_oneinit(struct nvkm_fault *);
54 
55 int nvkm_ufault_new(struct nvkm_device *, const struct nvkm_oclass *,
56 		    void *, u32, struct nvkm_object **);
57 #endif
58