Skip to content

Commit dde2bb2

Browse files
bbrezillonrobherring
authored andcommitted
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 <[email protected]> Fixes: 7282f76 ("drm/panfrost: Implement per FD address spaces") Cc: <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Steven Price <[email protected]> Tested-by: Antonio Caggiano <[email protected]> Signed-off-by: Rob Herring <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fe154a2 commit dde2bb2

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/gpu/drm/panfrost/panfrost_mmu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu)
151151
as = mmu->as;
152152
if (as >= 0) {
153153
int en = atomic_inc_return(&mmu->as_count);
154-
WARN_ON(en >= NUM_JOB_SLOTS);
154+
155+
/*
156+
* AS can be retained by active jobs or a perfcnt context,
157+
* hence the '+ 1' here.
158+
*/
159+
WARN_ON(en >= (NUM_JOB_SLOTS + 1));
155160

156161
list_move(&mmu->list, &pfdev->as_lru_list);
157162
goto out;

drivers/gpu/drm/panfrost/panfrost_perfcnt.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
7373
struct panfrost_file_priv *user = file_priv->driver_priv;
7474
struct panfrost_perfcnt *perfcnt = pfdev->perfcnt;
7575
struct drm_gem_shmem_object *bo;
76-
u32 cfg;
76+
u32 cfg, as;
7777
int ret;
7878

7979
if (user == perfcnt->user)
@@ -126,12 +126,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
126126

127127
perfcnt->user = user;
128128

129-
/*
130-
* Always use address space 0 for now.
131-
* FIXME: this needs to be updated when we start using different
132-
* address space.
133-
*/
134-
cfg = GPU_PERFCNT_CFG_AS(0) |
129+
as = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu);
130+
cfg = GPU_PERFCNT_CFG_AS(as) |
135131
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_MANUAL);
136132

137133
/*
@@ -195,6 +191,7 @@ static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev,
195191
drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base.base, perfcnt->buf);
196192
perfcnt->buf = NULL;
197193
panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv);
194+
panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
198195
panfrost_gem_mapping_put(perfcnt->mapping);
199196
perfcnt->mapping = NULL;
200197
pm_runtime_mark_last_busy(pfdev->dev);

0 commit comments

Comments
 (0)