Skip to content

Commit

Permalink
Sun Jun 23 17:13:56 UTC 2024 Kernel update
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 23, 2024
1 parent 9838f6e commit 80c3846
Show file tree
Hide file tree
Showing 11 changed files with 345 additions and 127 deletions.
6 changes: 4 additions & 2 deletions bsp/drivers/gpu/panfrost/panfrost_devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
cur_freq = clk_get_rate(pfdev->clock);

opp = devfreq_recommended_opp(dev, &cur_freq, 0);
if (IS_ERR(opp))
return PTR_ERR(opp);
if (IS_ERR(opp)) {
ret = PTR_ERR(opp);
goto err_opp_out;
}

panfrost_devfreq_profile.initial_freq = cur_freq;

Expand Down
69 changes: 34 additions & 35 deletions bsp/drivers/gpu/panfrost/panfrost_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
struct panfrost_gem_object *bo;
struct drm_panfrost_create_bo *args = data;
struct panfrost_gem_mapping *mapping;
int ret;

if (!args->size || args->pad ||
(args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP)))
Expand All @@ -98,21 +99,29 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
!(args->flags & PANFROST_BO_NOEXEC))
return -EINVAL;

bo = panfrost_gem_create_with_handle(file, dev, args->size, args->flags,
&args->handle);
bo = panfrost_gem_create(dev, args->size, args->flags);
if (IS_ERR(bo))
return PTR_ERR(bo);

ret = drm_gem_handle_create(file, &bo->base.base, &args->handle);
if (ret)
goto out;

mapping = panfrost_gem_mapping_get(bo, priv);
if (!mapping) {
drm_gem_object_put(&bo->base.base);
return -EINVAL;
if (mapping) {
args->offset = mapping->mmnode.start << PAGE_SHIFT;
panfrost_gem_mapping_put(mapping);
} else {
/* This can only happen if the handle from
* drm_gem_handle_create() has already been guessed and freed
* by user space
*/
ret = -EINVAL;
}

args->offset = mapping->mmnode.start << PAGE_SHIFT;
panfrost_gem_mapping_put(mapping);

return 0;
out:
drm_gem_object_put(&bo->base.base);
return ret;
}

/**
Expand Down Expand Up @@ -224,7 +233,7 @@ panfrost_copy_in_sync(struct drm_device *dev,
if (ret)
goto fail;

ret = drm_sched_job_add_dependency(&job->base, fence);
ret = drm_gem_fence_array_add(&job->deps, fence);

if (ret)
goto fail;
Expand All @@ -242,7 +251,7 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
struct drm_panfrost_submit *args = data;
struct drm_syncobj *sync_out = NULL;
struct panfrost_job *job;
int ret = 0, slot;
int ret = 0;

if (!args->jc)
return -EINVAL;
Expand All @@ -259,47 +268,38 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
job = kzalloc(sizeof(*job), GFP_KERNEL);
if (!job) {
ret = -ENOMEM;
goto out_put_syncout;
goto fail_out_sync;
}

kref_init(&job->refcount);

xa_init_flags(&job->deps, XA_FLAGS_ALLOC);

job->pfdev = pfdev;
job->jc = args->jc;
job->requirements = args->requirements;
job->flush_id = panfrost_gpu_get_latest_flush_id(pfdev);
job->file_priv = file->driver_priv;

slot = panfrost_job_get_slot(job);

ret = drm_sched_job_init(&job->base,
&job->file_priv->sched_entity[slot],
NULL);
if (ret)
goto out_put_job;

ret = panfrost_copy_in_sync(dev, file, args, job);
if (ret)
goto out_cleanup_job;
goto fail_job;

ret = panfrost_lookup_bos(dev, file, args, job);
if (ret)
goto out_cleanup_job;
goto fail_job;

ret = panfrost_job_push(job);
if (ret)
goto out_cleanup_job;
goto fail_job;

/* Update the return sync object for the job */
if (sync_out)
drm_syncobj_replace_fence(sync_out, job->render_done_fence);

out_cleanup_job:
if (ret)
drm_sched_job_cleanup(&job->base);
out_put_job:
fail_job:
panfrost_job_put(job);
out_put_syncout:
fail_out_sync:
if (sync_out)
drm_syncobj_put(sync_out);

Expand All @@ -322,8 +322,7 @@ panfrost_ioctl_wait_bo(struct drm_device *dev, void *data,
if (!gem_obj)
return -ENOENT;

ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ,
true, timeout);
ret = dma_resv_wait_timeout(gem_obj->resv, true, true, timeout);
if (!ret)
ret = timeout ? -ETIMEDOUT : -EBUSY;

Expand Down Expand Up @@ -440,8 +439,8 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,
#endif
if (args->retained) {
if (args->madv == PANFROST_MADV_DONTNEED)
list_add_tail(&bo->base.madv_list,
&pfdev->shrinker_list);
list_move_tail(&bo->base.madv_list,
&pfdev->shrinker_list);
else if (args->madv == PANFROST_MADV_WILLNEED)
list_del_init(&bo->base.madv_list);
}
Expand Down Expand Up @@ -575,7 +574,7 @@ static int panfrost_probe(struct platform_device *pdev)

pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT;

/* Allocate and initialize the DRM device. */
/* Allocate and initialze the DRM device. */
ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev);
if (IS_ERR(ddev))
return PTR_ERR(ddev);
Expand Down Expand Up @@ -651,8 +650,8 @@ static const struct panfrost_compatible amlogic_data = {
.vendor_quirk = panfrost_gpu_amlogic_quirk,
};

static const char * const mediatek_mt8183_supplies[] = { "mali", "sram" };
static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
const char * const mediatek_mt8183_supplies[] = { "mali", "sram" };
const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
static const struct panfrost_compatible mediatek_mt8183_data = {
.num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies),
.supply_names = mediatek_mt8183_supplies,
Expand Down
Loading

0 comments on commit 80c3846

Please sign in to comment.