mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/panfrost: Handle error when allocating AS number
If we reach the beginning of the LRU AS list, then return an error. Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> Link: https://lore.kernel.org/r/20251019145225.3621989-5-adrian.larumbe@collabora.com Signed-off-by: Steven Price <steven.price@arm.com>
This commit is contained in:
committed by
Steven Price
parent
616c5b6fe3
commit
f45f73c68c
@@ -217,7 +217,11 @@ static int panfrost_job_hw_submit(struct panfrost_job *job, int js)
|
||||
goto err_hwsubmit;
|
||||
}
|
||||
|
||||
cfg = panfrost_mmu_as_get(pfdev, job->mmu);
|
||||
ret = panfrost_mmu_as_get(pfdev, job->mmu);
|
||||
if (ret < 0)
|
||||
goto err_hwsubmit;
|
||||
|
||||
cfg = ret;
|
||||
|
||||
panfrost_devfreq_record_busy(&pfdev->pfdevfreq);
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ static int panfrost_mmu_cfg_init(struct panfrost_mmu *mmu,
|
||||
}
|
||||
}
|
||||
|
||||
u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu)
|
||||
int panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu)
|
||||
{
|
||||
int as;
|
||||
|
||||
@@ -300,7 +300,10 @@ u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu)
|
||||
if (!atomic_read(&lru_mmu->as_count))
|
||||
break;
|
||||
}
|
||||
WARN_ON(&lru_mmu->list == &pfdev->as_lru_list);
|
||||
if (WARN_ON(&lru_mmu->list == &pfdev->as_lru_list)) {
|
||||
as = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_del_init(&lru_mmu->list);
|
||||
as = lru_mmu->as;
|
||||
|
||||
@@ -16,7 +16,7 @@ void panfrost_mmu_fini(struct panfrost_device *pfdev);
|
||||
void panfrost_mmu_reset(struct panfrost_device *pfdev);
|
||||
void panfrost_mmu_suspend_irq(struct panfrost_device *pfdev);
|
||||
|
||||
u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu);
|
||||
int panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu);
|
||||
void panfrost_mmu_as_put(struct panfrost_device *pfdev, struct panfrost_mmu *mmu);
|
||||
|
||||
struct panfrost_mmu *panfrost_mmu_ctx_get(struct panfrost_mmu *mmu);
|
||||
|
||||
@@ -130,9 +130,11 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
|
||||
goto err_vunmap;
|
||||
}
|
||||
|
||||
perfcnt->user = user;
|
||||
ret = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu);
|
||||
if (ret < 0)
|
||||
goto err_vunmap;
|
||||
|
||||
as = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu);
|
||||
as = ret;
|
||||
cfg = GPU_PERFCNT_CFG_AS(as) |
|
||||
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_MANUAL);
|
||||
|
||||
@@ -164,6 +166,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
|
||||
/* The BO ref is retained by the mapping. */
|
||||
drm_gem_object_put(&bo->base);
|
||||
|
||||
perfcnt->user = user;
|
||||
|
||||
return 0;
|
||||
|
||||
err_vunmap:
|
||||
|
||||
Reference in New Issue
Block a user