drm/xe: Add engine activity support
authorRiana Tauro <riana.tauro@intel.com>
Mon, 24 Feb 2025 05:38:58 +0000 (11:08 +0530)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 24 Feb 2025 20:32:09 +0000 (12:32 -0800)
commitb729ea271e849c88f91ba51208e7ca3fb2f1bc4c
treeb1bbb4fd2fcba46ff72b4a418ef660ea1722b9c0
parent8b4b3af869e981bba6f5c140b41e76b971dad26a
drm/xe: Add engine activity support

GuC provides support to read engine counters to calculate the
engine activity. KMD exposes two counters via the PMU interface to
calculate engine activity

Engine Active Ticks(engine-active-ticks) - active ticks of engine
Engine Total Ticks (engine-total-ticks) - total ticks of engine

Engine activity percentage can be calculated as below
Engine activity % = (engine active ticks/engine total ticks) * 100.

v2: fix cosmetic review comments
    add forcewake for gpm_ts (Umesh)

v3: fix CI hooks error
    change function parameters and unpin bo on error
    of allocate_activity_buffers
    fix kernel-doc (Umesh)
    use engine activity (Umesh, Lucas)
    rename xe_engine_activity to xe_guc_engine_*
    fix commit message to use engine activity (Lucas, Umesh)

v4: add forcewake in PMU layer

v5: fix makefile
    use drmm_kcalloc instead of kmalloc_array
    remove managed bo
    skip init for VF
    fix cosmetic review comments (Michal)

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250224053903.2253539-2-riana.tauro@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/Makefile
drivers/gpu/drm/xe/abi/guc_actions_abi.h
drivers/gpu/drm/xe/regs/xe_gt_regs.h
drivers/gpu/drm/xe/xe_guc_engine_activity.c [new file with mode: 0644]
drivers/gpu/drm/xe/xe_guc_engine_activity.h [new file with mode: 0644]
drivers/gpu/drm/xe/xe_guc_engine_activity_types.h [new file with mode: 0644]
drivers/gpu/drm/xe/xe_guc_fwif.h
drivers/gpu/drm/xe/xe_guc_types.h