Skip to content

Commit

Permalink
Sun Jun 23 16:43:41 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 e33d9b7 commit 9838f6e
Show file tree
Hide file tree
Showing 14 changed files with 173 additions and 471 deletions.
6 changes: 2 additions & 4 deletions bsp/drivers/gpu/panfrost/panfrost_devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,8 @@ 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)) {
ret = PTR_ERR(opp);
goto err_opp_out;
}
if (IS_ERR(opp))
return PTR_ERR(opp);

panfrost_devfreq_profile.initial_freq = cur_freq;

Expand Down
9 changes: 7 additions & 2 deletions bsp/drivers/gpu/panfrost/panfrost_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "panfrost_device.h"
#include "panfrost_devfreq.h"
#include "panfrost_features.h"
#include "panfrost_issues.h"
#include "panfrost_gpu.h"
#include "panfrost_job.h"
#include "panfrost_mmu.h"
Expand Down Expand Up @@ -472,9 +473,13 @@ const char *panfrost_exception_name(u32 exception_code)
bool panfrost_exception_needs_reset(const struct panfrost_device *pfdev,
u32 exception_code)
{
/* Right now, none of the GPU we support need a reset, but this
* might change.
/* If an occlusion query write causes a bus fault on affected GPUs,
* future fragment jobs may hang. Reset to workaround.
*/
if (exception_code == DRM_PANFROST_EXCEPTION_JOB_BUS_FAULT)
return panfrost_has_hw_issue(pfdev, HW_ISSUE_TTRX_3076);

/* No other GPUs we support need a reset */
return false;
}

Expand Down
69 changes: 35 additions & 34 deletions bsp/drivers/gpu/panfrost/panfrost_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ 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 @@ -99,29 +98,21 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
!(args->flags & PANFROST_BO_NOEXEC))
return -EINVAL;

bo = panfrost_gem_create(dev, args->size, args->flags);
bo = panfrost_gem_create_with_handle(file, dev, args->size, args->flags,
&args->handle);
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) {
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;
if (!mapping) {
drm_gem_object_put(&bo->base.base);
return -EINVAL;
}

out:
drm_gem_object_put(&bo->base.base);
return ret;
args->offset = mapping->mmnode.start << PAGE_SHIFT;
panfrost_gem_mapping_put(mapping);

return 0;
}

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

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

if (ret)
goto fail;
Expand All @@ -251,7 +242,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;
int ret = 0, slot;

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

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 fail_job;
goto out_cleanup_job;

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

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

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

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

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

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

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

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

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

const char * const mediatek_mt8183_supplies[] = { "mali", "sram" };
const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
static const char * const mediatek_mt8183_supplies[] = { "mali", "sram" };
static 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 9838f6e

Please sign in to comment.