Loading...
1#ifndef __NVIF_VMM_H__
2#define __NVIF_VMM_H__
3#include <nvif/object.h>
4struct nvif_mem;
5struct nvif_mmu;
6
7enum nvif_vmm_type {
8 UNMANAGED,
9 MANAGED,
10 RAW,
11};
12
13enum nvif_vmm_get {
14 ADDR,
15 PTES,
16 LAZY
17};
18
19struct nvif_vma {
20 u64 addr;
21 u64 size;
22};
23
24struct nvif_vmm {
25 struct nvif_object object;
26 u64 start;
27 u64 limit;
28
29 struct {
30 u8 shift;
31 bool sparse:1;
32 bool vram:1;
33 bool host:1;
34 bool comp:1;
35 } *page;
36 int page_nr;
37};
38
39int nvif_vmm_ctor(struct nvif_mmu *, const char *name, s32 oclass,
40 enum nvif_vmm_type, u64 addr, u64 size, void *argv, u32 argc,
41 struct nvif_vmm *);
42void nvif_vmm_dtor(struct nvif_vmm *);
43int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse,
44 u8 page, u8 align, u64 size, struct nvif_vma *);
45void nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *);
46int nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc,
47 struct nvif_mem *, u64 offset);
48int nvif_vmm_unmap(struct nvif_vmm *, u64);
49
50int nvif_vmm_raw_get(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift);
51int nvif_vmm_raw_put(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift);
52int nvif_vmm_raw_map(struct nvif_vmm *vmm, u64 addr, u64 size, u8 shift,
53 void *argv, u32 argc, struct nvif_mem *mem, u64 offset);
54int nvif_vmm_raw_unmap(struct nvif_vmm *vmm, u64 addr, u64 size,
55 u8 shift, bool sparse);
56int nvif_vmm_raw_sparse(struct nvif_vmm *vmm, u64 addr, u64 size, bool ref);
57#endif
1#ifndef __NVIF_VMM_H__
2#define __NVIF_VMM_H__
3#include <nvif/object.h>
4struct nvif_mem;
5struct nvif_mmu;
6
7enum nvif_vmm_get {
8 ADDR,
9 PTES,
10 LAZY
11};
12
13struct nvif_vma {
14 u64 addr;
15 u64 size;
16};
17
18struct nvif_vmm {
19 struct nvif_object object;
20 u64 start;
21 u64 limit;
22
23 struct {
24 u8 shift;
25 bool sparse:1;
26 bool vram:1;
27 bool host:1;
28 bool comp:1;
29 } *page;
30 int page_nr;
31};
32
33int nvif_vmm_init(struct nvif_mmu *, s32 oclass, bool managed, u64 addr,
34 u64 size, void *argv, u32 argc, struct nvif_vmm *);
35void nvif_vmm_fini(struct nvif_vmm *);
36int nvif_vmm_get(struct nvif_vmm *, enum nvif_vmm_get, bool sparse,
37 u8 page, u8 align, u64 size, struct nvif_vma *);
38void nvif_vmm_put(struct nvif_vmm *, struct nvif_vma *);
39int nvif_vmm_map(struct nvif_vmm *, u64 addr, u64 size, void *argv, u32 argc,
40 struct nvif_mem *, u64 offset);
41int nvif_vmm_unmap(struct nvif_vmm *, u64);
42#endif