These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / include / nvkm / core / gpuobj.h
1 #ifndef __NVKM_GPUOBJ_H__
2 #define __NVKM_GPUOBJ_H__
3 #include <core/object.h>
4 #include <core/memory.h>
5 #include <core/mm.h>
6 struct nvkm_vma;
7 struct nvkm_vm;
8
9 #define NVOBJ_FLAG_ZERO_ALLOC 0x00000001
10 #define NVOBJ_FLAG_HEAP       0x00000004
11
12 struct nvkm_gpuobj {
13         struct nvkm_object object;
14         const struct nvkm_gpuobj_func *func;
15         struct nvkm_gpuobj *parent;
16         struct nvkm_memory *memory;
17         struct nvkm_mm_node *node;
18
19         u64 addr;
20         u32 size;
21         struct nvkm_mm heap;
22
23         void __iomem *map;
24 };
25
26 struct nvkm_gpuobj_func {
27         void *(*acquire)(struct nvkm_gpuobj *);
28         void (*release)(struct nvkm_gpuobj *);
29         u32 (*rd32)(struct nvkm_gpuobj *, u32 offset);
30         void (*wr32)(struct nvkm_gpuobj *, u32 offset, u32 data);
31 };
32
33 int nvkm_gpuobj_new(struct nvkm_device *, u32 size, int align, bool zero,
34                     struct nvkm_gpuobj *parent, struct nvkm_gpuobj **);
35 void nvkm_gpuobj_del(struct nvkm_gpuobj **);
36 int nvkm_gpuobj_wrap(struct nvkm_memory *, struct nvkm_gpuobj **);
37 int nvkm_gpuobj_map(struct nvkm_gpuobj *, struct nvkm_vm *, u32 access,
38                     struct nvkm_vma *);
39 void nvkm_gpuobj_unmap(struct nvkm_vma *);
40 #endif