drm/panfrost: perfcnt: Reserve/use the AS attached to the perfcnt MMU context
We need to use the AS attached to the opened FD when dumping counters.
Reported-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Fixes: 7282f7645d
("drm/panfrost: Implement per FD address spaces")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Tested-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200206141327.446127-1-boris.brezillon@collabora.com
This commit is contained in:
parent
fe154a2422
commit
dde2bb2da0
2 changed files with 10 additions and 8 deletions
|
@ -151,7 +151,12 @@ u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu)
|
||||||
as = mmu->as;
|
as = mmu->as;
|
||||||
if (as >= 0) {
|
if (as >= 0) {
|
||||||
int en = atomic_inc_return(&mmu->as_count);
|
int en = atomic_inc_return(&mmu->as_count);
|
||||||
WARN_ON(en >= NUM_JOB_SLOTS);
|
|
||||||
|
/*
|
||||||
|
* AS can be retained by active jobs or a perfcnt context,
|
||||||
|
* hence the '+ 1' here.
|
||||||
|
*/
|
||||||
|
WARN_ON(en >= (NUM_JOB_SLOTS + 1));
|
||||||
|
|
||||||
list_move(&mmu->list, &pfdev->as_lru_list);
|
list_move(&mmu->list, &pfdev->as_lru_list);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
|
||||||
struct panfrost_file_priv *user = file_priv->driver_priv;
|
struct panfrost_file_priv *user = file_priv->driver_priv;
|
||||||
struct panfrost_perfcnt *perfcnt = pfdev->perfcnt;
|
struct panfrost_perfcnt *perfcnt = pfdev->perfcnt;
|
||||||
struct drm_gem_shmem_object *bo;
|
struct drm_gem_shmem_object *bo;
|
||||||
u32 cfg;
|
u32 cfg, as;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (user == perfcnt->user)
|
if (user == perfcnt->user)
|
||||||
|
@ -126,12 +126,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
|
||||||
|
|
||||||
perfcnt->user = user;
|
perfcnt->user = user;
|
||||||
|
|
||||||
/*
|
as = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu);
|
||||||
* Always use address space 0 for now.
|
cfg = GPU_PERFCNT_CFG_AS(as) |
|
||||||
* FIXME: this needs to be updated when we start using different
|
|
||||||
* address space.
|
|
||||||
*/
|
|
||||||
cfg = GPU_PERFCNT_CFG_AS(0) |
|
|
||||||
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_MANUAL);
|
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_MANUAL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,6 +191,7 @@ static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev,
|
||||||
drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base.base, perfcnt->buf);
|
drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base.base, perfcnt->buf);
|
||||||
perfcnt->buf = NULL;
|
perfcnt->buf = NULL;
|
||||||
panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv);
|
panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv);
|
||||||
|
panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
|
||||||
panfrost_gem_mapping_put(perfcnt->mapping);
|
panfrost_gem_mapping_put(perfcnt->mapping);
|
||||||
perfcnt->mapping = NULL;
|
perfcnt->mapping = NULL;
|
||||||
pm_runtime_mark_last_busy(pfdev->dev);
|
pm_runtime_mark_last_busy(pfdev->dev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue