mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-08-22 00:42:01 +02:00

Add stats for tlb invalidation count which can be viewed with per GT stat debugfs file. Example output: cat /sys/kernel/debug/dri/0/gt0/stats tlb_inval_count: 22 v2: fix #include order(Tejas) Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com> Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240810191522.18616-2-nirmoy.das@intel.com Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2024 Intel Corporation
|
|
*/
|
|
|
|
#include <linux/atomic.h>
|
|
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "xe_gt.h"
|
|
#include "xe_gt_stats.h"
|
|
|
|
/**
|
|
* xe_gt_stats_incr - Increments the specified stats counter
|
|
* @gt: graphics tile
|
|
* @id: xe_gt_stats_id type id that needs to be incremented
|
|
* @incr: value to be incremented with
|
|
*
|
|
* Increments the specified stats counter.
|
|
*/
|
|
void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr)
|
|
{
|
|
if (id >= __XE_GT_STATS_NUM_IDS)
|
|
return;
|
|
|
|
atomic_add(incr, >->stats.counters[id]);
|
|
}
|
|
|
|
static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
|
|
"tlb_inval_count",
|
|
};
|
|
|
|
/**
|
|
* xe_gt_stats_print_info - Print the GT stats
|
|
* @gt: graphics tile
|
|
* @p: drm_printer where it will be printed out.
|
|
*
|
|
* This prints out all the available GT stats.
|
|
*/
|
|
int xe_gt_stats_print_info(struct xe_gt *gt, struct drm_printer *p)
|
|
{
|
|
enum xe_gt_stats_id id;
|
|
|
|
for (id = 0; id < __XE_GT_STATS_NUM_IDS; ++id)
|
|
drm_printf(p, "%s: %d\n", stat_description[id],
|
|
atomic_read(>->stats.counters[id]));
|
|
|
|
return 0;
|
|
}
|