mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
tools/power/turbostat: Add support for Xe sysfs knobs
Xe graphics driver uses different graphics sysfs knobs including /sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms /sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq /sys/class/drm/card0/device/tile0/gt0/freq0/act_freq /sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms /sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq /sys/class/drm/card0/device/tile0/gt1/freq0/act_freq Plus that, /sys/class/drm/card0/device/tile0/gt<n>/gtidle/name returns either gt<n>-rc or gt<n>-mc. rc is for GFX and mc is SA Media. Enhance turbostat to prefer the Xe sysfs knobs when they are available. Export gt<n>-rc via BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz. Export gt<n>-mc via BIC_SMA_mc6/BIC_SMAMHz/BIC_SMAACTMHz. Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
dc02dc937a
commit
91a91d3895
@ -5380,6 +5380,57 @@ static void probe_intel_uncore_frequency(void)
|
||||
|
||||
static void probe_graphics(void)
|
||||
{
|
||||
/* Xe graphics sysfs knobs */
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms", R_OK)) {
|
||||
FILE *fp;
|
||||
char buf[8];
|
||||
bool gt0_is_gt;
|
||||
int idx;
|
||||
|
||||
fp = fopen("/sys/class/drm/card0/device/tile0/gt0/gtidle/name", "r");
|
||||
if (!fp)
|
||||
goto next;
|
||||
|
||||
if (!fread(buf, sizeof(char), 7, fp)) {
|
||||
fclose(fp);
|
||||
goto next;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
if (!strncmp(buf, "gt0-rc", strlen("gt0-rc")))
|
||||
gt0_is_gt = true;
|
||||
else if (!strncmp(buf, "gt0-mc", strlen("gt0-mc")))
|
||||
gt0_is_gt = false;
|
||||
else
|
||||
goto next;
|
||||
|
||||
idx = gt0_is_gt ? GFX_rc6 : SAM_mc6;
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms";
|
||||
|
||||
idx = gt0_is_gt ? GFX_MHz : SAM_MHz;
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq", R_OK))
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq";
|
||||
|
||||
idx = gt0_is_gt ? GFX_ACTMHz : SAM_ACTMHz;
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt0/freq0/act_freq", R_OK))
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt0/freq0/act_freq";
|
||||
|
||||
idx = gt0_is_gt ? SAM_mc6 : GFX_rc6;
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms", R_OK))
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms";
|
||||
|
||||
idx = gt0_is_gt ? SAM_MHz : GFX_MHz;
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq", R_OK))
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq";
|
||||
|
||||
idx = gt0_is_gt ? SAM_ACTMHz : GFX_ACTMHz;
|
||||
if (!access("/sys/class/drm/card0/device/tile0/gt1/freq0/act_freq", R_OK))
|
||||
gfx_info[idx].path = "/sys/class/drm/card0/device/tile0/gt1/freq0/act_freq";
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
next:
|
||||
/* New i915 graphics sysfs knobs */
|
||||
if (!access("/sys/class/drm/card0/gt/gt0/rc6_residency_ms", R_OK)) {
|
||||
gfx_info[GFX_rc6].path = "/sys/class/drm/card0/gt/gt0/rc6_residency_ms";
|
||||
|
Loading…
Reference in New Issue
Block a user