1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2024 Intel Corporation 4 */ 5 6 #include <linux/atomic.h> 7 8 #include <drm/drm_print.h> 9 10 #include "xe_gt.h" 11 #include "xe_gt_stats.h" 12 13 /** 14 * xe_gt_stats_incr - Increments the specified stats counter 15 * @gt: graphics tile 16 * @id: xe_gt_stats_id type id that needs to be incremented 17 * @incr: value to be incremented with 18 * 19 * Increments the specified stats counter. 20 */ 21 void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr) 22 { 23 if (id >= __XE_GT_STATS_NUM_IDS) 24 return; 25 26 atomic_add(incr, >->stats.counters[id]); 27 } 28 29 static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = { 30 "tlb_inval_count", 31 }; 32 33 /** 34 * xe_gt_stats_print_info - Print the GT stats 35 * @gt: graphics tile 36 * @p: drm_printer where it will be printed out. 37 * 38 * This prints out all the available GT stats. 39 */ 40 int xe_gt_stats_print_info(struct xe_gt *gt, struct drm_printer *p) 41 { 42 enum xe_gt_stats_id id; 43 44 for (id = 0; id < __XE_GT_STATS_NUM_IDS; ++id) 45 drm_printf(p, "%s: %d\n", stat_description[id], 46 atomic_read(>->stats.counters[id])); 47 48 return 0; 49 } 50