Lines Matching +full:mali +full:- +full:t760
1 // SPDX-License-Identifier: GPL-2.0
30 struct panfrost_device *pfdev = ddev->dev_private; in panfrost_ioctl_get_param()
32 if (param->pad != 0) in panfrost_ioctl_get_param()
33 return -EINVAL; in panfrost_ioctl_get_param()
37 param->value = pfdev->features.member; \ in panfrost_ioctl_get_param()
42 param->value = pfdev->features.member[param->param - \ in panfrost_ioctl_get_param()
46 switch (param->param) { in panfrost_ioctl_get_param()
73 return -EINVAL; in panfrost_ioctl_get_param()
82 struct panfrost_file_priv *priv = file->driver_priv; in panfrost_ioctl_create_bo()
88 if (!args->size || args->pad || in panfrost_ioctl_create_bo()
89 (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP))) in panfrost_ioctl_create_bo()
90 return -EINVAL; in panfrost_ioctl_create_bo()
93 if ((args->flags & PANFROST_BO_HEAP) && in panfrost_ioctl_create_bo()
94 !(args->flags & PANFROST_BO_NOEXEC)) in panfrost_ioctl_create_bo()
95 return -EINVAL; in panfrost_ioctl_create_bo()
97 bo = panfrost_gem_create(dev, args->size, args->flags); in panfrost_ioctl_create_bo()
101 ret = drm_gem_handle_create(file, &bo->base.base, &args->handle); in panfrost_ioctl_create_bo()
107 args->offset = mapping->mmnode.start << PAGE_SHIFT; in panfrost_ioctl_create_bo()
114 ret = -EINVAL; in panfrost_ioctl_create_bo()
118 drm_gem_object_put(&bo->base.base); in panfrost_ioctl_create_bo()
123 * panfrost_lookup_bos() - Sets up job->bo[] with the GEM objects
141 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_lookup_bos()
146 job->bo_count = args->bo_handle_count; in panfrost_lookup_bos()
148 if (!job->bo_count) in panfrost_lookup_bos()
152 (void __user *)(uintptr_t)args->bo_handles, in panfrost_lookup_bos()
153 job->bo_count, &job->bos); in panfrost_lookup_bos()
157 job->mappings = kvmalloc_array(job->bo_count, in panfrost_lookup_bos()
160 if (!job->mappings) in panfrost_lookup_bos()
161 return -ENOMEM; in panfrost_lookup_bos()
163 for (i = 0; i < job->bo_count; i++) { in panfrost_lookup_bos()
166 bo = to_panfrost_bo(job->bos[i]); in panfrost_lookup_bos()
169 ret = -EINVAL; in panfrost_lookup_bos()
173 atomic_inc(&bo->gpu_usecount); in panfrost_lookup_bos()
174 job->mappings[i] = mapping; in panfrost_lookup_bos()
181 * panfrost_copy_in_sync() - Sets up job->deps with the sync objects
203 in_fence_count = args->in_sync_count; in panfrost_copy_in_sync()
210 ret = -ENOMEM; in panfrost_copy_in_sync()
216 (void __user *)(uintptr_t)args->in_syncs, in panfrost_copy_in_sync()
218 ret = -EFAULT; in panfrost_copy_in_sync()
224 ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in panfrost_copy_in_sync()
238 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_submit()
239 struct panfrost_file_priv *file_priv = file->driver_priv; in panfrost_ioctl_submit()
245 if (!args->jc) in panfrost_ioctl_submit()
246 return -EINVAL; in panfrost_ioctl_submit()
248 if (args->requirements && args->requirements != PANFROST_JD_REQ_FS) in panfrost_ioctl_submit()
249 return -EINVAL; in panfrost_ioctl_submit()
251 if (args->out_sync > 0) { in panfrost_ioctl_submit()
252 sync_out = drm_syncobj_find(file, args->out_sync); in panfrost_ioctl_submit()
254 return -ENODEV; in panfrost_ioctl_submit()
259 ret = -ENOMEM; in panfrost_ioctl_submit()
263 kref_init(&job->refcount); in panfrost_ioctl_submit()
265 job->pfdev = pfdev; in panfrost_ioctl_submit()
266 job->jc = args->jc; in panfrost_ioctl_submit()
267 job->requirements = args->requirements; in panfrost_ioctl_submit()
268 job->flush_id = panfrost_gpu_get_latest_flush_id(pfdev); in panfrost_ioctl_submit()
269 job->mmu = file_priv->mmu; in panfrost_ioctl_submit()
273 ret = drm_sched_job_init(&job->base, in panfrost_ioctl_submit()
274 &file_priv->sched_entity[slot], in panfrost_ioctl_submit()
293 drm_syncobj_replace_fence(sync_out, job->render_done_fence); in panfrost_ioctl_submit()
297 drm_sched_job_cleanup(&job->base); in panfrost_ioctl_submit()
314 unsigned long timeout = drm_timeout_abs_to_jiffies(args->timeout_ns); in panfrost_ioctl_wait_bo()
316 if (args->pad) in panfrost_ioctl_wait_bo()
317 return -EINVAL; in panfrost_ioctl_wait_bo()
319 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_wait_bo()
321 return -ENOENT; in panfrost_ioctl_wait_bo()
323 ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ, in panfrost_ioctl_wait_bo()
326 ret = timeout ? -ETIMEDOUT : -EBUSY; in panfrost_ioctl_wait_bo()
340 if (args->flags != 0) { in panfrost_ioctl_mmap_bo()
341 DRM_INFO("unknown mmap_bo flags: %d\n", args->flags); in panfrost_ioctl_mmap_bo()
342 return -EINVAL; in panfrost_ioctl_mmap_bo()
345 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_mmap_bo()
347 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_mmap_bo()
348 return -ENOENT; in panfrost_ioctl_mmap_bo()
352 if (to_panfrost_bo(gem_obj)->is_heap) { in panfrost_ioctl_mmap_bo()
353 ret = -EINVAL; in panfrost_ioctl_mmap_bo()
359 args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); in panfrost_ioctl_mmap_bo()
369 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_ioctl_get_bo_offset()
375 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_get_bo_offset()
377 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_get_bo_offset()
378 return -ENOENT; in panfrost_ioctl_get_bo_offset()
386 return -EINVAL; in panfrost_ioctl_get_bo_offset()
388 args->offset = mapping->mmnode.start << PAGE_SHIFT; in panfrost_ioctl_get_bo_offset()
396 struct panfrost_file_priv *priv = file_priv->driver_priv; in panfrost_ioctl_madvise()
398 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_madvise()
403 gem_obj = drm_gem_object_lookup(file_priv, args->handle); in panfrost_ioctl_madvise()
405 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); in panfrost_ioctl_madvise()
406 return -ENOENT; in panfrost_ioctl_madvise()
411 ret = dma_resv_lock_interruptible(bo->base.base.resv, NULL); in panfrost_ioctl_madvise()
415 mutex_lock(&pfdev->shrinker_lock); in panfrost_ioctl_madvise()
416 mutex_lock(&bo->mappings.lock); in panfrost_ioctl_madvise()
417 if (args->madv == PANFROST_MADV_DONTNEED) { in panfrost_ioctl_madvise()
420 first = list_first_entry(&bo->mappings.list, in panfrost_ioctl_madvise()
432 if (!list_is_singular(&bo->mappings.list) || in panfrost_ioctl_madvise()
433 WARN_ON_ONCE(first->mmu != priv->mmu)) { in panfrost_ioctl_madvise()
434 ret = -EINVAL; in panfrost_ioctl_madvise()
439 args->retained = drm_gem_shmem_madvise(&bo->base, args->madv); in panfrost_ioctl_madvise()
441 if (args->retained) { in panfrost_ioctl_madvise()
442 if (args->madv == PANFROST_MADV_DONTNEED) in panfrost_ioctl_madvise()
443 list_move_tail(&bo->base.madv_list, in panfrost_ioctl_madvise()
444 &pfdev->shrinker_list); in panfrost_ioctl_madvise()
445 else if (args->madv == PANFROST_MADV_WILLNEED) in panfrost_ioctl_madvise()
446 list_del_init(&bo->base.madv_list); in panfrost_ioctl_madvise()
450 mutex_unlock(&bo->mappings.lock); in panfrost_ioctl_madvise()
451 mutex_unlock(&pfdev->shrinker_lock); in panfrost_ioctl_madvise()
452 dma_resv_unlock(bo->base.base.resv); in panfrost_ioctl_madvise()
461 return -ENOSYS; in panfrost_unstable_ioctl_check()
470 struct panfrost_device *pfdev = dev->dev_private; in panfrost_open()
475 return -ENOMEM; in panfrost_open()
477 panfrost_priv->pfdev = pfdev; in panfrost_open()
478 file->driver_priv = panfrost_priv; in panfrost_open()
480 panfrost_priv->mmu = panfrost_mmu_ctx_create(pfdev); in panfrost_open()
481 if (IS_ERR(panfrost_priv->mmu)) { in panfrost_open()
482 ret = PTR_ERR(panfrost_priv->mmu); in panfrost_open()
493 panfrost_mmu_ctx_put(panfrost_priv->mmu); in panfrost_open()
502 struct panfrost_file_priv *panfrost_priv = file->driver_priv; in panfrost_postclose()
507 panfrost_mmu_ctx_put(panfrost_priv->mmu); in panfrost_postclose()
530 * - 1.0 - initial interface
531 * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
532 * - 1.2 - adds AFBC_FEATURES query
557 pfdev = devm_kzalloc(&pdev->dev, sizeof(*pfdev), GFP_KERNEL); in panfrost_probe()
559 return -ENOMEM; in panfrost_probe()
561 pfdev->pdev = pdev; in panfrost_probe()
562 pfdev->dev = &pdev->dev; in panfrost_probe()
566 pfdev->comp = of_device_get_match_data(&pdev->dev); in panfrost_probe()
567 if (!pfdev->comp) in panfrost_probe()
568 return -ENODEV; in panfrost_probe()
570 pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT; in panfrost_probe()
573 ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev); in panfrost_probe()
577 ddev->dev_private = pfdev; in panfrost_probe()
578 pfdev->ddev = ddev; in panfrost_probe()
580 mutex_init(&pfdev->shrinker_lock); in panfrost_probe()
581 INIT_LIST_HEAD(&pfdev->shrinker_list); in panfrost_probe()
585 if (err != -EPROBE_DEFER) in panfrost_probe()
586 dev_err(&pdev->dev, "Fatal error during GPU init\n"); in panfrost_probe()
590 pm_runtime_set_active(pfdev->dev); in panfrost_probe()
591 pm_runtime_mark_last_busy(pfdev->dev); in panfrost_probe()
592 pm_runtime_enable(pfdev->dev); in panfrost_probe()
593 pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ in panfrost_probe()
594 pm_runtime_use_autosuspend(pfdev->dev); in panfrost_probe()
609 pm_runtime_disable(pfdev->dev); in panfrost_probe()
611 pm_runtime_set_suspended(pfdev->dev); in panfrost_probe()
620 struct drm_device *ddev = pfdev->ddev; in panfrost_remove()
625 pm_runtime_get_sync(pfdev->dev); in panfrost_remove()
626 pm_runtime_disable(pfdev->dev); in panfrost_remove()
628 pm_runtime_set_suspended(pfdev->dev); in panfrost_remove()
636 * and then initialize num_supplies with ARRAY_SIZE - 1.
638 static const char * const default_supplies[] = { "mali", NULL };
640 .num_supplies = ARRAY_SIZE(default_supplies) - 1,
647 .num_supplies = ARRAY_SIZE(default_supplies) - 1,
654 * keep retro-compatibility with older devicetrees, as DVFS will
660 static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
663 .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies) - 1,
669 static const char * const mediatek_mt8183_b_supplies[] = { "mali", NULL };
671 .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
679 .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
685 static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
689 .num_supplies = ARRAY_SIZE(mediatek_mt8192_supplies) - 1,
697 { .compatible = "amlogic,meson-gxm-mali",
699 { .compatible = "amlogic,meson-g12a-mali",
701 { .compatible = "arm,mali-t604", .data = &default_data, },
702 { .compatible = "arm,mali-t624", .data = &default_data, },
703 { .compatible = "arm,mali-t628", .data = &default_data, },
704 { .compatible = "arm,mali-t720", .data = &default_data, },
705 { .compatible = "arm,mali-t760", .data = &default_data, },
706 { .compatible = "arm,mali-t820", .data = &default_data, },
707 { .compatible = "arm,mali-t830", .data = &default_data, },
708 { .compatible = "arm,mali-t860", .data = &default_data, },
709 { .compatible = "arm,mali-t880", .data = &default_data, },
710 { .compatible = "arm,mali-bifrost", .data = &default_data, },
711 { .compatible = "arm,mali-valhall-jm", .data = &default_data, },
712 { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
713 { .compatible = "mediatek,mt8183b-mali", .data = &mediatek_mt8183_b_data },
714 { .compatible = "mediatek,mt8186-mali", .data = &mediatek_mt8186_data },
715 { .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },