Lines Matching refs:iobj
58 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_wr32_slow() local
59 struct nv50_instmem *imem = iobj->imem; in nv50_instobj_wr32_slow()
61 u64 base = (nvkm_memory_addr(iobj->ram) + offset) & 0xffffff00000ULL; in nv50_instobj_wr32_slow()
62 u64 addr = (nvkm_memory_addr(iobj->ram) + offset) & 0x000000fffffULL; in nv50_instobj_wr32_slow()
77 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_rd32_slow() local
78 struct nv50_instmem *imem = iobj->imem; in nv50_instobj_rd32_slow()
80 u64 base = (nvkm_memory_addr(iobj->ram) + offset) & 0xffffff00000ULL; in nv50_instobj_rd32_slow()
81 u64 addr = (nvkm_memory_addr(iobj->ram) + offset) & 0x000000fffffULL; in nv50_instobj_rd32_slow()
120 nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm) in nv50_instobj_kmap() argument
122 struct nv50_instmem *imem = iobj->imem; in nv50_instobj_kmap()
124 struct nvkm_memory *memory = &iobj->base.memory; in nv50_instobj_kmap()
164 if (ret || iobj->bar) { in nv50_instobj_kmap()
173 iobj->bar = bar; in nv50_instobj_kmap()
174 iobj->map = ioremap_wc(device->func->resource_addr(device, 3) + in nv50_instobj_kmap()
175 (u32)iobj->bar->addr, size); in nv50_instobj_kmap()
176 if (!iobj->map) { in nv50_instobj_kmap()
178 nvkm_vmm_put(vmm, &iobj->bar); in nv50_instobj_kmap()
193 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_release() local
194 struct nv50_instmem *imem = iobj->imem; in nv50_instobj_release()
200 if (refcount_dec_and_mutex_lock(&iobj->maps, &subdev->mutex)) { in nv50_instobj_release()
204 if (likely(iobj->lru.next) && iobj->map) { in nv50_instobj_release()
205 BUG_ON(!list_empty(&iobj->lru)); in nv50_instobj_release()
206 list_add_tail(&iobj->lru, &imem->lru); in nv50_instobj_release()
210 iobj->base.memory.ptrs = NULL; in nv50_instobj_release()
218 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_acquire() local
219 struct nvkm_instmem *imem = &iobj->imem->base; in nv50_instobj_acquire()
224 if (refcount_inc_not_zero(&iobj->maps)) in nv50_instobj_acquire()
225 return iobj->map; in nv50_instobj_acquire()
231 if (refcount_inc_not_zero(&iobj->maps)) { in nv50_instobj_acquire()
233 return iobj->map; in nv50_instobj_acquire()
238 if (!iobj->map) in nv50_instobj_acquire()
239 nv50_instobj_kmap(iobj, vmm); in nv50_instobj_acquire()
240 map = iobj->map; in nv50_instobj_acquire()
243 if (!refcount_inc_not_zero(&iobj->maps)) { in nv50_instobj_acquire()
245 if (likely(iobj->lru.next)) in nv50_instobj_acquire()
246 list_del_init(&iobj->lru); in nv50_instobj_acquire()
249 iobj->base.memory.ptrs = &nv50_instobj_fast; in nv50_instobj_acquire()
251 iobj->base.memory.ptrs = &nv50_instobj_slow; in nv50_instobj_acquire()
252 refcount_set(&iobj->maps, 1); in nv50_instobj_acquire()
262 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_boot() local
263 struct nvkm_instmem *imem = &iobj->imem->base; in nv50_instobj_boot()
269 if (likely(iobj->lru.next)) { in nv50_instobj_boot()
270 list_del_init(&iobj->lru); in nv50_instobj_boot()
271 iobj->lru.next = NULL; in nv50_instobj_boot()
274 nv50_instobj_kmap(iobj, vmm); in nv50_instobj_boot()
294 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_bar2() local
296 if (nv50_instobj_acquire(&iobj->base.memory)) { in nv50_instobj_bar2()
297 iobj->lru.next = NULL; /* Exclude from eviction. */ in nv50_instobj_bar2()
298 addr = iobj->bar->addr; in nv50_instobj_bar2()
300 nv50_instobj_release(&iobj->base.memory); in nv50_instobj_bar2()
313 struct nv50_instobj *iobj = nv50_instobj(memory); in nv50_instobj_dtor() local
314 struct nvkm_instmem *imem = &iobj->imem->base; in nv50_instobj_dtor()
319 if (likely(iobj->lru.next)) in nv50_instobj_dtor()
320 list_del(&iobj->lru); in nv50_instobj_dtor()
321 map = iobj->map; in nv50_instobj_dtor()
322 bar = iobj->bar; in nv50_instobj_dtor()
332 nvkm_memory_unref(&iobj->ram); in nv50_instobj_dtor()
333 nvkm_instobj_dtor(imem, &iobj->base); in nv50_instobj_dtor()
334 return iobj; in nv50_instobj_dtor()
355 struct nv50_instobj *iobj; in nv50_instobj_new() local
359 if (!(iobj = kzalloc(sizeof(*iobj), GFP_KERNEL))) in nv50_instobj_new()
361 *pmemory = &iobj->base.memory; in nv50_instobj_new()
363 nvkm_instobj_ctor(&nv50_instobj_func, &imem->base, &iobj->base); in nv50_instobj_new()
364 iobj->imem = imem; in nv50_instobj_new()
365 refcount_set(&iobj->maps, 0); in nv50_instobj_new()
366 INIT_LIST_HEAD(&iobj->lru); in nv50_instobj_new()
368 return nvkm_ram_get(device, 0, 1, page, size, true, true, &iobj->ram); in nv50_instobj_new()