Lines Matching refs:umem
40 struct nvkm_umem *umem; in nvkm_umem_search() local
46 list_for_each_entry(umem, &master->umem, head) { in nvkm_umem_search()
47 if (umem->object.object == handle) { in nvkm_umem_search()
48 memory = nvkm_memory_ref(umem->memory); in nvkm_umem_search()
55 umem = nvkm_umem(object); in nvkm_umem_search()
56 memory = nvkm_memory_ref(umem->memory); in nvkm_umem_search()
65 struct nvkm_umem *umem = nvkm_umem(object); in nvkm_umem_unmap() local
67 if (!umem->map) in nvkm_umem_unmap()
70 if (umem->io) { in nvkm_umem_unmap()
71 if (!IS_ERR(umem->bar)) { in nvkm_umem_unmap()
72 struct nvkm_device *device = umem->mmu->subdev.device; in nvkm_umem_unmap()
73 nvkm_vmm_put(nvkm_bar_bar1_vmm(device), &umem->bar); in nvkm_umem_unmap()
75 umem->bar = NULL; in nvkm_umem_unmap()
78 vunmap(umem->map); in nvkm_umem_unmap()
79 umem->map = NULL; in nvkm_umem_unmap()
89 struct nvkm_umem *umem = nvkm_umem(object); in nvkm_umem_map() local
90 struct nvkm_mmu *mmu = umem->mmu; in nvkm_umem_map()
92 if (!umem->mappable) in nvkm_umem_map()
94 if (umem->map) in nvkm_umem_map()
97 if ((umem->type & NVKM_MEM_HOST) && !argc) { in nvkm_umem_map()
98 int ret = nvkm_mem_map_host(umem->memory, &umem->map); in nvkm_umem_map()
102 *handle = (unsigned long)(void *)umem->map; in nvkm_umem_map()
103 *length = nvkm_memory_size(umem->memory); in nvkm_umem_map()
107 if ((umem->type & NVKM_MEM_VRAM) || in nvkm_umem_map()
108 (umem->type & NVKM_MEM_KIND)) { in nvkm_umem_map()
109 int ret = mmu->func->mem.umap(mmu, umem->memory, argv, argc, in nvkm_umem_map()
110 handle, length, &umem->bar); in nvkm_umem_map()
119 umem->io = (*type == NVKM_OBJECT_MAP_IO); in nvkm_umem_map()
126 struct nvkm_umem *umem = nvkm_umem(object); in nvkm_umem_dtor() local
127 spin_lock(&umem->object.client->lock); in nvkm_umem_dtor()
128 list_del_init(&umem->head); in nvkm_umem_dtor()
129 spin_unlock(&umem->object.client->lock); in nvkm_umem_dtor()
130 nvkm_memory_unref(&umem->memory); in nvkm_umem_dtor()
131 return umem; in nvkm_umem_dtor()
149 struct nvkm_umem *umem; in nvkm_umem_new() local
164 if (!(umem = kzalloc(sizeof(*umem), GFP_KERNEL))) in nvkm_umem_new()
166 nvkm_object_ctor(&nvkm_umem, oclass, &umem->object); in nvkm_umem_new()
167 umem->mmu = mmu; in nvkm_umem_new()
168 umem->type = mmu->type[type].type; in nvkm_umem_new()
169 INIT_LIST_HEAD(&umem->head); in nvkm_umem_new()
170 *pobject = &umem->object; in nvkm_umem_new()
174 umem->mappable = true; in nvkm_umem_new()
178 &umem->memory); in nvkm_umem_new()
182 spin_lock(&umem->object.client->lock); in nvkm_umem_new()
183 list_add(&umem->head, &umem->object.client->umem); in nvkm_umem_new()
184 spin_unlock(&umem->object.client->lock); in nvkm_umem_new()
186 args->v0.page = nvkm_memory_page(umem->memory); in nvkm_umem_new()
187 args->v0.addr = nvkm_memory_addr(umem->memory); in nvkm_umem_new()
188 args->v0.size = nvkm_memory_size(umem->memory); in nvkm_umem_new()