Lines Matching +full:mali +full:- +full:t760
1 // SPDX-License-Identifier: GPL-2.0
29 struct panfrost_device *pfdev = ddev->dev_private; in panfrost_ioctl_get_param()
31 if (param->pad != 0) in panfrost_ioctl_get_param()
32 return -EINVAL; in panfrost_ioctl_get_param()
36 param->value = pfdev->features.member; \ in panfrost_ioctl_get_param()
41 param->value = pfdev->features.member[param->param - \ in panfrost_ioctl_get_param()
45 switch (param->param) { in panfrost_ioctl_get_param()
72 return -EINVAL; in panfrost_ioctl_get_param()
81 struct panfrost_file_priv *priv = file->driver_priv; in panfrost_ioctl_create_bo()
86 if (!args->size || args->pad || in panfrost_ioctl_create_bo()
87 (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP))) in panfrost_ioctl_create_bo()
88 return -EINVAL; in panfrost_ioctl_create_bo()
91 if ((args->flags & PANFROST_BO_HEAP) && in panfrost_ioctl_create_bo()
92 !(args->flags & PANFROST_BO_NOEXEC)) in panfrost_ioctl_create_bo()
93 return -EINVAL; in panfrost_ioctl_create_bo()
95 bo = panfrost_gem_create_with_handle(file, dev, args->size, args->flags, in panfrost_ioctl_create_bo()
96 &args->handle); in panfrost_ioctl_create_bo()
102 drm_gem_object_put(&bo->base.base); in panfrost_ioctl_create_bo()
103 return -EINVAL; in panfrost_ioctl_create_bo()
106 args->offset = mapping->mmnode.start << PAGE_SHIFT; in panfrost_ioctl_create_bo()
113 * panfrost_lookup_bos() - Sets up job->bo[] with the GEM objects
131 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_lookup_bos()
136 job->bo_count = args->bo_handle_count; in panfrost_lookup_bos()
138 if (!job->bo_count) in panfrost_lookup_bos()
142 (void __user *)(uintptr_t)args->bo_handles, in panfrost_lookup_bos()
143 job->bo_count, &job->bos); in panfrost_lookup_bos()
147 job->mappings = kvmalloc_array(job->bo_count, in panfrost_lookup_bos()
150 if (!job->mappings) in panfrost_lookup_bos()
151 return -ENOMEM; in panfrost_lookup_bos()
153 for (i = 0; i < job->bo_count; i++) { in panfrost_lookup_bos()
156 bo = to_panfrost_bo(job->bos[i]); in panfrost_lookup_bos()
159 ret = -EINVAL; in panfrost_lookup_bos()
163 atomic_inc(&bo->gpu_usecount); in panfrost_lookup_bos()
164 job->mappings[i] = mapping; in panfrost_lookup_bos()
171 * panfrost_copy_in_sync() - Sets up job->deps with the sync objects
193 in_fence_count = args->in_sync_count; in panfrost_copy_in_sync()
200 ret = -ENOMEM; in panfrost_copy_in_sync()
206 (void __user *)(uintptr_t)args->in_syncs, in panfrost_copy_in_sync()
208 ret = -EFAULT; in panfrost_copy_in_sync()
221 ret = drm_sched_job_add_dependency(&job->base, fence); in panfrost_copy_in_sync()
235 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_submit()
236 struct panfrost_file_priv *file_priv = file->driver_priv; in panfrost_ioctl_submit()
242 if (!args->jc) in panfrost_ioctl_submit()
243 return -EINVAL; in panfrost_ioctl_submit()
245 if (args->requirements && args->requirements != PANFROST_JD_REQ_FS) in panfrost_ioctl_submit()
246 return -EINVAL; in panfrost_ioctl_submit()
248 if (args->out_sync > 0) { in panfrost_ioctl_submit()
249 sync_out = drm_syncobj_find(file, args->out_sync); in panfrost_ioctl_submit()
251 return -ENODEV; in panfrost_ioctl_submit()
256 ret = -ENOMEM; in panfrost_ioctl_submit()
260 kref_init(&job->refcount); in panfrost_ioctl_submit()
262 job->pfdev = pfdev; in panfrost_ioctl_submit()
263 job->jc = args->jc; in panfrost_ioctl_submit()
264 job->requirements = args->requirements; in panfrost_ioctl_submit()
265 job->flush_id = panfrost_gpu_get_latest_flush_id(pfdev); in panfrost_ioctl_submit()
266 job->mmu = file_priv->mmu; in panfrost_ioctl_submit()
270 ret = drm_sched_job_init(&job->base, in panfrost_ioctl_submit()
271 &file_priv->sched_entity[slot], in panfrost_ioctl_submit()
290 drm_syncobj_replace_fence(sync_out, job->render_done_fence); in panfrost_ioctl_submit()
294 drm_sched_job_cleanup(&job->base); in panfrost_ioctl_submit()
311 unsigned long timeout = drm_timeout_abs_to_jiffies(args->timeout_ns); in panfrost_ioctl_wait_bo()
313 if (args->pad) in panfrost_ioctl_wait_bo()
314 return -EINVAL; in panfrost_ioctl_wait_bo()
316 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_wait_bo()
318 return -ENOENT; in panfrost_ioctl_wait_bo()
320 ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ, in panfrost_ioctl_wait_bo()
323 ret = timeout ? -ETIMEDOUT : -EBUSY; in panfrost_ioctl_wait_bo()
337 if (args->flags != 0) { in panfrost_ioctl_mmap_bo()
338 DRM_INFO("unknown mmap_bo flags: %d\n", args->flags); in panfrost_ioctl_mmap_bo()
339 return -EINVAL; in panfrost_ioctl_mmap_bo()
342 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_mmap_bo()
344 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_mmap_bo()
345 return -ENOENT; in panfrost_ioctl_mmap_bo()
349 if (to_panfrost_bo(gem_obj)->is_heap) { in panfrost_ioctl_mmap_bo()
350 ret = -EINVAL; in panfrost_ioctl_mmap_bo()
356 args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); in panfrost_ioctl_mmap_bo()
366 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_ioctl_get_bo_offset()
372 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_get_bo_offset()
374 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_get_bo_offset()
375 return -ENOENT; in panfrost_ioctl_get_bo_offset()
383 return -EINVAL; in panfrost_ioctl_get_bo_offset()
385 args->offset = mapping->mmnode.start << PAGE_SHIFT; in panfrost_ioctl_get_bo_offset()
393 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_ioctl_madvise()
395 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_madvise()
400 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_madvise()
402 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_madvise()
403 return -ENOENT; in panfrost_ioctl_madvise()
408 mutex_lock(&pfdev->shrinker_lock); in panfrost_ioctl_madvise()
409 mutex_lock(&bo->mappings.lock); in panfrost_ioctl_madvise()
410 if (args->madv == PANFROST_MADV_DONTNEED) { in panfrost_ioctl_madvise()
413 first = list_first_entry(&bo->mappings.list, in panfrost_ioctl_madvise()
425 if (!list_is_singular(&bo->mappings.list) || in panfrost_ioctl_madvise()
426 WARN_ON_ONCE(first->mmu != priv->mmu)) { in panfrost_ioctl_madvise()
427 ret = -EINVAL; in panfrost_ioctl_madvise()
432 args->retained = drm_gem_shmem_madvise(&bo->base, args->madv); in panfrost_ioctl_madvise()
434 if (args->retained) { in panfrost_ioctl_madvise()
435 if (args->madv == PANFROST_MADV_DONTNEED) in panfrost_ioctl_madvise()
436 list_move_tail(&bo->base.madv_list, in panfrost_ioctl_madvise()
437 &pfdev->shrinker_list); in panfrost_ioctl_madvise()
438 else if (args->madv == PANFROST_MADV_WILLNEED) in panfrost_ioctl_madvise()
439 list_del_init(&bo->base.madv_list); in panfrost_ioctl_madvise()
443 mutex_unlock(&bo->mappings.lock); in panfrost_ioctl_madvise()
444 mutex_unlock(&pfdev->shrinker_lock); in panfrost_ioctl_madvise()
453 return -ENOSYS; in panfrost_unstable_ioctl_check()
462 struct panfrost_device *pfdev = dev->dev_private; in panfrost_open()
467 return -ENOMEM; in panfrost_open()
469 panfrost_priv->pfdev = pfdev; in panfrost_open()
470 file->driver_priv = panfrost_priv; in panfrost_open()
472 panfrost_priv->mmu = panfrost_mmu_ctx_create(pfdev); in panfrost_open()
473 if (IS_ERR(panfrost_priv->mmu)) { in panfrost_open()
474 ret = PTR_ERR(panfrost_priv->mmu); in panfrost_open()
485 panfrost_mmu_ctx_put(panfrost_priv->mmu); in panfrost_open()
494 struct panfrost_file_priv *panfrost_priv = file->driver_priv; in panfrost_postclose()
499 panfrost_mmu_ctx_put(panfrost_priv->mmu); in panfrost_postclose()
522 * - 1.0 - initial interface
523 * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
524 * - 1.2 - adds AFBC_FEATURES query
552 pfdev = devm_kzalloc(&pdev->dev, sizeof(*pfdev), GFP_KERNEL); in panfrost_probe()
554 return -ENOMEM; in panfrost_probe()
556 pfdev->pdev = pdev; in panfrost_probe()
557 pfdev->dev = &pdev->dev; in panfrost_probe()
561 pfdev->comp = of_device_get_match_data(&pdev->dev); in panfrost_probe()
562 if (!pfdev->comp) in panfrost_probe()
563 return -ENODEV; in panfrost_probe()
565 pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT; in panfrost_probe()
568 ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev); in panfrost_probe()
572 ddev->dev_private = pfdev; in panfrost_probe()
573 pfdev->ddev = ddev; in panfrost_probe()
575 mutex_init(&pfdev->shrinker_lock); in panfrost_probe()
576 INIT_LIST_HEAD(&pfdev->shrinker_list); in panfrost_probe()
580 if (err != -EPROBE_DEFER) in panfrost_probe()
581 dev_err(&pdev->dev, "Fatal error during GPU init\n"); in panfrost_probe()
585 pm_runtime_set_active(pfdev->dev); in panfrost_probe()
586 pm_runtime_mark_last_busy(pfdev->dev); in panfrost_probe()
587 pm_runtime_enable(pfdev->dev); in panfrost_probe()
588 pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ in panfrost_probe()
589 pm_runtime_use_autosuspend(pfdev->dev); in panfrost_probe()
604 pm_runtime_disable(pfdev->dev); in panfrost_probe()
606 pm_runtime_set_suspended(pfdev->dev); in panfrost_probe()
615 struct drm_device *ddev = pfdev->ddev; in panfrost_remove()
620 pm_runtime_get_sync(pfdev->dev); in panfrost_remove()
621 pm_runtime_disable(pfdev->dev); in panfrost_remove()
623 pm_runtime_set_suspended(pfdev->dev); in panfrost_remove()
632 * and then initialize num_supplies with ARRAY_SIZE - 1.
634 static const char * const default_supplies[] = { "mali", NULL };
636 .num_supplies = ARRAY_SIZE(default_supplies) - 1,
643 .num_supplies = ARRAY_SIZE(default_supplies) - 1,
648 static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
651 .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies) - 1,
659 { .compatible = "amlogic,meson-gxm-mali",
661 { .compatible = "amlogic,meson-g12a-mali",
663 { .compatible = "arm,mali-t604", .data = &default_data, },
664 { .compatible = "arm,mali-t624", .data = &default_data, },
665 { .compatible = "arm,mali-t628", .data = &default_data, },
666 { .compatible = "arm,mali-t720", .data = &default_data, },
667 { .compatible = "arm,mali-t760", .data = &default_data, },
668 { .compatible = "arm,mali-t820", .data = &default_data, },
669 { .compatible = "arm,mali-t830", .data = &default_data, },
670 { .compatible = "arm,mali-t860", .data = &default_data, },
671 { .compatible = "arm,mali-t880", .data = &default_data, },
672 { .compatible = "arm,mali-bifrost", .data = &default_data, },
673 { .compatible = "arm,mali-valhall-jm", .data = &default_data, },
674 { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },