Lines Matching refs:chan
44 nouveau_channel_kill(struct nouveau_channel *chan) in nouveau_channel_kill() argument
46 atomic_set(&chan->killed, 1); in nouveau_channel_kill()
47 if (chan->fence) in nouveau_channel_kill()
48 nouveau_fence_context_kill(chan->fence, -ENODEV); in nouveau_channel_kill()
54 struct nouveau_channel *chan = container_of(event, typeof(*chan), kill); in nouveau_channel_killed() local
55 struct nouveau_cli *cli = (void *)chan->user.client; in nouveau_channel_killed()
57 NV_PRINTK(warn, cli, "channel %d killed!\n", chan->chid); in nouveau_channel_killed()
59 if (unlikely(!atomic_read(&chan->killed))) in nouveau_channel_killed()
60 nouveau_channel_kill(chan); in nouveau_channel_killed()
66 nouveau_channel_idle(struct nouveau_channel *chan) in nouveau_channel_idle() argument
68 if (likely(chan && chan->fence && !atomic_read(&chan->killed))) { in nouveau_channel_idle()
69 struct nouveau_cli *cli = (void *)chan->user.client; in nouveau_channel_idle()
73 ret = nouveau_fence_new(&fence, chan); in nouveau_channel_idle()
81 chan->chid, nvxx_client(&cli->base)->name); in nouveau_channel_idle()
91 struct nouveau_channel *chan = *pchan; in nouveau_channel_del() local
92 if (chan) { in nouveau_channel_del()
93 struct nouveau_cli *cli = (void *)chan->user.client; in nouveau_channel_del()
95 if (chan->fence) in nouveau_channel_del()
96 nouveau_fence(chan->drm)->context_del(chan); in nouveau_channel_del()
99 nouveau_svmm_part(chan->vmm->svmm, chan->inst); in nouveau_channel_del()
101 nvif_object_dtor(&chan->blit); in nouveau_channel_del()
102 nvif_object_dtor(&chan->nvsw); in nouveau_channel_del()
103 nvif_object_dtor(&chan->gart); in nouveau_channel_del()
104 nvif_object_dtor(&chan->vram); in nouveau_channel_del()
105 nvif_event_dtor(&chan->kill); in nouveau_channel_del()
106 nvif_object_dtor(&chan->user); in nouveau_channel_del()
107 nvif_mem_dtor(&chan->mem_userd); in nouveau_channel_del()
108 nvif_object_dtor(&chan->push.ctxdma); in nouveau_channel_del()
109 nouveau_vma_del(&chan->push.vma); in nouveau_channel_del()
110 nouveau_bo_unmap(chan->push.buffer); in nouveau_channel_del()
111 if (chan->push.buffer && chan->push.buffer->bo.pin_count) in nouveau_channel_del()
112 nouveau_bo_unpin(chan->push.buffer); in nouveau_channel_del()
113 nouveau_bo_ref(NULL, &chan->push.buffer); in nouveau_channel_del()
114 kfree(chan); in nouveau_channel_del()
122 struct nouveau_channel *chan = container_of(push, typeof(*chan), chan._push); in nouveau_channel_kick() local
123 chan->dma.cur = chan->dma.cur + (chan->chan._push.cur - chan->chan._push.bgn); in nouveau_channel_kick()
124 FIRE_RING(chan); in nouveau_channel_kick()
125 chan->chan._push.bgn = chan->chan._push.cur; in nouveau_channel_kick()
131 struct nouveau_channel *chan = container_of(push, typeof(*chan), chan._push); in nouveau_channel_wait() local
133 chan->dma.cur = chan->dma.cur + (chan->chan._push.cur - chan->chan._push.bgn); in nouveau_channel_wait()
134 ret = RING_SPACE(chan, size); in nouveau_channel_wait()
136 chan->chan._push.bgn = chan->chan._push.mem.object.map.ptr; in nouveau_channel_wait()
137 chan->chan._push.bgn = chan->chan._push.bgn + chan->dma.cur; in nouveau_channel_wait()
138 chan->chan._push.cur = chan->chan._push.bgn; in nouveau_channel_wait()
139 chan->chan._push.end = chan->chan._push.bgn + size; in nouveau_channel_wait()
150 struct nouveau_channel *chan; in nouveau_channel_prep() local
154 chan = *pchan = kzalloc(sizeof(*chan), GFP_KERNEL); in nouveau_channel_prep()
155 if (!chan) in nouveau_channel_prep()
158 chan->device = device; in nouveau_channel_prep()
159 chan->drm = drm; in nouveau_channel_prep()
160 chan->vmm = nouveau_cli_vmm(cli); in nouveau_channel_prep()
161 atomic_set(&chan->killed, 0); in nouveau_channel_prep()
169 &chan->push.buffer); in nouveau_channel_prep()
171 ret = nouveau_bo_pin(chan->push.buffer, target, false); in nouveau_channel_prep()
173 ret = nouveau_bo_map(chan->push.buffer); in nouveau_channel_prep()
181 chan->chan._push.mem.object.parent = cli->base.object.parent; in nouveau_channel_prep()
182 chan->chan._push.mem.object.client = &cli->base; in nouveau_channel_prep()
183 chan->chan._push.mem.object.name = "chanPush"; in nouveau_channel_prep()
184 chan->chan._push.mem.object.map.ptr = chan->push.buffer->kmap.virtual; in nouveau_channel_prep()
185 chan->chan._push.wait = nouveau_channel_wait; in nouveau_channel_prep()
186 chan->chan._push.kick = nouveau_channel_kick; in nouveau_channel_prep()
187 chan->chan.push = &chan->chan._push; in nouveau_channel_prep()
193 chan->push.addr = chan->push.buffer->offset; in nouveau_channel_prep()
196 ret = nouveau_vma_new(chan->push.buffer, chan->vmm, in nouveau_channel_prep()
197 &chan->push.vma); in nouveau_channel_prep()
203 chan->push.addr = chan->push.vma->addr; in nouveau_channel_prep()
211 args.limit = chan->vmm->vmm.limit - 1; in nouveau_channel_prep()
213 if (chan->push.buffer->bo.resource->mem_type == TTM_PL_VRAM) { in nouveau_channel_prep()
231 if (chan->drm->agp.bridge) { in nouveau_channel_prep()
234 args.start = chan->drm->agp.base; in nouveau_channel_prep()
235 args.limit = chan->drm->agp.base + in nouveau_channel_prep()
236 chan->drm->agp.size - 1; in nouveau_channel_prep()
241 args.limit = chan->vmm->vmm.limit - 1; in nouveau_channel_prep()
247 &chan->push.ctxdma); in nouveau_channel_prep()
279 struct nvif_chan_v0 chan; in nouveau_channel_ctor() member
283 struct nouveau_channel *chan; in nouveau_channel_ctor() local
301 ret = nouveau_channel_prep(drm, device, size, &chan); in nouveau_channel_ctor()
302 *pchan = chan; in nouveau_channel_ctor()
307 args.chan.version = 0; in nouveau_channel_ctor()
308 args.chan.namelen = sizeof(args.name); in nouveau_channel_ctor()
309 args.chan.runlist = __ffs64(runm); in nouveau_channel_ctor()
310 args.chan.runq = 0; in nouveau_channel_ctor()
311 args.chan.priv = priv; in nouveau_channel_ctor()
312 args.chan.devm = BIT(0); in nouveau_channel_ctor()
314 args.chan.vmm = 0; in nouveau_channel_ctor()
315 args.chan.ctxdma = nvif_handle(&chan->push.ctxdma); in nouveau_channel_ctor()
316 args.chan.offset = chan->push.addr; in nouveau_channel_ctor()
317 args.chan.length = 0; in nouveau_channel_ctor()
319 args.chan.vmm = nvif_handle(&chan->vmm->vmm.object); in nouveau_channel_ctor()
321 args.chan.ctxdma = nvif_handle(&chan->push.ctxdma); in nouveau_channel_ctor()
323 args.chan.ctxdma = 0; in nouveau_channel_ctor()
324 args.chan.offset = ioffset + chan->push.addr; in nouveau_channel_ctor()
325 args.chan.length = ilength; in nouveau_channel_ctor()
327 args.chan.huserd = 0; in nouveau_channel_ctor()
328 args.chan.ouserd = 0; in nouveau_channel_ctor()
334 0, PAGE_SIZE, NULL, 0, &chan->mem_userd); in nouveau_channel_ctor()
338 args.chan.huserd = nvif_handle(&chan->mem_userd.object); in nouveau_channel_ctor()
339 args.chan.ouserd = 0; in nouveau_channel_ctor()
341 chan->userd = &chan->mem_userd.object; in nouveau_channel_ctor()
343 chan->userd = &chan->user; in nouveau_channel_ctor()
350 &args, sizeof(args), &chan->user); in nouveau_channel_ctor()
356 chan->runlist = args.chan.runlist; in nouveau_channel_ctor()
357 chan->chid = args.chan.chid; in nouveau_channel_ctor()
358 chan->inst = args.chan.inst; in nouveau_channel_ctor()
359 chan->token = args.chan.token; in nouveau_channel_ctor()
364 nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) in nouveau_channel_init() argument
366 struct nvif_device *device = chan->device; in nouveau_channel_init()
367 struct nouveau_drm *drm = chan->drm; in nouveau_channel_init()
371 ret = nvif_object_map(chan->userd, NULL, 0); in nouveau_channel_init()
375 if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) { in nouveau_channel_init()
384 ret = nvif_event_ctor(&chan->user, "abi16ChanKilled", chan->chid, in nouveau_channel_init()
386 &args.base, sizeof(args), &chan->kill); in nouveau_channel_init()
388 ret = nvif_event_allow(&chan->kill); in nouveau_channel_init()
402 args.limit = chan->vmm->vmm.limit - 1; in nouveau_channel_init()
410 ret = nvif_object_ctor(&chan->user, "abi16ChanVramCtxDma", vram, in nouveau_channel_init()
412 &chan->vram); in nouveau_channel_init()
420 args.limit = chan->vmm->vmm.limit - 1; in nouveau_channel_init()
422 if (chan->drm->agp.bridge) { in nouveau_channel_init()
425 args.start = chan->drm->agp.base; in nouveau_channel_init()
426 args.limit = chan->drm->agp.base + in nouveau_channel_init()
427 chan->drm->agp.size - 1; in nouveau_channel_init()
432 args.limit = chan->vmm->vmm.limit - 1; in nouveau_channel_init()
435 ret = nvif_object_ctor(&chan->user, "abi16ChanGartCtxDma", gart, in nouveau_channel_init()
437 &chan->gart); in nouveau_channel_init()
443 switch (chan->user.oclass) { in nouveau_channel_init()
448 chan->user_put = 0x40; in nouveau_channel_init()
449 chan->user_get = 0x44; in nouveau_channel_init()
450 chan->dma.max = (0x10000 / 4) - 2; in nouveau_channel_init()
453 chan->user_put = 0x40; in nouveau_channel_init()
454 chan->user_get = 0x44; in nouveau_channel_init()
455 chan->user_get_hi = 0x60; in nouveau_channel_init()
456 chan->dma.ib_base = 0x10000 / 4; in nouveau_channel_init()
457 chan->dma.ib_max = NV50_DMA_IB_MAX; in nouveau_channel_init()
458 chan->dma.ib_put = 0; in nouveau_channel_init()
459 chan->dma.ib_free = chan->dma.ib_max - chan->dma.ib_put; in nouveau_channel_init()
460 chan->dma.max = chan->dma.ib_base; in nouveau_channel_init()
464 chan->dma.put = 0; in nouveau_channel_init()
465 chan->dma.cur = chan->dma.put; in nouveau_channel_init()
466 chan->dma.free = chan->dma.max - chan->dma.cur; in nouveau_channel_init()
468 ret = PUSH_WAIT(chan->chan.push, NOUVEAU_DMA_SKIPS); in nouveau_channel_init()
473 PUSH_DATA(chan->chan.push, 0x00000000); in nouveau_channel_init()
477 ret = nvif_object_ctor(&chan->user, "abi16NvswFence", 0x006e, in nouveau_channel_init()
479 NULL, 0, &chan->nvsw); in nouveau_channel_init()
483 ret = PUSH_WAIT(chan->chan.push, 2); in nouveau_channel_init()
487 PUSH_NVSQ(chan->chan.push, NV_SW, 0x0000, chan->nvsw.handle); in nouveau_channel_init()
488 PUSH_KICK(chan->chan.push); in nouveau_channel_init()
492 return nouveau_fence(chan->drm)->context_new(chan); in nouveau_channel_init()