Lines Matching refs:cgrp
32 nvkm_cgrp_ectx_put(struct nvkm_cgrp *cgrp, struct nvkm_ectx **pectx) in nvkm_cgrp_ectx_put() argument
40 CGRP_TRACE(cgrp, "dtor ectx %d[%s]", engn->id, engn->engine->subdev.name); in nvkm_cgrp_ectx_put()
51 nvkm_cgrp_ectx_get(struct nvkm_cgrp *cgrp, struct nvkm_engn *engn, struct nvkm_ectx **pectx, in nvkm_cgrp_ectx_get() argument
63 ectx = nvkm_list_find(ectx, &cgrp->ectxs, head, ectx->engn == engn); in nvkm_cgrp_ectx_get()
71 CGRP_TRACE(cgrp, "ctor ectx %d[%s]", engn->id, engn->engine->subdev.name); in nvkm_cgrp_ectx_get()
78 list_add_tail(&ectx->head, &cgrp->ectxs); in nvkm_cgrp_ectx_get()
87 nvkm_cgrp_ectx_put(cgrp, pectx); in nvkm_cgrp_ectx_get()
93 nvkm_cgrp_vctx_put(struct nvkm_cgrp *cgrp, struct nvkm_vctx **pvctx) in nvkm_cgrp_vctx_put() argument
101 CGRP_TRACE(cgrp, "dtor vctx %d[%s]", engn->id, engn->engine->subdev.name); in nvkm_cgrp_vctx_put()
105 nvkm_cgrp_ectx_put(cgrp, &vctx->ectx); in nvkm_cgrp_vctx_put()
119 nvkm_cgrp_vctx_get(struct nvkm_cgrp *cgrp, struct nvkm_engn *engn, struct nvkm_chan *chan, in nvkm_cgrp_vctx_get() argument
127 vctx = nvkm_list_find(vctx, &cgrp->vctxs, head, in nvkm_cgrp_vctx_get()
136 ret = nvkm_cgrp_ectx_get(cgrp, engn, &ectx, chan, client); in nvkm_cgrp_vctx_get()
138 CGRP_ERROR(cgrp, "ectx %d[%s]: %d", engn->id, engn->engine->subdev.name, ret); in nvkm_cgrp_vctx_get()
143 CGRP_TRACE(cgrp, "ctor vctx %d[%s]", engn->id, engn->engine->subdev.name); in nvkm_cgrp_vctx_get()
145 nvkm_cgrp_ectx_put(cgrp, &ectx); in nvkm_cgrp_vctx_get()
152 list_add_tail(&vctx->head, &cgrp->vctxs); in nvkm_cgrp_vctx_get()
169 nvkm_cgrp_vctx_put(cgrp, pvctx); in nvkm_cgrp_vctx_get()
177 struct nvkm_cgrp *cgrp = container_of(kref, typeof(*cgrp), kref); in nvkm_cgrp_del() local
178 struct nvkm_runl *runl = cgrp->runl; in nvkm_cgrp_del()
181 nvkm_chid_put(runl->cgid, cgrp->id, &cgrp->lock); in nvkm_cgrp_del()
183 mutex_destroy(&cgrp->mutex); in nvkm_cgrp_del()
184 nvkm_vmm_unref(&cgrp->vmm); in nvkm_cgrp_del()
185 kfree(cgrp); in nvkm_cgrp_del()
191 struct nvkm_cgrp *cgrp = *pcgrp; in nvkm_cgrp_unref() local
193 if (!cgrp) in nvkm_cgrp_unref()
196 kref_put(&cgrp->kref, nvkm_cgrp_del); in nvkm_cgrp_unref()
201 nvkm_cgrp_ref(struct nvkm_cgrp *cgrp) in nvkm_cgrp_ref() argument
203 if (cgrp) in nvkm_cgrp_ref()
204 kref_get(&cgrp->kref); in nvkm_cgrp_ref()
206 return cgrp; in nvkm_cgrp_ref()
212 struct nvkm_cgrp *cgrp = *pcgrp; in nvkm_cgrp_put() local
214 if (!cgrp) in nvkm_cgrp_put()
218 spin_unlock_irqrestore(&cgrp->lock, irqflags); in nvkm_cgrp_put()
225 struct nvkm_cgrp *cgrp; in nvkm_cgrp_new() local
227 if (!(cgrp = *pcgrp = kmalloc(sizeof(*cgrp), GFP_KERNEL))) in nvkm_cgrp_new()
230 cgrp->func = runl->fifo->func->cgrp.func; in nvkm_cgrp_new()
231 strscpy(cgrp->name, name, sizeof(cgrp->name)); in nvkm_cgrp_new()
232 cgrp->runl = runl; in nvkm_cgrp_new()
233 cgrp->vmm = nvkm_vmm_ref(vmm); in nvkm_cgrp_new()
234 cgrp->hw = hw; in nvkm_cgrp_new()
235 cgrp->id = -1; in nvkm_cgrp_new()
236 kref_init(&cgrp->kref); in nvkm_cgrp_new()
237 INIT_LIST_HEAD(&cgrp->chans); in nvkm_cgrp_new()
238 cgrp->chan_nr = 0; in nvkm_cgrp_new()
239 spin_lock_init(&cgrp->lock); in nvkm_cgrp_new()
240 INIT_LIST_HEAD(&cgrp->ectxs); in nvkm_cgrp_new()
241 INIT_LIST_HEAD(&cgrp->vctxs); in nvkm_cgrp_new()
242 mutex_init(&cgrp->mutex); in nvkm_cgrp_new()
243 atomic_set(&cgrp->rc, NVKM_CGRP_RC_NONE); in nvkm_cgrp_new()
246 cgrp->id = nvkm_chid_get(runl->cgid, cgrp); in nvkm_cgrp_new()
247 if (cgrp->id < 0) { in nvkm_cgrp_new()