Lines Matching refs:pfdev
36 void panfrost_perfcnt_clean_cache_done(struct panfrost_device *pfdev) in panfrost_perfcnt_clean_cache_done() argument
38 complete(&pfdev->perfcnt->dump_comp); in panfrost_perfcnt_clean_cache_done()
41 void panfrost_perfcnt_sample_done(struct panfrost_device *pfdev) in panfrost_perfcnt_sample_done() argument
43 gpu_write(pfdev, GPU_CMD, GPU_CMD_CLEAN_CACHES); in panfrost_perfcnt_sample_done()
46 static int panfrost_perfcnt_dump_locked(struct panfrost_device *pfdev) in panfrost_perfcnt_dump_locked() argument
51 reinit_completion(&pfdev->perfcnt->dump_comp); in panfrost_perfcnt_dump_locked()
52 gpuva = pfdev->perfcnt->mapping->mmnode.start << PAGE_SHIFT; in panfrost_perfcnt_dump_locked()
53 gpu_write(pfdev, GPU_PERFCNT_BASE_LO, gpuva); in panfrost_perfcnt_dump_locked()
54 gpu_write(pfdev, GPU_PERFCNT_BASE_HI, gpuva >> 32); in panfrost_perfcnt_dump_locked()
55 gpu_write(pfdev, GPU_INT_CLEAR, in panfrost_perfcnt_dump_locked()
58 gpu_write(pfdev, GPU_CMD, GPU_CMD_PERFCNT_SAMPLE); in panfrost_perfcnt_dump_locked()
59 ret = wait_for_completion_interruptible_timeout(&pfdev->perfcnt->dump_comp, in panfrost_perfcnt_dump_locked()
69 static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, in panfrost_perfcnt_enable_locked() argument
74 struct panfrost_perfcnt *perfcnt = pfdev->perfcnt; in panfrost_perfcnt_enable_locked()
84 ret = pm_runtime_get_sync(pfdev->dev); in panfrost_perfcnt_enable_locked()
88 bo = drm_gem_shmem_create(pfdev->ddev, perfcnt->bosize); in panfrost_perfcnt_enable_locked()
116 reinit_completion(&pfdev->perfcnt->dump_comp); in panfrost_perfcnt_enable_locked()
117 gpu_write(pfdev, GPU_INT_CLEAR, in panfrost_perfcnt_enable_locked()
120 gpu_write(pfdev, GPU_CMD, GPU_CMD_PERFCNT_CLEAR); in panfrost_perfcnt_enable_locked()
121 gpu_write(pfdev, GPU_CMD, GPU_CMD_CLEAN_INV_CACHES); in panfrost_perfcnt_enable_locked()
122 ret = wait_for_completion_timeout(&pfdev->perfcnt->dump_comp, in panfrost_perfcnt_enable_locked()
131 as = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu); in panfrost_perfcnt_enable_locked()
139 if (panfrost_model_is_bifrost(pfdev)) in panfrost_perfcnt_enable_locked()
142 gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0xffffffff); in panfrost_perfcnt_enable_locked()
143 gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0xffffffff); in panfrost_perfcnt_enable_locked()
144 gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0xffffffff); in panfrost_perfcnt_enable_locked()
150 if (panfrost_has_hw_issue(pfdev, HW_ISSUE_8186)) in panfrost_perfcnt_enable_locked()
151 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); in panfrost_perfcnt_enable_locked()
153 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff); in panfrost_perfcnt_enable_locked()
155 gpu_write(pfdev, GPU_PERFCNT_CFG, cfg); in panfrost_perfcnt_enable_locked()
157 if (panfrost_has_hw_issue(pfdev, HW_ISSUE_8186)) in panfrost_perfcnt_enable_locked()
158 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff); in panfrost_perfcnt_enable_locked()
174 pm_runtime_put(pfdev->dev); in panfrost_perfcnt_enable_locked()
178 static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev, in panfrost_perfcnt_disable_locked() argument
182 struct panfrost_perfcnt *perfcnt = pfdev->perfcnt; in panfrost_perfcnt_disable_locked()
187 gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0x0); in panfrost_perfcnt_disable_locked()
188 gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0x0); in panfrost_perfcnt_disable_locked()
189 gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0x0); in panfrost_perfcnt_disable_locked()
190 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); in panfrost_perfcnt_disable_locked()
191 gpu_write(pfdev, GPU_PERFCNT_CFG, in panfrost_perfcnt_disable_locked()
198 panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu); in panfrost_perfcnt_disable_locked()
201 pm_runtime_mark_last_busy(pfdev->dev); in panfrost_perfcnt_disable_locked()
202 pm_runtime_put_autosuspend(pfdev->dev); in panfrost_perfcnt_disable_locked()
210 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_perfcnt_enable() local
211 struct panfrost_perfcnt *perfcnt = pfdev->perfcnt; in panfrost_ioctl_perfcnt_enable()
220 if (req->counterset > (panfrost_model_is_bifrost(pfdev) ? 1 : 0)) in panfrost_ioctl_perfcnt_enable()
225 ret = panfrost_perfcnt_enable_locked(pfdev, file_priv, in panfrost_ioctl_perfcnt_enable()
228 ret = panfrost_perfcnt_disable_locked(pfdev, file_priv); in panfrost_ioctl_perfcnt_enable()
237 struct panfrost_device *pfdev = dev->dev_private; in panfrost_ioctl_perfcnt_dump() local
238 struct panfrost_perfcnt *perfcnt = pfdev->perfcnt; in panfrost_ioctl_perfcnt_dump()
253 ret = panfrost_perfcnt_dump_locked(pfdev); in panfrost_ioctl_perfcnt_dump()
269 struct panfrost_device *pfdev = pfile->pfdev; in panfrost_perfcnt_close() local
270 struct panfrost_perfcnt *perfcnt = pfdev->perfcnt; in panfrost_perfcnt_close()
272 pm_runtime_get_sync(pfdev->dev); in panfrost_perfcnt_close()
275 panfrost_perfcnt_disable_locked(pfdev, file_priv); in panfrost_perfcnt_close()
277 pm_runtime_mark_last_busy(pfdev->dev); in panfrost_perfcnt_close()
278 pm_runtime_put_autosuspend(pfdev->dev); in panfrost_perfcnt_close()
281 int panfrost_perfcnt_init(struct panfrost_device *pfdev) in panfrost_perfcnt_init() argument
286 if (panfrost_has_hw_feature(pfdev, HW_FEATURE_V4)) { in panfrost_perfcnt_init()
289 ncoregroups = hweight64(pfdev->features.l2_present); in panfrost_perfcnt_init()
299 nl2c = ((pfdev->features.mem_features >> 8) & GENMASK(3, 0)) + 1; in panfrost_perfcnt_init()
306 ncores = fls64(pfdev->features.shader_present); in panfrost_perfcnt_init()
316 perfcnt = devm_kzalloc(pfdev->dev, sizeof(*perfcnt), GFP_KERNEL); in panfrost_perfcnt_init()
323 gpu_write(pfdev, GPU_PERFCNT_CFG, in panfrost_perfcnt_init()
325 gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0); in panfrost_perfcnt_init()
326 gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0); in panfrost_perfcnt_init()
327 gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0); in panfrost_perfcnt_init()
328 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); in panfrost_perfcnt_init()
332 pfdev->perfcnt = perfcnt; in panfrost_perfcnt_init()
337 void panfrost_perfcnt_fini(struct panfrost_device *pfdev) in panfrost_perfcnt_fini() argument
340 gpu_write(pfdev, GPU_PERFCNT_CFG, in panfrost_perfcnt_fini()
342 gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0); in panfrost_perfcnt_fini()
343 gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0); in panfrost_perfcnt_fini()
344 gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0); in panfrost_perfcnt_fini()
345 gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); in panfrost_perfcnt_fini()