1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2025 Intel Corporation 4 */ 5 6 #ifndef _XE_GUC_ENGINE_ACTIVITY_TYPES_H_ 7 #define _XE_GUC_ENGINE_ACTIVITY_TYPES_H_ 8 9 #include <linux/types.h> 10 11 #include "xe_guc_fwif.h" 12 /** 13 * struct engine_activity - Engine specific activity data 14 * 15 * Contains engine specific activity data and snapshot of the 16 * structures from GuC 17 */ 18 struct engine_activity { 19 /** @active: current activity */ 20 u64 active; 21 22 /** @last_cpu_ts: cpu timestamp in nsec of previous sample */ 23 u64 last_cpu_ts; 24 25 /** @quanta: total quanta used on HW */ 26 u64 quanta; 27 28 /** @quanta_ns: total quanta_ns used on HW */ 29 u64 quanta_ns; 30 31 /** 32 * @quanta_remainder_ns: remainder when the CPU time is scaled as 33 * per the quanta_ratio. This remainder is used in subsequent 34 * quanta calculations. 35 */ 36 u64 quanta_remainder_ns; 37 38 /** @total: total engine activity */ 39 u64 total; 40 41 /** @running: true if engine is running some work */ 42 bool running; 43 44 /** @metadata: snapshot of engine activity metadata */ 45 struct guc_engine_activity_metadata metadata; 46 47 /** @activity: snapshot of engine activity counter */ 48 struct guc_engine_activity activity; 49 }; 50 51 /** 52 * struct engine_activity_group - Activity data for all engines 53 */ 54 struct engine_activity_group { 55 /** @engine: engine specific activity data */ 56 struct engine_activity engine[GUC_MAX_ENGINE_CLASSES][GUC_MAX_INSTANCES_PER_CLASS]; 57 }; 58 59 /** 60 * struct engine_activity_buffer - engine activity buffers 61 * 62 * This contains the buffers allocated for metadata and activity data 63 */ 64 struct engine_activity_buffer { 65 /** @activity_bo: object allocated to hold activity data */ 66 struct xe_bo *activity_bo; 67 68 /** @metadata_bo: object allocated to hold activity metadata */ 69 struct xe_bo *metadata_bo; 70 }; 71 72 /** 73 * struct xe_guc_engine_activity - Data used by engine activity implementation 74 */ 75 struct xe_guc_engine_activity { 76 /** @gpm_timestamp_shift: Right shift value for the gpm timestamp */ 77 u32 gpm_timestamp_shift; 78 79 /** @num_activity_group: number of activity groups */ 80 u32 num_activity_group; 81 82 /** @supported: indicates support for engine activity stats */ 83 bool supported; 84 85 /** @eag: holds the device level engine activity data */ 86 struct engine_activity_group *eag; 87 88 /** @device_buffer: buffer object for global engine activity */ 89 struct engine_activity_buffer device_buffer; 90 }; 91 #endif 92 93