/* * Invalidate the cache and clear the counters to start from a fresh * state.
*/
reinit_completion(&pfdev->perfcnt->dump_comp);
gpu_write(pfdev, GPU_INT_CLEAR,
GPU_IRQ_CLEAN_CACHES_COMPLETED |
GPU_IRQ_PERFCNT_SAMPLE_COMPLETED);
gpu_write(pfdev, GPU_CMD, GPU_CMD_PERFCNT_CLEAR);
gpu_write(pfdev, GPU_CMD, GPU_CMD_CLEAN_INV_CACHES);
ret = wait_for_completion_timeout(&pfdev->perfcnt->dump_comp,
msecs_to_jiffies(1000)); if (!ret) {
ret = -ETIMEDOUT; goto err_vunmap;
}
perfcnt->user = user;
as = panfrost_mmu_as_get(pfdev, perfcnt->mapping->mmu);
cfg = GPU_PERFCNT_CFG_AS(as) |
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_MANUAL);
/* * Bifrost GPUs have 2 set of counters, but we're only interested by * the first one for now.
*/ if (panfrost_model_is_bifrost(pfdev))
cfg |= GPU_PERFCNT_CFG_SETSEL(counterset);
/* * Due to PRLAM-8186 we need to disable the Tiler before we enable HW * counters.
*/ if (panfrost_has_hw_issue(pfdev, HW_ISSUE_8186))
gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0); else
gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff);
gpu_write(pfdev, GPU_PERFCNT_CFG, cfg);
if (panfrost_has_hw_issue(pfdev, HW_ISSUE_8186))
gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff);
/* The BO ref is retained by the mapping. */
drm_gem_object_put(&bo->base);
ret = panfrost_unstable_ioctl_check(); if (ret) return ret;
/* Only Bifrost GPUs have 2 set of counters. */ if (req->counterset > (panfrost_model_is_bifrost(pfdev) ? 1 : 0)) return -EINVAL;
mutex_lock(&perfcnt->lock); if (req->enable)
ret = panfrost_perfcnt_enable_locked(pfdev, file_priv,
req->counterset); else
ret = panfrost_perfcnt_disable_locked(pfdev, file_priv);
mutex_unlock(&perfcnt->lock);
/* * TODO: define a macro to extract the number of l2 caches from * mem_features.
*/
nl2c = ((pfdev->features.mem_features >> 8) & GENMASK(3, 0)) + 1;
/* * shader_present might be sparse, but the counters layout * forces to dump unused regions too, hence the fls64() call * instead of hweight64().
*/
ncores = fls64(pfdev->features.shader_present);
/* * There's always one JM and one Tiler block, hence the '+ 2' * here.
*/
size = (nl2c + ncores + 2) *
COUNTERS_PER_BLOCK * BYTES_PER_COUNTER;
}
perfcnt = devm_kzalloc(pfdev->dev, sizeof(*perfcnt), GFP_KERNEL); if (!perfcnt) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.