Lines Matching full:mmu

22 #include <nvif/mmu.h>
28 nvif_mmu_dtor(struct nvif_mmu *mmu) in nvif_mmu_dtor() argument
30 kfree(mmu->kind); in nvif_mmu_dtor()
31 kfree(mmu->type); in nvif_mmu_dtor()
32 kfree(mmu->heap); in nvif_mmu_dtor()
33 nvif_object_dtor(&mmu->object); in nvif_mmu_dtor()
38 struct nvif_mmu *mmu) in nvif_mmu_ctor() argument
50 mmu->heap = NULL; in nvif_mmu_ctor()
51 mmu->type = NULL; in nvif_mmu_ctor()
52 mmu->kind = NULL; in nvif_mmu_ctor()
55 &args, sizeof(args), &mmu->object); in nvif_mmu_ctor()
59 mmu->dmabits = args.dmabits; in nvif_mmu_ctor()
60 mmu->heap_nr = args.heap_nr; in nvif_mmu_ctor()
61 mmu->type_nr = args.type_nr; in nvif_mmu_ctor()
62 mmu->kind_nr = args.kind_nr; in nvif_mmu_ctor()
64 ret = nvif_mclass(&mmu->object, mems); in nvif_mmu_ctor()
67 mmu->mem = mems[ret].oclass; in nvif_mmu_ctor()
69 mmu->heap = kmalloc_array(mmu->heap_nr, sizeof(*mmu->heap), in nvif_mmu_ctor()
71 mmu->type = kmalloc_array(mmu->type_nr, sizeof(*mmu->type), in nvif_mmu_ctor()
73 if (ret = -ENOMEM, !mmu->heap || !mmu->type) in nvif_mmu_ctor()
76 mmu->kind = kmalloc_array(mmu->kind_nr, sizeof(*mmu->kind), in nvif_mmu_ctor()
78 if (!mmu->kind && mmu->kind_nr) in nvif_mmu_ctor()
81 for (i = 0; i < mmu->heap_nr; i++) { in nvif_mmu_ctor()
84 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_HEAP, in nvif_mmu_ctor()
89 mmu->heap[i].size = args.size; in nvif_mmu_ctor()
92 for (i = 0; i < mmu->type_nr; i++) { in nvif_mmu_ctor()
95 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_TYPE, in nvif_mmu_ctor()
100 mmu->type[i].type = 0; in nvif_mmu_ctor()
101 if (args.vram) mmu->type[i].type |= NVIF_MEM_VRAM; in nvif_mmu_ctor()
102 if (args.host) mmu->type[i].type |= NVIF_MEM_HOST; in nvif_mmu_ctor()
103 if (args.comp) mmu->type[i].type |= NVIF_MEM_COMP; in nvif_mmu_ctor()
104 if (args.disp) mmu->type[i].type |= NVIF_MEM_DISP; in nvif_mmu_ctor()
105 if (args.kind ) mmu->type[i].type |= NVIF_MEM_KIND; in nvif_mmu_ctor()
106 if (args.mappable) mmu->type[i].type |= NVIF_MEM_MAPPABLE; in nvif_mmu_ctor()
107 if (args.coherent) mmu->type[i].type |= NVIF_MEM_COHERENT; in nvif_mmu_ctor()
108 if (args.uncached) mmu->type[i].type |= NVIF_MEM_UNCACHED; in nvif_mmu_ctor()
109 mmu->type[i].heap = args.heap; in nvif_mmu_ctor()
112 if (mmu->kind_nr) { in nvif_mmu_ctor()
114 size_t argc = struct_size(kind, data, mmu->kind_nr); in nvif_mmu_ctor()
119 kind->count = mmu->kind_nr; in nvif_mmu_ctor()
121 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_KIND, in nvif_mmu_ctor()
124 memcpy(mmu->kind, kind->data, kind->count); in nvif_mmu_ctor()
125 mmu->kind_inv = kind->kind_inv; in nvif_mmu_ctor()
131 nvif_mmu_dtor(mmu); in nvif_mmu_ctor()