Lines Matching +full:not +full:- +full:swapped

1 // SPDX-License-Identifier: MIT
26 * userspace-managable portion of the VA space. It provides operations to map
27 * and unmap memory. Mappings may be flagged as sparse. Sparse mappings are not
32 * bounds (but not crossing those bounds) of a previously mapped sparse
40 * Unmap requests are not bound to the range of existing mappings and can even
51 * The kernel does not permit to:
52 * - unmap non-existent sparse mappings
53 * - unmap a sparse mapping and map a new sparse mapping overlapping the range
55 * - unmap a sparse mapping and map new memory backed mappings overlapping the
61 * mappings are created in the GPU's MMU. If the given memory is swapped out
64 * the memory is swapped back in. While this is transparent for userspace, it is
65 * guaranteed that all the backing memory is swapped back in and all the memory
74 * not permit any syncobjs submitted to the kernel.
84 * be pending. Hence, EXEC jobs require to have the particular fences - of
85 * the corresponding VM_BIND jobs they depent on - attached to them.
92 struct nouveau_cli *cli = job->cli; in nouveau_exec_job_submit()
94 struct drm_exec *exec = &job->exec; in nouveau_exec_job_submit()
99 /* Create a new fence, but do not emit yet. */ in nouveau_exec_job_submit()
100 ret = nouveau_fence_create(&exec_job->fence, exec_job->chan); in nouveau_exec_job_submit()
110 drm_gpuva_for_each_va(va, &uvmm->umgr) { in nouveau_exec_job_submit()
111 if (unlikely(va == &uvmm->umgr.kernel_alloc_node)) in nouveau_exec_job_submit()
114 ret = drm_exec_prepare_obj(exec, va->gem.obj, 1); in nouveau_exec_job_submit()
143 struct drm_exec *exec = &job->exec; in nouveau_exec_job_armed_submit()
148 dma_resv_add_fence(obj->resv, job->done_fence, job->resv_usage); in nouveau_exec_job_armed_submit()
157 struct nouveau_channel *chan = exec_job->chan; in nouveau_exec_job_run()
158 struct nouveau_fence *fence = exec_job->fence; in nouveau_exec_job_run()
161 ret = nouveau_dma_wait(chan, exec_job->push.count + 1, 16); in nouveau_exec_job_run()
163 NV_PRINTK(err, job->cli, "nv50cal_space: %d\n", ret); in nouveau_exec_job_run()
167 for (i = 0; i < exec_job->push.count; i++) { in nouveau_exec_job_run()
168 struct drm_nouveau_exec_push *p = &exec_job->push.s[i]; in nouveau_exec_job_run()
169 bool no_prefetch = p->flags & DRM_NOUVEAU_EXEC_PUSH_NO_PREFETCH; in nouveau_exec_job_run()
171 nv50_dma_push(chan, p->va, p->va_len, no_prefetch); in nouveau_exec_job_run()
176 nouveau_fence_unref(&exec_job->fence); in nouveau_exec_job_run()
177 NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret); in nouveau_exec_job_run()
185 exec_job->fence = NULL; in nouveau_exec_job_run()
187 return &fence->base; in nouveau_exec_job_run()
197 kfree(exec_job->fence); in nouveau_exec_job_free()
198 kfree(exec_job->push.s); in nouveau_exec_job_free()
206 struct nouveau_channel *chan = exec_job->chan; in nouveau_exec_job_timeout()
208 if (unlikely(!atomic_read(&chan->killed))) in nouveau_exec_job_timeout()
211 NV_PRINTK(warn, job->cli, "job timeout, channel %d killed!\n", in nouveau_exec_job_timeout()
212 chan->chid); in nouveau_exec_job_timeout()
214 nouveau_sched_entity_fini(job->entity); in nouveau_exec_job_timeout()
235 for (i = 0; i < __args->push.count; i++) { in nouveau_exec_job_init()
236 struct drm_nouveau_exec_push *p = &__args->push.s[i]; in nouveau_exec_job_init()
238 if (unlikely(p->va_len > NV50_DMA_PUSH_MAX_LENGTH)) { in nouveau_exec_job_init()
239 NV_PRINTK(err, nouveau_cli(__args->file_priv), in nouveau_exec_job_init()
241 p->va_len, NV50_DMA_PUSH_MAX_LENGTH); in nouveau_exec_job_init()
242 return -EINVAL; in nouveau_exec_job_init()
248 return -ENOMEM; in nouveau_exec_job_init()
250 job->push.count = __args->push.count; in nouveau_exec_job_init()
251 if (__args->push.count) { in nouveau_exec_job_init()
252 job->push.s = kmemdup(__args->push.s, in nouveau_exec_job_init()
253 sizeof(*__args->push.s) * in nouveau_exec_job_init()
254 __args->push.count, in nouveau_exec_job_init()
256 if (!job->push.s) { in nouveau_exec_job_init()
257 ret = -ENOMEM; in nouveau_exec_job_init()
262 job->chan = __args->chan; in nouveau_exec_job_init()
264 args.sched_entity = __args->sched_entity; in nouveau_exec_job_init()
265 args.file_priv = __args->file_priv; in nouveau_exec_job_init()
267 args.in_sync.count = __args->in_sync.count; in nouveau_exec_job_init()
268 args.in_sync.s = __args->in_sync.s; in nouveau_exec_job_init()
270 args.out_sync.count = __args->out_sync.count; in nouveau_exec_job_init()
271 args.out_sync.s = __args->out_sync.s; in nouveau_exec_job_init()
276 ret = nouveau_job_init(&job->base, &args); in nouveau_exec_job_init()
283 kfree(job->push.s); in nouveau_exec_job_init()
301 ret = nouveau_job_submit(&job->base); in nouveau_exec()
308 nouveau_job_fini(&job->base); in nouveau_exec()
317 u32 inc = req->wait_count; in nouveau_exec_ucopy()
318 u64 ins = req->wait_ptr; in nouveau_exec_ucopy()
319 u32 outc = req->sig_count; in nouveau_exec_ucopy()
320 u64 outs = req->sig_ptr; in nouveau_exec_ucopy()
321 u32 pushc = req->push_count; in nouveau_exec_ucopy()
322 u64 pushs = req->push_ptr; in nouveau_exec_ucopy()
326 args->push.count = pushc; in nouveau_exec_ucopy()
327 args->push.s = u_memcpya(pushs, pushc, sizeof(*args->push.s)); in nouveau_exec_ucopy()
328 if (IS_ERR(args->push.s)) in nouveau_exec_ucopy()
329 return PTR_ERR(args->push.s); in nouveau_exec_ucopy()
333 s = &args->in_sync.s; in nouveau_exec_ucopy()
335 args->in_sync.count = inc; in nouveau_exec_ucopy()
344 s = &args->out_sync.s; in nouveau_exec_ucopy()
346 args->out_sync.count = outc; in nouveau_exec_ucopy()
357 u_free(args->push.s); in nouveau_exec_ucopy()
359 u_free(args->in_sync.s); in nouveau_exec_ucopy()
366 u_free(args->push.s); in nouveau_exec_ufree()
367 u_free(args->in_sync.s); in nouveau_exec_ufree()
368 u_free(args->out_sync.s); in nouveau_exec_ufree()
385 return -ENOMEM; in nouveau_exec_ioctl_exec()
389 return nouveau_abi16_put(abi16, -ENOSYS); in nouveau_exec_ioctl_exec()
391 list_for_each_entry(chan16, &abi16->channels, head) { in nouveau_exec_ioctl_exec()
392 if (chan16->chan->chid == req->channel) { in nouveau_exec_ioctl_exec()
393 chan = chan16->chan; in nouveau_exec_ioctl_exec()
399 return nouveau_abi16_put(abi16, -ENOENT); in nouveau_exec_ioctl_exec()
401 if (unlikely(atomic_read(&chan->killed))) in nouveau_exec_ioctl_exec()
402 return nouveau_abi16_put(abi16, -ENODEV); in nouveau_exec_ioctl_exec()
404 if (!chan->dma.ib_max) in nouveau_exec_ioctl_exec()
405 return nouveau_abi16_put(abi16, -ENOSYS); in nouveau_exec_ioctl_exec()
407 push_max = nouveau_exec_push_max_from_ib_max(chan->dma.ib_max); in nouveau_exec_ioctl_exec()
408 if (unlikely(req->push_count > push_max)) { in nouveau_exec_ioctl_exec()
410 req->push_count, push_max); in nouveau_exec_ioctl_exec()
411 return nouveau_abi16_put(abi16, -EINVAL); in nouveau_exec_ioctl_exec()
418 args.sched_entity = &chan16->sched_entity; in nouveau_exec_ioctl_exec()